04-29-2011 10:16 AM
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
Solved! Go to Solution.
04-29-2011 10:21 AM
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?
04-29-2011 05:08 PM
@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.