How is the Siemens PLCs7-200 connected to the encoder for measuring position?

Defining a high-speed counter is nothing more than the following steps:

1. Create an initialization program, controlled by SM0.1;

2. Initialize the high-speed counter in the initialization program

2.1 Set the control register (HSC0 is SMB37), different counters correspond to different DI points, HSC0 is I0.0, HSC3 is I0.1, HSC4 is I0.2, HSC5 is I0.3 (222 does not support HSC1 and HSC2)

2.2 Execute the HDEF command, you can use mode 0

2.3 Set the initial value of the counter (HSC0 is SMD38), if it is started from zero, set it to zero.

2.4 Set the preset value (HSC0 is SMD42). When the counter counts this value, an interrupt can be generated. Generally, the interrupt is used to call the corresponding interrupt program to reset the current value (SMD38). Otherwise, the counter will not count until the end. Of course you You can also set a large value and clear the current value (SMD38) in other programs to ensure that you can never get to the head.

2.5 Specify the interrupt program (ATCH), the interrupt event is 12, the program number looks at your program.

2.6 Open Interrupt (ENI). If this command is not available, 2.5 is not working.

2.7 Start the high-speed counter (HSC), press the previous initialization, you must start HSC0, that is, N is 0.

3. The value of the high-speed counter is read in the program. For HSC0, the content in the HC0 unit is the current count value. This unit can be read-only and cannot be written. You can change the current count value by modifying the contents of SMD38.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.