LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to send/read bits information via visa

Solved!
Go to solution

Hello people.

I've bought an encoder that reads a datamatrix adhesive tape and returns information like x and y position and velocity. It communicates via serial 485, and i need control it trought labview, i don't know how to do that. The protocol of communication consists in sending a request telegram and recieving an response telegram.

To send the request telegram has 2 bytes: one containing 8 bits of information plus a parity bit, and the other byte has the parity bit and the same 8 bits of information sent in the first byte, but here they're inverted. For example byte1 is 110000100 and byte2 is 101111011 (this is requesting x position)

The response telegram contains 6 to 9 bytes (all of them have 8 bits plus the parity bit). The 2nd to 5th bytes contains the x position, so i need to read them and convert to a decimal number.

 

The issue is that visa functions work with strings, so i don't really know how to properly convert the informations from those 2 bytes to send the request, neither how to convert the string read from the instrument to binary and finally to decimal number. Do you have any ideia?

 

Greetings,

Vitor

 

0 Kudos
Message 1 of 3
(2,446 Views)

I made two arrays of bits, one for byte1 and one for byte2, and converted them to strings and concactenated those strings and sent to the encoder, but i had no response... am i on the right trail?

0 Kudos
Message 2 of 3
(2,444 Views)
Solution
Accepted by topic author Vitor Soares

 


@Vitor Soares wrote:

I made two arrays of bits, one for byte1 and one for byte2, and converted them to strings and concactenated those strings and sent to the encoder, but i had no response... am i on the right trail?


Partially. This is a frequently asked question. You need just one array of U8, containing the 2 bytes you want to send, and then you can just use the Type Cast function or a Byte Array to String to get a string that you can feed to VISA Write.

 

0 Kudos
Message 3 of 3
(2,427 Views)