Siemens Simatic S7-200 System Manual page 230

Programmable controller
Hide thumbs Also See for Simatic S7-200:
Table of Contents

Advertisement

Instruction Set
PTO Initialization
To initialize the PTO, follow these steps:
1.
Use the first scan memory bit to reset the output to 0, and call the subroutine that you
need to perform the initialization operations. When you call a subroutine, subsequent
scans do not make the call to the subroutine. This reduces scan time execution and
provides a more structured program.
2.
In the initialization subroutine, load SM67 with a value of 16#85 for PTO using
microsecond increments (or 16#8D for PTO using millisecond increments). These
values set the control byte to enable the PTO/PWM function, select PTO operation,
select either microsecond or millisecond increments, and set the update pulse count and
cycle time values.
3.
Load SM68 (word size value) with the desired cycle time.
4.
Load SM72 (double word size value) with the desired pulse count.
5.
This is an optional step. If you want to perform a related function as soon as the pulse
train output is complete, you can program an interrupt by attaching the pulse train
complete event (Interrupt Category 19) to an interrupt subroutine, and execute the global
interrupt enable instruction. Refer to Section 10.14 Interrupt Instructions for complete
details on interrupt processing.
6.
Execute the PLS instruction to cause the S7-200 to program the PTO/PWM generator.
7.
Exit the subroutine.
Changing the PTO Cycle Time
To change the PTO Cycle Time in an interrupt routine or subroutine, follow these steps:
1.
Load SM67 with a value of 16#81 for PTO using microsecond increments (or 16#89 for
PTO using millisecond increments). These values set the control byte to enable the
PTO/PWM function, select PTO operation, select either microsecond or millisecond
increments, and set the update cycle time value.
2.
Load SM68 (word size value) with the desired cycle time.
3.
Execute the PLS instruction to cause the S7-200 to program the PTO/PWM generator.
4.
Exit the interrupt routine or the subroutine. (Subroutines cannot be called from interrupt
routines.)
Changing the PTO Count
To change the PTO Count in an interrupt routine or a subroutine, follow these steps:
1.
Load SM67 with a value of 16#84 for PTO using microsecond increments (or 16#8C for
PTO using millisecond increments). These values set the control byte to enable the
PTO/PWM function, select PTO operation, select either microsecond or millisecond
increments, and set the update pulse count value.
2.
Load SM72 (double word size value) with the desired pulse count.
3.
Execute the PLS instruction to cause the S7-200 to program the PTO/PWM generator.
4.
Exit the interrupt routine or the subroutine. (Subroutines cannot be called from interrupt
routines.)
10-42
S7-200 Programmable Controller System Manual
C79000-G7076-C230-02

Advertisement

Table of Contents
loading

Table of Contents