Discussion:
Periodic messages with Frame API
(too old to reply)
Matisson
2008-04-29 08:10:06 UTC
Permalink
Hi everyone, I receive a CAN frame every 16ms but in my application I get samples (from CAN and Analog Signals) every 5ms.Is there a way to configure the Read function of the Frame API to get it every 5 ms ? i.e. to keep the last value received. Currently in my VI, I got a sample every 16ms, and when I sample more often, I got zeros...I know this is possible with the Channel API, but I also have to use Remote Frames and this is unfortunately impossible with the Channel API.Thanks in advance.
JB
2008-04-29 08:40:10 UTC
Permalink
Why don't you use ncWaitForState.vi ? Set the DesiredState input to 1 , and this VI will then wait until a message is received or the timeout occurs.- timeout : do nothing or handle timeout
- message in the queue : read
Doing so, there is no need to set an additional timing function in the loop.Am I missig something ?
DirkW
2008-04-29 14:40:13 UTC
Permalink
This sounds more like you need to implement a kind of oversampling for your incomming message? Your message comes every 16 ms but you would like to have a message every 5 ms? Is that because you need to execute the loop every 5 ms and you allways get a zero if you read to fast?
As mentioned by JB you could use the wait but that would block your loop from executing and it would run every 16 ms instead of 5 ms.
Instead you could run your loop in 5 ms cycle and use the get property "entries pending" to check every 5 ms for a message. If the message is there then receive it and update your UI, if not use the last value again.
see the attached VI .
DirkW


CAN Receive_cont.vi:
http://forums.ni.com/attachments/ni/30/3401/1/CAN Receive_cont.vi
Loading...