Siemens S7-1200 and CM1241

Jonnie_R

Member
Join Date
Feb 2012
Location
Brecon
Posts
216
Been a while since I posted here but I need some help with an S7-1200 and the CM1241 module.


I am sending commands to a weigh scale to get the weight so I can add a certain amount of water. It works ok when I ask the scale for repetitive weights as the buffer is constantly open, the issue I am having is with single commands.


I can get round it with a single weight reading and querying the scale to see if it's there but creating a routine that retries if the data buffer doesn't match what I am expecting. However when I send a Tare command, the buffer always seems to be 1 set(buffer) of data behind.


I have checked it with Tera Term and that always reads the correct data. What am I missing?
 
You are sending and receiving ASCII to and from the weigh scale ?
Exactly what weigh scale (link) ?
What is your code ?
Are you using a library or sample project for the weigh scale ?
 
Last edited:
I dont have the time to investigate your code in detail, and I also only have V15.1.

In the manual, I notice this that may be relevant to you case:
2.6.1 Command queue / sequence
Ideally, the balance queues the data stream it receives and handles one command after the other.
When this queue would overflow, the handshake mechanism of the underlying communication interface (e.g. RS-232 CTS/RTS or XON/XOFF handshake) prevents further data packages from the host
computer. This allows the host computer to send whole scripts of commands to the balance.
Depending on the balance type (processor capabilities), this may not be possible. For maximum reliability, wait for the answer of a command before sending the next command – otherwise, for some balances, data could be corrupted or commands be missed.
So it seems that you must use XON/XOF to ensure that data is handled one by one.
As far as I know, when the CM1241 is set to full-duplex mode it should use XON/XOF.
 
I dont have the time to investigate your code in detail, and I also only have V15.1.

In the manual, I notice this that may be relevant to you case:
So it seems that you must use XON/XOF to ensure that data is handled one by one.
As far as I know, when the CM1241 is set to full-duplex mode it should use XON/XOF.


I am using RS232, so full and half duplex doesn't apply.


I only send one command, I am not sending multiple in one go, so there should be no issue. I'll turn on flow control anyway and see.



Tera Term works absolutely fine, and there is no flow control on my USB adapter.
 
I am using RS232, so full and half duplex doesn't apply.
RS232 certainly can be full-duplex.

Tera Term works absolutely fine, and there is no flow control on my USB adapter.
Tera term is some kind of terminal software for sending and receiving ASCII codes ?
That is probably somewhat different since your PLC program works automatically whereas in the terminal program you only sends commands as fast as you can type.

You could modify your PLC code to only send data when you activate certain bits in Watch Table. In that way you can test if it is a timing problem in your PLC code.
 
RS232 certainly can be full-duplex.

Tera term is some kind of terminal software for sending and receiving ASCII codes ?
That is probably somewhat different since your PLC program works automatically whereas in the terminal program you only sends commands as fast as you can type.

You could modify your PLC code to only send data when you activate certain bits in Watch Table. In that way you can test if it is a timing problem in your PLC code.

There is no setting in the CM1241 to set it full or half duplex.


Yes Tera Term is a serial application. My code isn’t working automatically, I am currently triggering a bit manually to try and see what’s going on, hence how I know the buffer doesn’t output any data on the first attempted transmission, but does on the second.


The only difference is that Tera Term just does the response, whereas I have defined the start and end of the response in TIA. If I don’t it doesn’t put the start of the message at item 0 of my char array.
 
There is no setting in the CM1241 to set it full or half duplex.
CM 1241 RS232 is always full duplex.

From the manual for S7-1200 chapter 12.3.2, it says that CM 1241 RS232 supports flow control.
And from chapter 12.3.2.1 onwards there are information about "managing flow control".
 
CM 1241 RS232 is always full duplex.

From the manual for S7-1200 chapter 12.3.2, it says that CM 1241 RS232 supports flow control.
And from chapter 12.3.2.1 onwards there are information about "managing flow control".

Thanks I’ll have a look at that, but I don’t think for control is the issue.
 

Similar Topics

Hi all, Currently having trouble getting a speed reference to write over modbus to an Omron M1... I can successfully write a run command and...
Replies
6
Views
258
commentaire communiqué siemens s7-1200 avec vfd delta ? (cablage et sur tia portal )
Replies
0
Views
139
Hi, I have a 1214 on ip 192.168.0.100. This is connected to other modules through a switch on same network. I need to connect this to a company...
Replies
1
Views
185
Hi Experts, I would like to make firmware upgrade from v3.0 to v4.5 (S7-1200 CPU 1215C). Can I do it from v3.0 to v4.5? Do I need to take some...
Replies
6
Views
298
Hi Guys, I am trying to establish communication over profinet between Siemens S7-1200 PLC as IO device and codesys plc as IO controller. But I am...
Replies
43
Views
2,891
Back
Top Bottom