Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How LV handles sending of serial communiation bytes?

JLS, Thanks again.

I expect to receive my "actual" laser sensors with serial output in 2 days. We've been working with a poorer standby system (which has been not easy to work with).
I will revert back to this discussion if I continue to face issues with my new sensors (make: LMI Selcom, Sweden)).
Should I place my query here or would you like me to write to your directly over email? It would be nice to have your email id, just in case. My email id is "gurdas@qagetech.com"

I had some thoughts on your above reply:

"Say I configured my FIFO size to 4 bytes. But my read vi is not always active. Its turn comes once in a while. What happens when the FIFO receives 4 bytes but there is no read vi active? Will it forc
e my read vi to get activated? That is something I do NOT want. Or will the FIFO simply start to receive the next 4 bytes thus losing the current 4 bytes. Or will the current 4 bytes move automatically to some CPU memory where I can access it later?

Also, if I do not read the 4 bytes when they arrived, and the next 4 bytes start coming in, will it not result in a continuous interrupt since the bytes if FIFO will always be 4!! (0123, 1234, 2345, 3456 ...). I am unable to flush because that too is happening only before my read vi."


Best,
Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 11 of 15
(1,325 Views)
Hi Gurdas,

We can continue to communicate over the forum if that's ok, this way others who have similar questions can benefit from it!

Now to your question, your read VI will NOT automatically activate when an interrupt occurs, only a transfer of the data in the receive FIFO to CPU memory will occur. Furthermore, if bytes are continuously sent, they will be transferred to CPU memory for access later. You can test that you will not lose data by trying this; set your receive FIFO size to 4 and then perform consecutive writes to a serial port in LabVIEW (4 bytes at a time perhaps) then read them after and you should have access to them. Interrupts will continue to occur if you are continuously receiving data
so that the data can be transferred to CPU memory. If you are concerned about hogging CPU time you can increase the receive FIFO size to 14; this does not mean you have to send at least 14 bytes to get access to them, which is also something you can also experiment with in LabVIEW.

Have a great weekend!

JLS
Best,
JLS
Sixclear
0 Kudos
Message 12 of 15
(1,325 Views)
Hi JLS,

We tested the sensor and atleast it replies as expected to our command.

1)The reply is 2 bytes. So, I set my FIFO to 2 bytes. But, how do I set the CPU buffer? I'd like that to be 2bytes so that I have only the latest data available to me.

More questions over the weekend 🙂

Thanks,
Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 13 of 15
(1,325 Views)
JLS,

I understand the RS-422 serial ports on the PXI-8423/2 have inbuilt buffer of 64 bytes. Also, there is some PC buffer to which the port buffer sends data before I can access it.
Am I right?

1) Can I control/configure both - port buffer and PC buffer?
2) Are both these buffers FIFO?
3) What is the size of each?
4) How do I set the trigger level for each? Trigger levels are mentioned in the document "Serial Communications Hardware Concepts and Hardware Overrun Errors" on NI's website

Looking forward to an early reply.

Thanks,
Gurdas
Gurdas Sandhu, Ph.D.
ORISE Research Fellow at US EPA
0 Kudos
Message 14 of 15
(1,325 Views)
Hello Gurdas,

There is some information about this in the User Manual for the NI Serial Hardware.
Serial User Manual
Here are other links discussing about UARTS and FIFO
Buffer size

UART FIFO Buffer
Hope this helps.

Ricardo S.
National Instruments.
0 Kudos
Message 15 of 15
(1,325 Views)