Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ni-imaq serial read problems

Hello,

 

I am having a problem with my ni-imaq serial read. I have a camerlink camera that is sending serial commands through the camerlink cable with a baud of 115,200. I am using the PCIe-1427 cameralink card for this project. Using the camera file generator, I configured the serial port to read in at the baud and also to detect the termination character which is \r. The problem is when I am reading from the port using this method I will get one full message then the next message will be a piece of message. I do not know if my cameralink card is able to keep up with the baud rate or not. I have attached a pic of my vi. Should I be doing this or should I just read in byte by byte and when I get a termination character I will assume that is the end of message and parse that.

 

Thanks

NI-IMAQ.PNG 

0 Kudos
Message 1 of 4
(3,478 Views)

Have you tried giving it a bit more time to write data? You might want to use a flat sequence structure and embed a bit of a wait in there, maybe 100ms, and see if you get the full message. Does this change things?

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 2 of 4
(3,466 Views)

Yes it does change things but I also miss data. My data is coming in at 30hz and if i put in 100ms wait then I am reading at 10hz.

 

Thanks.

0 Kudos
Message 3 of 4
(3,457 Views)

Actually, you might be able to eliminate the wait and try putting in a timeout that corresponds to the rate you want to read at. It seems right now you're reading too fast; without a wait function, that's likely what will happen. It'll result in your message being broken up, since the serial read doesn't know when the incoming message is complete.

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 4 of 4
(3,429 Views)