Quantcast
Channel: Instrument Control (GPIB, Serial, VISA, IVI) topics
Viewing all articles
Browse latest Browse all 5635

problem with bytes at port read in VISA

$
0
0

Hi guys,

I'm trying to read data from device using usb-BT dongle. It creates the virtual port and read without problem. 

My problem is the device send packets of 428 bytes, inside of this block i have 400 bytes of data from byte 9 to 409. The first 3 bytes of each block is the same.

4D45 50 -- MEP, they are the first 3 bytes of each block of 428 bytes. 

 

Ok, if you check the vi, I config the visa and send Setting data to device, read the response and it sends the data to start to sendding data.

Well, I try to read each block of 428 and show in one graph.

The problem is sometimes bytes at ports are 428 and anothers shows 23, 2, 125,... is not continous 428 bytes each iteration and destroy the data graph.

IF I check the graph outside of main loop I see the graph correct. Outside of mainvi I collect whole data and separate in 428 blocks, extract the 400 bytes of data and parse the signed 16bits to integer and show in graphs.

 

So, I dont know the best way to get 428 bytes in each iteration.. I tried to directly read 428bytes but sometimes fail again, reading very low bytes... putting time to wait before to read bytes in each iteration... I need any way to get 428 values before to get the 400 data readings. Even I could probe each block start with the 4D4550 HEX bytes to pass and got the data... 

Maybe it would be better using queue? or using any while loop to wait until I got 428 bytes??. Any help will be apprecite.

 

Regards, Fred.

 


Viewing all articles
Browse latest Browse all 5635

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>