LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA serial communication shows zero bytes at port

Solved!
Go to solution

You clearly misunderstood what you need to do. IF a device wants binary data it usually means that it wants an array of bytes that can have the numeric values 0 to 255. It doesn't mean that it wants a string where the bytes has been converted into 0 and 1 characters.

 

You talk about having to send 35 bytes but really send 280 bytes of data and your device simply sits there and thinks "What the hell are you trying to tell me? Please send something sensible to me!"

 

Get rid of that entire loop that turns your 35 bytes into 280 characters of 0 and 1s and replace it by a Byte Array to String instead and feed it to the VISA Write function.

 

And if you are at it, abslutely positively drop that Bytes at Serial Bytes too. It has absolutely no business in this program if you know the number of bytes the answer should be anyhow. Sinply wire that number to VISA Read and use a sensible timeout of maybe 1000 ms. VISA Read will then sit there and wait for the answer until either an error occures, the timeout expires or the number of requested bytes have been received and the entire Bytes at Serial Port is completely unneccessary.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 11 of 14
(850 Views)
Solution
Accepted by asukumari

You clearly misunderstood what you need to do. If a device wants binary data it usually means that it wants an array of bytes that can have the numeric values 0 to 255. It doesn't mean that it wants a string where the bytes has been converted into 0 and 1 characters.

 

You talk about having to send 35 bytes but really send 280 bytes of data and your device simply sits there and thinks "What the hell are you trying to tell me? Please send something sensible to me!"

 

Get rid of that entire loop that turns your 35 bytes into 280 characters of 0 and 1s and replace it by a Byte Array to String instead and feed it to the VISA Write function.

 

And if you are at it, abslutely positively drop that Bytes at Serial Bytes too. It has absolutely no business in this program if you know the number of bytes the answer should be anyhow. Sinply wire that number to VISA Read and use a sensible timeout of maybe 1000 ms. VISA Read will then sit there and wait for the answer until either an error occures, the timeout expires or the number of requested bytes have been received and the entire Bytes at Serial Port is completely unneccessary.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 12 of 14
(847 Views)
You are correct!! I have misunderstood the communication protocol completely. It indeed works now with just sending in array of 35 bytes !

Thank you for clarifying this entire concept. Very much appreciate everyone who helped me understand how to work with NI VISA system.
NI System Configuration:
- NI PXIe-1071, 4-Slot 3U PXI Express Chassis , 1 GB/Slot throughput, Part Number: 781368-01
- NI PXIe-PCIe8381,x8 Gen2 MXI-Express for PXI Express Interface,3m, Part Number: 782522-01
- PXIe-5160 PXI Oscilloscope, 500 MHz, 10 bits, 2.5 GS/s, 2 Channels, 64 MB, Part Number: 782621-01
- Astronics PXIe-1209 2-Channel, 100 MHz PXI Pulse Generator, Part Number: 785033-01
0 Kudos
Message 13 of 14
(823 Views)
It's a custom proprietary board that works with a BLE kit.
The instructions about the message protocol are misleading. It isn't actually expecting a binary series of bits at all as RavensFan said!
NI System Configuration:
- NI PXIe-1071, 4-Slot 3U PXI Express Chassis , 1 GB/Slot throughput, Part Number: 781368-01
- NI PXIe-PCIe8381,x8 Gen2 MXI-Express for PXI Express Interface,3m, Part Number: 782522-01
- PXIe-5160 PXI Oscilloscope, 500 MHz, 10 bits, 2.5 GS/s, 2 Channels, 64 MB, Part Number: 782621-01
- Astronics PXIe-1209 2-Channel, 100 MHz PXI Pulse Generator, Part Number: 785033-01
0 Kudos
Message 14 of 14
(821 Views)