Technical FAQs

Ask a Question

How can I establish a Modbus connection between Unity-Momentum CPUs using Dial-up Modems?

Product Line:
Unity Momentum CPU

Environment:
Unity Pro XL V13.0, v13.1
Control Expert v14

Resolution:

The first thing to keep in mind when using Modem communications is that the modem will only communicate via RS232 wiring configuration. Proper wiring of the RS232 port is critical to the operation of the modem. The RS232 pinout of the Momentum CPU is shown on page 30 of the attached User guide for the Momentum CPU Modules. You will need to refer to the specs from the manufacturer of the modem for the correct pinout.

The Serial port settings used in the Momentum CPU and modem must match. The serial port settings used in the example are as follows:

Physical Line: RS232
Signals: RX/TX
Transmission Speed: 9600 bps
Delay Between Frames: 4ms (Default)
Data: ASCII 7 bits
Stop: 1 bit
Parity: Even

The program itself, consists of 6 XXMIT blocks that are fired sequentially from each bit in the Start_XXMIT array.

The First XXMIT block initialized the modem.Command word 513 is used indicating that ASCII messaging is used and the modem is being initialized.


The Second XXMIT block dials the phone number. Command word 514 is used indicating that ASCII messaging is used and the modem is dialing out. For this block, the MSG_OUT is simply the phone number you are calling.

The Third XXMIT block passes Modbus data.Command word 256 is used indicating that Modbus messaging is used. Here, the MSG_OUT array needs to be at least an array of 6 words, but a value of 5 needs to be put for the message length. The Modbus request is built in the 5 words in the MSG_OUT array. The first word, is the Modbus function code you are performing, the second word is the number of registers you are reading from/writing to, the third word is the Modbus address of the slave device, the forth word is the starting register in the slave where you are accessing data, the fifth word is the starting register in the Master where you would like the data to go. In addition to the MSG_IN array, the data will also be placed in the register pointed to by this word. 

The Forth XXMIT block triggers the escape sequence so the modem returns to Online Command Mode by sending the character string '+++' with Command word 512 is used to indicate ASCII messaging
.
The Fifth XXMIT block hangs up the call. Command word 513 is used indicating that ASCII messaging is used and the modem is being initialized, but the string 'H0' also gets sent in the initialization which hangs up the call.   

The Sixth XXMIT block sets the Momentum CPU back to a Modbus Slave by sending command word 32768.
Was this helpful?
What can we do to improve the information ?