LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New - RS485 Serial Comms

Hi all, I am new to serial comms with RS485. I have watched video and managed to create Visa Resource Name (to configure the comms setting), Visa Read, Visa Write and InstruProperty (to determine the byte size and pass it to Visa Read).

 

My instrument connector is RS485 and I am using a RS485-USB convertor. I have a protocol manual from the OEM which I dont understand how to write the message to write to the instrument and to receive the reply.

 

The following is an example stated in the manual:

 

PC Request to instrument:

<0xAA> Prefix

<0x00> LENHi

<0x0A> LENLo

<0x00> Client

<0x01> NameTr

<0x01> NameRx

<0x00> STATUSHi

<0x00> STATUSLo

<0x0B> CODE

<CS> Checksum

 

So, how should I type into the Control for the Write Buffer (Visa Write)

 

Thank you.

0 Kudos
Message 1 of 7
(3,165 Views)

Hi kwai,

 

create an U8 array, change the numeric display to HEX and type in the values:

check.png

You need to calculate a checksum and append that to your message.

When you have different messages you might want to replace HiLen and LoLen values using ReplaceArrayElements…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(3,158 Views)

Hi,

 

Do you mind sharing your manual ?

-
Amit
CLAD
0 Kudos
Message 3 of 7
(3,156 Views)

Hi,

 

Not at all. Please see the attached manual for the protocol comms. Thanks

0 Kudos
Message 4 of 7
(3,149 Views)

you already got the answer aboveSmiley Happy

-
Amit
CLAD
0 Kudos
Message 5 of 7
(3,132 Views)

Hi GerdW,

 

I will have been writing to the sensor but did not receive a reply from it. I even tried using Hyperterminal but also did not work.

 

What is wrong with the following code:

 

0x0A 0x00 0x0B 0x00 0x00 0x01 0x00 0x00 0x0B 0x00 0xDF

 

Please help. Much appreciated. Regards

0 Kudos
Message 6 of 7
(3,071 Views)

Why the 0x00 before the 0xDF?  Assuming I am seeing the command you are sendinfg, the manual indicates an 8-bit checksum.  Looks like you are sending a 16-bit checksum.  Also, the manual has a Prefix of 0xAA, not 0x0A.

0 Kudos
Message 7 of 7
(3,066 Views)