AIP and [delay]

BTCAD

Active Member
HI, 
     One more question. 
 
I want to test aip1 for more than 5000ms greater or equal to 550 and put the result into ram13
 
::::::::::::::::::::::::::::::::::::::::::::::::::
 
TSTGE AIP1[5000] 550 RAM13
 
 
the 5000ms is ignored ;/
 
I tried IP1[5000] instead of AIP1[5000] and that thing work perfectly.
 
 
Why AIP1[5000] does'nt work?
 
 
 
I found that in the user manual:
[] = non-blocking delay operator optional to TTL input/output and VARs
 
 
so if i put the aip1 value to a var will I be able to test a 5000ms delay?
 
BTCAD said:
I found that in the user manual:
[] = non-blocking delay operator optional to TTL input/output and VARs
 
 
so if i put the aip1 value to a var will I be able to test a 5000ms delay?
 
Please stop and think about some of these things before you post.
What exactly are you trying to accomplish? There is (AFAIK) no way in the existing code of the WC to test for an analog input to meet a given condition for a variable time, without actually writing something yourself.
Writing non-blocking code to do this is probably non-trivial, but an example might be something along the lines of
 
 

   ...
   tstle aip1 550      ; is input 1 less than or equal to 550?
   add CTS 5 ram1 ; if so, reset the timer
   tstgt CTS ram1   ; is the current time greater than the 5-second timer expiry?
   callsub  dostuff   ; yes, so go and do stuff
   ...

 
Of course, if your api1 drops below 551 briefly, this code may not "catch" it, depending on what else your code does, blocking delays etc.
Without a clearer picture of what you're trying to do, it's impossible to second guess you.
 
Back
Top