Jump to content
OMRON Forums

Counting the EQU


caixin

Recommended Posts

Hi,

below you can see a piece of source code for EQU reading.The value of P1 in PLC0 should be 1000, The value of sys.idata[65535] in ISR should be 1000,but the actual value is not fixed(The actual: P1=988,sys.idata[65535=1996]).Can you help me see why?

IDE:4.1.0.24. CK3M:2.4.0.4.

Thanks in advance.

 

//PMAC Script Language\Motion Programs

open prog 1

inc

linear

ta 400

tm 3600

dwell 0

Gate3[0].Chan[0].CompA=20*4096

Gate3[0].Chan[0].CompB=30*4096

Gate3[0].Chan[0].CompAdd=40*4096

Gate3[0].Chan[0].EquWrite=1

dwell 0

p1=0

Sys.Idata[65535]=0

dwell 0

Gather.Enable=2

dwell 0

x 40000

dwell 0

Gather.Enable=1

close

 

//PMAC Script Language\PLC Programs

open plc 0

local oldequ;

if((Gate3[0].Chan[0].Equ==1)&&(oldequ==0))

{

p1++;

oldequ=Gate3[0].Chan[0].Equ;

}

else

{

oldequ=Gate3[0].Chan[0].equ;

}

Close

 

//C Language\Realtime Routines

void CaptCompISR(void)

{

volatile GateArray3 *MyFirstGate3IC=GetGate3MemPtr(0);

int *CaptCounter;

CaptCounter = (int *)pushm + 65535;

(*CaptCounter)=(*CaptCounter)+1;

MyFirstGate3IC->IntCtrl=0x10;

}

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Guest
This topic is now closed to further replies.

×
×
  • Create New...