Siemens RCV / XMT instruction Answers
S7-200 CPU communication port can be set to Freeport mode.When you select Freeport mode, the user program can completely control
the operation of the communication port, the communication protocol is
completely controlled by the user program.
Communications port on the S7-200 CPU are electrically standard RS-485 half-duplex serial communication port.
The format of this serial character communication may include:
A start bit
Seven or eight characters (data bytes)
An odd / even parity bit, or no parity bit
One stop bit
Speed communication baud rate can be set to 1200,2400,4800,9600,19200,38400,57600 or 112500.
. Micro / WIN instruction library two (USS and Modbus RTU) is programmed using the free port mode implemented.
Also note that:
Communication during debugging, you can use the PC / PPI cable (provided to the free port communication mode) to connect the PC and CPU, running on a PC serial debugging software (for Windows or Hyper Terminal- HyperTerminal) debugging Freeport program.
USB / PPI cable and free port CP card does not support debugging.
We must first define the communication port free port mode, and set the corresponding communication baud rate and the communication formats. User program through a special memory SMB30 (port 0), SMB130 (for Port 1) communication port control mode.
CPU communication port operating in the free port mode, communication port does not support other communication protocols (eg PPI), this communication port can no longer communicate with the programming software Micro / WIN. When the CPU is stopped, the free port is not working, Micro / WIN can communicate with the CPU.
Communication port mode, can be repeated during operation defined by the user program.
If debug mode is required between Freeport and PPI mode switch, you can use the status of SM0.7 decision communication port mode; and reflects the status of SM0.7 CPU running state of the switch position (RUN when SM0.7 = "1", when in STOP SM0.7 = "0")
Core instruction free port communication is to send (XMT) and receive (RCV) instructions. In the free port communication interrupt commonly have "received instruction ends the interrupt," "Send instruction end interrupt", and a communication port buffer to receive the interrupt.
Similar to the network read and write commands (NetR / NetW), the user can not directly control communication chips must pass through the operating system. The user program and special communication data buffer memory and the operating system to exchange relevant information.
XMT and RCV instruction data buffer similar to the starting byte for the number of characters to be sent or received, followed by the data byte itself. If the received message includes the start or end of the character, they are also considered data bytes.
Only you need to specify the initial communication port and data byte buffer address when calling XMT and RCV instructions.
Also, note the following:
XMT and RCV instructions and NetW / NetR instruction is different is that they are on the network communication object "address" has nothing to do, but only for local communication ports. If there are multiple devices on a network, the message must contain the address information; processed These messages contain the address information is the XMT and RCV instructions.
Since S7-200 communication port is half-duplex RS-485 chip, XMT and RCV instruction instruction can not be effective.
Use XMT (transmit) instruction is relatively simple. Control RCV (receive) instruction needed a little more.
The basic working process RCV instruction is:
When logic conditions are met, to start (again) RCV instruction to enter the reception waiting state
Monitoring the communications port, message waiting setting a start condition is satisfied, then enter the message receiving state
If you meet the conditions set by the end of the message, the end of the message, and then exit the reception state
So, after the RCV instruction does not necessarily start to receive messages, if conditions do not let it start message received, has been in a state of waiting to receive; if the message has no beginning or end, the communication port has been in the receiving state. Then if you try to execute XMT instruction, it does not send any message.
So make sure not simultaneously execute XMT and RCV is very important, you can use to send and receive complete interrupt completion interrupt function, start another instruction in an interrupt routine.
Communications port on the S7-200 CPU are electrically standard RS-485 half-duplex serial communication port.
The format of this serial character communication may include:
A start bit
Seven or eight characters (data bytes)
An odd / even parity bit, or no parity bit
One stop bit
Speed communication baud rate can be set to 1200,2400,4800,9600,19200,38400,57600 or 112500.
. Micro / WIN instruction library two (USS and Modbus RTU) is programmed using the free port mode implemented.
Also note that:
Communication during debugging, you can use the PC / PPI cable (provided to the free port communication mode) to connect the PC and CPU, running on a PC serial debugging software (for Windows or Hyper Terminal- HyperTerminal) debugging Freeport program.
USB / PPI cable and free port CP card does not support debugging.
We must first define the communication port free port mode, and set the corresponding communication baud rate and the communication formats. User program through a special memory SMB30 (port 0), SMB130 (for Port 1) communication port control mode.
CPU communication port operating in the free port mode, communication port does not support other communication protocols (eg PPI), this communication port can no longer communicate with the programming software Micro / WIN. When the CPU is stopped, the free port is not working, Micro / WIN can communicate with the CPU.
Communication port mode, can be repeated during operation defined by the user program.
If debug mode is required between Freeport and PPI mode switch, you can use the status of SM0.7 decision communication port mode; and reflects the status of SM0.7 CPU running state of the switch position (RUN when SM0.7 = "1", when in STOP SM0.7 = "0")
Core instruction free port communication is to send (XMT) and receive (RCV) instructions. In the free port communication interrupt commonly have "received instruction ends the interrupt," "Send instruction end interrupt", and a communication port buffer to receive the interrupt.
Similar to the network read and write commands (NetR / NetW), the user can not directly control communication chips must pass through the operating system. The user program and special communication data buffer memory and the operating system to exchange relevant information.
XMT and RCV instruction data buffer similar to the starting byte for the number of characters to be sent or received, followed by the data byte itself. If the received message includes the start or end of the character, they are also considered data bytes.
Only you need to specify the initial communication port and data byte buffer address when calling XMT and RCV instructions.
Also, note the following:
XMT and RCV instructions and NetW / NetR instruction is different is that they are on the network communication object "address" has nothing to do, but only for local communication ports. If there are multiple devices on a network, the message must contain the address information; processed These messages contain the address information is the XMT and RCV instructions.
Since S7-200 communication port is half-duplex RS-485 chip, XMT and RCV instruction instruction can not be effective.
Use XMT (transmit) instruction is relatively simple. Control RCV (receive) instruction needed a little more.
The basic working process RCV instruction is:
When logic conditions are met, to start (again) RCV instruction to enter the reception waiting state
Monitoring the communications port, message waiting setting a start condition is satisfied, then enter the message receiving state
If you meet the conditions set by the end of the message, the end of the message, and then exit the reception state
So, after the RCV instruction does not necessarily start to receive messages, if conditions do not let it start message received, has been in a state of waiting to receive; if the message has no beginning or end, the communication port has been in the receiving state. Then if you try to execute XMT instruction, it does not send any message.
So make sure not simultaneously execute XMT and RCV is very important, you can use to send and receive complete interrupt completion interrupt function, start another instruction in an interrupt routine.
评论
发表评论