MODBUS to ASCII Serial

D

Thread Starter

David Siler

I have been working with MODBUS for years but now have a unique application that has my brain vapor locked. I have an autosampler that receives commands via ASCII strings using hyperterm, i.e PMP OFF<CR>.
I need to control via MODBUS. I have found a prolinx gateway that converts MODBUS to ASCII serial but can't seem to find anything to describe what the MODBUS holding register would look like?? Prolinx tech support has positively assured me this will work.

Has anyone done a similar application?
PMP OFF <CR> = 400001 value????
 
I can imagine a couple approaches.

1) A repetitive, frequently used message, like a command to the field device, is configured in the gateway.

Your Modbus master triggers it to be sent as an ASCII command from the device side of the gateway, for instance write a value 1 to coil address xxxy which means 'send the command Y')

2) Your master packs ASCII character that are the command msg into a Modbus telegram and writes the set of characters to the gateway into as many words/registers in the gateway as it takes to make the msg.

The gateway then unpacks/repacks the characters and forwards them to the field device as ASCII characters, having been programmed that a write to that set of registers is command to be forwarded in ASCII.

You mentioned control (send a command) but if there's a read function, the data from the device get shifted to a register that is Modbus addressable and the Modbus master then to poll to read the data from the gateway Modbus registers.

Honeywell's Trendview paperless recorder is functionality half of the gateway; it receives a Modbus message, and marks the contents of the Modbus message on its virtual chart.

The Modbus message consists of ASCII characters packed into sequential Modbus registers, which works for pre-formatted, repetitive messages. The Honeywell's message registers are dedicated for this specific function, to receive characters and write those characters as a message on the chart. So it receives ASCII characters packed as Modbus 16 bit words.

For instance, the word 'Cleared' is formatted with the hex characters (below) in sequence; two characters to a Modbus word, with a double null bytes to round out the last register.

43 = C
6C = l
65 = e
61 = a
72 = r
65 = e
64 = d
00 = nul

Your PMP OFF<CR> would consist of the binary equivalent of the hex characters:
50 4D 50 20 4F 46 46 0D as four 16 bit words

Make sure the gateway talks 7 bit ASCII on the field device side, if that's what the field device needs. Sometimes 7 bit words are overlooked in favor of 8 bit words.

You can always download the gateway manual and see what it says.
 
D
Thanks for the response. I believe your second approach is going to be the route I will need to take. The documentation off prosoft website is not real straight forward. There is a manual for the modbus side and one for the ASCII side but nothing that really ties the two together. I do know prosoft has very good tech support.

As far as the 7 bit ascii, I know that is typical for modbus ascii but this is more like a print command. I have already connected to the device 9600 8N1 and successfully sent commands via hyperterm.

I guess I need to just take the leap of faith and purchase one of the gateways.
 
ASCII has only 128 characters and is normally represented with 7-bits. ASCII also works in 8-bit mode where it always uses 0 for the highest 8th bit. (excluding extended ASCII, which is always 8-bit)

I think David_2 has the right idea. To get the gateway to send the ASCII string PMP OFF<CR> to the device, hopefully it will be as easy as writing the string characters to the gateway's MODBUS registers.

The eight 8-bit characters would need four 16 bit registers.

1st register: ascii: P M, hex: 50 4D, decimal: 80 77
2nd register: ascii: P space, hex: 50 20, decimal: 80 32
3rd register: ascii: O F, hex: 4F 46, decimal: 79 70
4th register: ascii: F CR, hex: 46 0D, decimal: 70 13
 
D
Thanks your feedback has been great. I now have the logic in place to convert my ascii text strings to 8 bit integers. Is there a clean way to pack the (2) 8 bit integers into a 16 bit format to feed to my gateway?
 
Top