Monitoring and analysis method of S7-200 free port communication

Monitoring and analysis method of S7-200 free port communication
Eni is an on interrupt instruction.

The common way to write program is to define, define communication control byte, communication frequency, communication data, etc., and finally open interrupt.

If Eni is written in front, it is not a sign of Siemens programming environment in theory. Siemens's idea is to define first and then use it, which is in line with European thinking logic.

The general meaning of the procedure is as follows:

First define communication (free port communication parameters)

Define the communication data, and send the command by the rising edge of m0.0, that is to send the data defined above

When the sending completion enters the sending completion interrupt, execute the receive and redefine the receive completion interrupt (in fact, this can be edited in the initialization section). Your problem is that after redefining the receive completion interrupt, you still need to define the Eni instruction once.

When the reception is completed, you enter the receive completion interrupt, and you redefine the timing interrupt again_ 0 = 20, (MS) again, Eni is not defined here.

When the timer interrupt is activated, the first defined data will be sent at 20 ms intervals.

I feel that your overall program architecture is not rigorous. When initializing, you should define the sending completion interrupt, receiving completion interrupt, and open interrupt first. The reason why you don't need to define timing interrupt is that free port communication is half duplex communication, and only one instruction on a communication link is valid, while defining timed interrupt (it doesn't matter which instruction you actually run normally, or Instruction does not run, to the point will send an instruction), this will cause the probability of error will be large.

Normally, the communication data should be defined first, and then the transmission is executed. In the sending interrupt, the receiving instruction is edited, and in the receiving interrupt, the required sending instruction is edited again.

The above is just my opinion.