10-07-2016 04:52 AM - edited 10-07-2016 04:56 AM
Hello
I'm currently working on a VI to read data from a given VRU (vertical reference unit).
The data is sent over the COM-Port. I've managed to make it run in an untimed loop with events, such that the data is read whenever something is on the Serialport. However, the data from the VRU is sent with a fixed frequency and should also be stored that way. It is split up in several messages though.
What I have in mind from my C-programming are two separate applications. In first one the Serial-data is read and then whenever a full VRU measurement has arrived (consists of multiple serial-messages) an interrupt is triggered which signalizes to the 2nd loop that data must be processed and stored.
As I said the first part was done, but I'm not sure now, how to make an interrupt work like that and then store it such that it has a fixed dt.
Any help or examples are appreciated.
Thank you
10-07-2016 05:28 AM
-Use the Value (signaling) property to fire the Value Changed event programmatically: http://www.ni.com/example/26471/en/
-You can also try using Producer-Consumer architecture to simply enqueu the interrupt/action : http://www.ni.com/white-paper/3023/en/
10-07-2016 06:45 AM
Could you elaborate more on the exact protocol of the data coming into the serial port? I think we can greatly simplify your setup here.
For instance, since the VRU is sending data at a fixed rate, there is really no need for the VISA Events. You just need to know how many bytes to read for an entire measurement or use the termination character (which, from what I can tell, is the route you really want to take here). If you do not get data in a designated amount of time (the VISA Timeout), then something is wrong anyways and you should throw the error and stop.