S7-200 communication ports can be set to free port mode of the CPU. Freedom of choice of mode, the operation of the user program can completely control a communications port, communications protocols are completely controlled by the user program.
S7-200 communication port on the CPU in the electrical RS-485 is standard on half-duplex serial communications port. The serial character of communication formats can include
A start bit
7–or 8-bit characters (data bytes)
An odd/even parity bit, or there is no parity bit
One stop bit
Free port baud rate communication speed can be set to 1200, 2400, 4800, 9600, 19200, 38400, 57600 or 112500.
All serial communication devices conform to these formats, can in theory and S7-200 CPU communication.
Free mode you can use. Two directives Micro/WIN (USS and Modbus RTU) is to use a free port mode programmatic implementation.
Also need to be aware of are:
Free port communication in the program when debugging, you can use the PC/PPI cable (set to the free port communication mode) connect PC and CPU, serial debug software running on the PC (or Windows HyperTerminal Hyper Terminal-) debugging free program.
USB/PPI cable and the CP card free port debugging is not supported.
Free communications first communications outlet is defined as the free port mode, and set the corresponding communication baud rate and the communication format. User program through a special memory SMB30 (port 0), SMB130 (port 1) controlling communication mode.
CPU communication interface works in free mode, the communication on other communication protocols are not supported (such as PPI), this communication can no longer communicate with the programming software Micro/WIN. When the CPU is stopped, free port does not work, Micro/WIN will be able to communicate with the CPU.
Communication mode, are procedures defined by the user at run time.
If debugging needs to switch between free port and PPI mode, you can use the SM0.7 mode of the State communications and SM0.7 reflects the CPU running the switch position (at RUN time SM0.7= “1“ SM0.7= in the STOP “0“)
Core instructions are sent free port communication (XMT) and receive (RCV) instruction. In the free port of interrupted “receive instruction end interrupt“, “send orders to end interrupt“, as well as the communication port receives an interrupt.
Reading and writing instruction with the network (NetR/NetW) is similar to user programs cannot directly control the communications chips and have to go through the operating system. User programs use communications data buffers and special storage and exchange of information related to operating system.
XMT and RCV instructions similar to the data buffer, start byte for number of characters need to be sent or received, followed by a data byte itself. If a message was received which was included in the starting or ending character, they are data bytes.
XMT and RCV instruction is called simply the specified communication port and the starting byte address of the data buffer.
Also, note that:
XMT and RCV instructions NetW/NetR instructions are different, they communicate with the network “address“, and the only communication ports for local actions. If you have more than one device on your network, and must contain the address information in the message; the message containing the address information is XMT and RCV instruction processing objects.
Due to S7-200 communication port half duplex RS-485, XMT directive cannot and RCV instruction effectively.
XMT (send) instructions of use is relatively simple. RCV (receive) commands needed to control a little more.
RCV directives the basic process is as follows:
When the logical condition is met, start (a) RCV instructions into receiving a wait state
Monitoring communications port, waiting for messages set the starting condition is satisfied, then enter the message received
If you set the message of the end conditions are met, then an end message, then exit the receiving State
Therefore, RCV does not necessarily have to receive messages after the instruction starts, if not let it start message receiving conditions, has been in a State of waiting to receive if messages without beginning or end, communication has been in the receiving State. If you try to execute XMT instructions, it does not send any messages.
So make sure to both XMT and RCV very important, you can use the send and receive complete interruption of their complete feature, start another command in the interrupt routine.
In the S7-200 system manual on XMT and RCV instruction using an example. This classic, we strongly recommend learning through this example at the free port.
S7-200 CPU character interrupt function provides communications, communications receiving character will generate an interrupt, SMB2 received characters staged special memory. Communications port Port0, Port1 SMB2, but different character of two interruptions.
Each received a character, it will generate an interrupt. For sending messages in a row, you need to arrange individual character in the interrupt service routine to a user–defined message in the save area. To implement this functionality may use indirection better.
For high speed, characters interrupt requires interrupt program execution speed is fast enough.
Under normal circumstances, using the character as the end RCV instructions the end conditions are relatively reliable. If the communication object variable with one of the characters in the message frame (in bytes) end (check code), should provide news or Modbus ASCII as a condition to end RCV instructions. But often a communication object may not have strict agreements, work may not be reliable, and this may cause RCV does not end normally. This case can receive interrupt with character features.
How artificial end RCV receive status?
Command and control bytes received (SMB87/SMB187) en can be used to enable/disable receiving States. En can be set to “0“, and then perform the RCV on this port directive, end RCV instructions. (Remember, the control bytes after the assignment, RCV instruction must be executed, otherwise the receiving State does not end)
Need to communicate regularly send a message and wait for a response message, if the message is not received, the next message could not be sent to do?
Can start when a message is sent with the artificial suspension RCV instruction program.
Freedom communications, send data to the master to the slave, why received more from the station‘s chaotic response?
It shows from the station under the main station required to send messages. Has multiple communication networks from the station, from the station must be able to determine your home station message is not to own, that would require a necessary judgment function of the communication program.
Free port communication protocol is what?
By definition, no free port of the standard agreement. Users can set themselves an agreement.
New PC/PPI cable can support the free port?
New RS-232/PPI cable (6ES7 901-3CB30-0XA0) can support the free port but need to set the DIP switch 5 to “0“, and set the appropriate speed.
New USB/PPI cable (6ES7 901-3DB30-0XA0) do not support free port.
Has been used to free port communications port, can connect the operator panel (HMI)?
Known–a communications object character (byte) transport format has two stop bits, S7-200 does it support?
Character format is the most basic hardware (chips) decide; S7-200 chip does not support this format.
S7-200 supports the communication baud rate stated on the manual for the S7-200 system other than the special rate?
Communication speed is determined by the basic hardware (chips) decide; S7-200 chip does not support communication rate did not include this in the manual.