Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

visa read

Dear all,

I am using simple visa read function for reading the data from a device. The device is working as a master. Now to establish the communication i have to send the request frame to the device and it sends me back some response. Now my problem is data on the serial port is coming very frequently and i am not able to sort it out for further operation and extracting the meaningful informmation form it. can i store the incoming data of the serial port to some where in array or regisster, because next frame response replaced the prvious response or is there any other operation that i perform to resoive my problem.

I have used feed back loop and concatenate function for storing the incoming data into buffer, snapshot is atteched. All i need to store these frames separately.

Thank youCapture.PNG

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

What device are you communicating with?  What is its protocol?

 

Typically you can get the frames easily enough as they come in and then use a queue to send the frames to another loop for processing, similar to a Producer/Consumer.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(3,495 Views)

sorry for the late rply..

I am dealing with bacnet mstp device and i am not familiar with produce and consumer loop.

One more problem i am facing is how much byte i should read at port.

i have used byte at port but i am not geeting any appropriate result.

some response are of 8 byte and some of them are 30 byte.

Please suggest.

Thank you

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

From what I can find, BACnet is a binary protocol.  So make sure the termination character is turned off.

 

What you need to do is first read 3 bytes.  The first two are the preemble (0x55FF) followed by a single byte for the Frame Type.  Based on the frame type, you read how ever many bytes you need to either finish the frame or to get the number of bytes to finish reading the frame.  Unfortunately, you just need to read the specification to get any further than that since I am seeing some inconsistent frame setups based on what frame is being sent.  A simple State Machine could help you a lot here.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 4
(3,464 Views)