26.10.2012 Views

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

Statement List (STL) - DCE FEL ČVUT v Praze

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

B.6 Example: Word Logic Instructions<br />

Heating an Oven<br />

Programming Examples<br />

The operator of the oven starts the oven heating by pushing the start push button.<br />

The operator can set the length of time for heating by using the thumbwheel switches<br />

shown in the figure. The value that the operator sets indicates seconds in binary<br />

coded decimal (BCD) format.<br />

Oven<br />

Heat<br />

Q 4.0<br />

<strong>Statement</strong> <strong>List</strong><br />

7....<br />

X X X X 0 0 0 1<br />

Thumbwheels for setting BCD digits<br />

Start push button I 0.7<br />

4 4 4<br />

...0 7...<br />

...0<br />

1 0 0 1 0 0 0 1<br />

Bits<br />

IW0<br />

IB0 IB1<br />

Bytes<br />

System Component Absolute Address<br />

Start Push Button I 0.7<br />

Thumbwheel for ones I 1.0 to I 1.3<br />

Thumbwheel for tens I 1.4 to I 1.7<br />

Thumbwheel for hundreds I 0.0 to I 0.3<br />

Heating starts Q 4.0<br />

<strong>STL</strong> Explanation<br />

A T1 //If the timer is running,<br />

= Q 4.0 //then turn on the heat.<br />

BEC //If the timer is running, then end processing here. This prevents timer<br />

T1 from being restarted if the push button is pressed.<br />

L IW0<br />

AW W#16#0FFF //Mask input bits I 0.4 through I 0.7 (that is, reset them to 0). The<br />

time value in seconds is in the low word of accumulator 1 in binary coded<br />

decimal format.<br />

OW W#16#2000 Assign the time base as seconds in bits 12 and 13 of the low word of<br />

accumulator 1.<br />

A I 0.7<br />

SE T1 //Start timer T1 as an extended pulse timer if the push button is<br />

pressed.<br />

<strong>Statement</strong> <strong>List</strong> (<strong>STL</strong>) for S7-300 and S7-400 Programming<br />

A5E00706960-01 B-13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!