Hi,
I'm trying to debug a very large CRBasic code, and a last point is driving me crazy. For "external" reasons, I need to do a Pulsecount, sometimes in the "normal scan", sometimes in the "SlowSequence" (via an SDM) but always require to store the result as the totalized pulsecount in a "slow table" (I use also a "fast table" but not present in this
I was able to invest and extract the segment of code that generates the problem (please see below). When I put a 30Hz signal on C8 (i.e. channel "18"), and read the values, I read 7 or 8, corresponding to the "instant" value each 250ms instead of "150 pluses" that would correspond to 30Hz for 5s.
Thanks in advance for your help!
---
Public MyVariable
Units MyVariable=mm
DataTable(Slow,True,-1)
DataInterval(0,5,Sec,5)
Totalize(1,MyVariable, FP2, False)
EndTable
BeginProg
Scan(250,mSec,10,0)
PulseCount(MyVariable, 1, 18, 0, 0, 1, 0)
NextScan
SlowSequence
Scan(5,Sec,5,0)
CallTable Slow
NextScan
EndProg
I haven't tested this, but my first thought is the problem is likely that your Slow table is not called each scan. It should be pulled out of the slow sequence. DataInterval will determine the rate at which data is output.
Dana W.