Siemens S7-200 high-speed counter, encoder application! -Solutions - Huaqiang Electronic Network

Photocoupler

Q: The cable car is equipped with an encoder. I want to calculate the length of the cable and calculate the running speed of the cable through the S7-200's high-speed counter and encoder. At present, the encoders A and B are connected to I0.0, and the HSC0 counter is used. The cable will rise and fall at any time. The length of the cable is calculated by pulse counting. How to configure the HSC command and how to calculate the current cable operation What about speed?

A: Defining a high-speed counter is nothing more than the following steps:
1. Create an initialization program, controlled by SM0.1;
2, in the initialization program, initialize the high-speed counter
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 zero
2.4 set the preset value (HSC0 is SMD42), the counter counts this value can generate an interrupt, generally use this interrupt to call the corresponding interrupt program to reset the current value (SMD38), otherwise the counter will not count up, 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 specifies 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. Read the value of the high-speed counter in the program. For HSC0, the content in the HC0 unit is the current count value. This unit can only read and write, you can change the current count value by modifying the content of SMD38.

3 Mm /8 Mm Nano Tip

3 Mm /8 Mm Nano Tip,Electronic Board Marker Pen,Touch Board Marker Pens,Infared Smart Board Marker

Shenzhen Ruidian Technology CO., Ltd , https://www.szwisonen.com

This entry was posted in on