CP341 Coil Write problem

Friedmutant

Member
Join Date
Jul 2010
Location
Seattle
Posts
7
I'm having a very strange problem trying to set a coil over modbus on our Siemens CP341. Register reads/writes work; coil reads work; but coil writes are broken.

I have the following word, I'm trying to use the 8th bit to set/reset the coil:

Code:
2#1111_1110_1111_1111

When the 8th bit is 0, the coil write works fine, as seen in this modbus traffic capture:
Code:
776391-Rx:0C 05 00 08 00 00 4D 15
776392-Tx:0C 05 00 08 00 00 4D 15
That's me doing a coil write (fn 5) to coil 8, clearing it.

However, when that 8th bit is set, there are is nothing on the wire for that coil number. I'm baffled. Any ideas? Please don't assume I know what I am doing either. This stuff is brand new to me still.
 
Problem Solved

Rookie mistake, I suppose. To set a modbus coil, you must send 0xff00. The problem was I was trying to fit that into an INT, which doesn't work. Hence my coil sets never showed up in my modbus traffic trace. Changed the variable to WORD and now all is well.
 

Similar Topics

Hi i have a cp341 1CH01 Rs485 and et200m ,i wanna use that to interface with a non simense slave device ion7330 are any deference between 1CH02...
Replies
2
Views
1,791
Hi guy 's, can i use cp341 modbus rtu to interface with a non_siemnes slave device , such as schneider ion7330 ?
Replies
4
Views
1,947
Hi, I am using the CP341 for modbus RTU in an ET200 rack. Usually we are using the CP341 for this application in the same central rack as the...
Replies
0
Views
1,057
Hi all, Does anyone have any experience trying to simulate a Modbus master using a PC, The PLC is a cpu 300 with a CP341 RS485. I am...
Replies
5
Views
2,653
Hi, I had RS485 ASCII string going into a CP340 @ 9600baud rate. This was working fine. I had to change my baud rate to 19200 so I got ripped...
Replies
4
Views
2,513
Back
Top Bottom