Is it possible to record the values of C1 trough C6 on the table, using boolean values?
The idea is to record every 5 minutes, and to record if at any time between those 5 minutes there was a High value on any of those inputs.
I've tried with
Public read_IO Public flags(8) As Boolean
DataTable (Test,1,-1)
DataInterval (0,5,Min,10)
Sample(1,flags(1),Boolean)
Sample(1,flags(2),Boolean)
Sample(1,flags(3),Boolean)
Sample(1,flags(4),Boolean)
EndTable
BeginProg
Scan (1,sec,0,0)
ReadIO(read_io,&B00001111)
For i = 0 To 3
flags(i + 1) = read_io AND 2^i
Next
CallTable Test
NextScan
EndProg
But it only records if there was a High value on the first second of the 5 minutes.
Hi
I think we needed more information.
- How long will the event be recorded? ie how long the C1..C6 port remains high?
If it lasts less than a second, with the scan at 1 second it could not be intercepted.
- It may happen that there are multiple events on the same port, in five minutes,?
and what you have to record only the first or all?
- However, you must register the event time, not the port status. right?
Smile
Thank you for your reply, I'll answer your questions in-line.
How long will the event be recorded? ie how long the C1..C6 port remains high?
It should remain open for at least 1 second for the the datalogger to register
It may happen that there are multiple events on the same port, in five minutes,?
Yes it may.
and what you have to record only the first or all?
I need to record just the first occurrence
However, you must register the event time, not the port status. right?
Actually I just need to register if it occurred during the 5 minutes interval, not when.
Regards
jgalaz,
Try using a Minimum() instruction instead of Sample() in your output table. Boolean variables are numerically either 0 when False, or -1 when True. So, if your flags variable ever goes True (-1) the Minimum will be -1.
Let us know if that does what you need.
Best,
Janet