Hardware settings for the CP1W and Dip switch settings are the same as done in CP1E, as depicted in the earlier post. If you want to review it again and want to know WHAT IS MODBUS COMMUNICATION, then see here.
Now we have to make settings inside the PLC through CX-Programmer. So we will look here that What are the settings in CX-Programmer to Configure MODBUS?
In CP1H we can connect CP1W-CIF11 in both the Serial Option Port i.e either Port 1 or Port 2. To do necessary settings open CX-Programmer and after selecting PLC type as CP1H, right click on settings and go serial option port 1. Then select mode type as Serial gateway (this is used in MODBUS Communication) and select the baud rate and format as accordingly to your slave devices.
NOTE:- All the slave devices and Master should have the same baud rate and same format.
If you want to connect the RS485 Port in Serial Option Port 2 then make all these settings under serial option port 2 tab . Look below picture for a more clear understanding.
NOTE:- click on the image for a clear larger view.
Now we have to write the program in PLC for the communication to place. A fixed Data words are allocated inside the PLC for the MODBUS Communication.
For Serial option Port 1 DM32200 to DM32299 are used to send Query and receive responses from slave and system bit a641.0 is used to send the query to slave devices.
For Serial Option Port 2 DM32300 to DM32399 are used to send Query and receive responses from slave and system bit a640.0 is used to send the query to slave devices.
The format of QUERY in MODBUS Communication generally depends on the slave devices as how they accept it but still there is a standard format.
DEVICE ID <<<>>>FUNCTION CODE<<<>>>DATA <<<<>>>CRC
Device ID in Modbus can be from 1 to 247 but MODBUS support a maximum of 32 nodes in one network . Function code are different for different purposes, generally function code 3 is used to read and function code 6 is used to write . Later on we will discuss all these in in depth and understand it by taking examples as how to write PLC program for MODBUS in Omron PLC, etc.
Don't forget to subscribe to receive latest updates in your Email by subscribing to Automation-Talk by Email.
Advertisements :-
May I know why have this error 0x04 come out at D32202?
ReplyDelete