LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Visa Read with RS485: What format does communication take?

I am trying to communicate to a power supply. The Power supply has a RS485 port with three pins (A, B, GND) and uses half-duplex, 9600bits/s connections. All my startstop bits, parity and COM port settings are correct. I use a Serial-USB adapter to communicate. There are no drivers for this power supply and I have to write my own COMM protocol. Communication is done via 'messages', examples of whcih you can see in the attached .png- file. The manual that came with the power supply says that "all multi byte data is sent in big endian hex numbers and represented with ASCII characters".


Given that this is a serial connection, I was hoping to use the VISA vi's for communication. Unfortuanately, I have been somewhat unsuccesfull. My problems are:

1) The 'VISA Write' vi takes a string input. What representation does my string take? Is it supposed to be the actual

message, or do I have to convert each ASCII character in the message to its HEX representation and concatenate these to form the input to the vi?

2) The messages returned by the 'VISA Read' vi are very cryptic. For example:

the message to enable control of the Unit is 'S1L00D0K' sending this returns the message '   VgÖöv}i',
whereas the expected reply should have been 'S4L2DK'.
No matter how you twist that in hex it doesn't match anything: expected 53 34 40 32 44 4B, received 20 20 20 56 67 D6 F6 76 7D 69.

3) The attached vi that I used to try this out keeps throwing errors which originate in the 'VISA READ' vi. The error is:

Error Code -10738071253: VISA: (HEX 0xBFFF006B) A framing error occurred during transfer. I followed this KnowledgeBase article, but without success.

4) I have tried multiple terminal emulators (Tera Term, Putty, RealTerm) to break communication down to basics, also

without success. I tried out every possible setting and I can't even the keyboard; nothing is being printed in the terminal.

 

All this leads me to believe it is a hardware problem, originating in the adapter, although I know that other people have used exactly the same adapter successfully before.

 

Can anyone tell me what is happening here? How will I get a meaningfull response out of my machine?
Many thanks in advance!
Douglas

Download All
0 Kudos
Message 1 of 7
(4,695 Views)

It does sound like a hardware issue. Does the RS485 adapter you are using have a termination resistor?

Do you have the datasheet for the adapter?

 

I would double check every setting again and try to get some sensible reply with putty.

 

 

0 Kudos
Message 2 of 7
(4,644 Views)

But isn't the fact that I am getting a reply a good sign?

Or could the reply come from the USB-RS485 converter rather than the instrument? If it does come from the instrument I will just have to play around with byte orders until I understand the reply.

Attached is the converters manual  page on the termination resistor. I can't say I understand it, but don't think I have to. It sounds like its taken care of.

Thanks for your reply
Doug

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

Hi bockdoug,

 

page on the termination resistor. I can't say I understand it,

Well, it's a very simple schematics showing how and where to place two resistors.

You don't understand that?

 

but don't think I have to. It sounds like its taken care of.

Where does it sound like "its taken care of"?

It clearly says "has to be blanked off"!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(4,594 Views)

Mmmh. I guess you're rigth. I thought the sentence "An termination resister ( Rt) is intalled for this purpose" meant that the resistor is already in place. But that cant actually be... I will try that out. Thanks for your response.
Doug

0 Kudos
Message 5 of 7
(4,565 Views)

Can you descibe exactly how you have this configured, in terms of electrical connections.

Also let me know exactly which model RS485 adapter you are using and the name of the device you are trying to connect to.

 

Is this part of a multidrop system or are you just connecting the computer directly to the device?

 

It may not be a termination issue, but that is something worth checking.

Also worth noting that some companies use different polarities for A and B. I have seen instances of RS485A being +ve and some with it being -ve, hence the need to see the datasheets.

 

 

0 Kudos
Message 6 of 7
(4,544 Views)

Using RS485 can sometimes be very tricky, I suggest that you start with a simpler software to see if you can communicate with your device first before you jump to LabView. you can use this software developed by Sealink for their RS485 hardware but i have successfully used it with other manufacturers:

 

http://www.sealevel.com/support/article/AA-00542/0/WinSSD-Software-Utility-Overview.html

 

1) regrading your representation input, right click on your string input control and tick "Hex Display", and that should sort-out your problem.

 

2) same as above, right click on your string indicator after visa read and check "Hex Display".

 

3) Well that can have different reasons, wrong hardware setup, wrong port settings. make sure your port settings are right, in terms of baud rate, stop bit, parity, etc. 

make sure you do not need a termination resistor, you usually do not need that when connecting only one slave to your port and it is a short wire. make sure that your RS485 port is not set to do receiver Echo, it sometimes can cause problems.

have a delay before writing and reading to the port, 100 mS is a good start!

 

Good luck

0 Kudos
Message 7 of 7
(4,489 Views)