Hi all,
I want to connect CR1000 to PC use Modbus protocol.
My diagram is as follows:
CS I/O pin of CR1000 --> MD485 converter --> "use RS485" --> MD485 converter --> PC (use RS232).
On CRBasic program, I don't know how to declare "ComPort" for ModbusSlave function.
I only know that if I use RS232 pin on CR1000, I'll declare "ComRS232" for it.
Help me if you can, please. It's importance.
Thanks all.
There is a setting in the MD485 that specifies the SDC address that the MD485 will use on the CS I/O port. This can take on a value of 7, 8, 10, or 11. The CR1000 port name will depend upon the value of this setting (ComSDC7 for SDC 7 and etcetera).
Unlike an RS-232 connection, CS I/O is a "multi-channel" communications protocol. CS I/O supports multiple SDC channels and an ME channel. So when you want to make a CS I/O connection between the CR1000 and the MD-485, you have SDC7, SDC8, SDC10, SDC11 and ME that are all "sub-channels" to select from. All of these are accomadated by the physical CS I/O connection made by the connecting cable. I recommend you use SDC7 if you can.
In Device Configuration utility these channels are listed as
"SDC Address 7" "SDC ADdress 8", (10 and 11 also) and "Modem Enable". In the Deployment tab, choose the CS I/O tab, then look at the CS I/O Mode setting.
Once you choose SDC Address 7 (i.e. SDC7), then it should work as long has you have physically connected a cable between the CS I/O port on the CR1000 and the CS I/O port on the MD-485.
When I compile my program. There is a warning: A set coil function could conflict with a control port already in use.
What is this mean? It's important?
I have aslo try to compile for example program in help. This warning still show.
From the help for ModbusSlave() BooleanVariable parameter:
If a 0 is entered for this parameter, then the discrete commands are mapped to control ports 1 through 8 instead. This will cause a compile warning, "A set coil function could conflict with a control port already in use." This is a warning, not an error, and the program can run successfully.
It means that your Modbus Master could change the state of a port that your datalogger program is also changing. For example if your program turns on a pump using a control port, your Modbus master could turn it off.
Thanks all,
I have configured SDC Address 7 on MD485 device and connected a cable between the CS I/O port on the CR1000 and the CS I/O port on the MD-485.
This is my test program:
SequentialMode
Public ModIn(4)
Public PTemp, batt_volt
'*****************Modbus*********************
Sub Modbus
ModIn(1)=1
ModIn(2)=12
ModIn(3)=123
ModIn(4)=1234
End Sub
'*************Running program******************
BeginProg
ModBusSlave (COMSDC7,9600,5,ModIn(),0)
Scan (10,Min,0,0)
PanelTemp(PTemp,250)
Battery(Batt_volt)
Modbus 'call modbus function to collect data
NextScan
EndProg
What is Modbus address of ModIn(1) to Modbus(4)?
On my PC, I used Modbus test soft, with 400001 address for Modbus(1). But it appeared "Illigal Data Address" error like picture.
https://drive.google.com/file/d/0B3sbqUBOvHc4OHZBTGl5aDFieFk/view?usp=sharing
Best regards
I have tried again and connected successfuly.
But I see the floating point variable take tow ModBus registers.
Example, I have read 2 value of ModIn(1) variable:
40001: 18917
40002: 16685
So, how can we converter this two value to ModIn(1) value.
Thanks.
* Last updated by: DauDo on 7/30/2015 @ 9:57 AM *