07.03.2014 Views

Introduction.

Introduction.

Introduction.

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Workshop PG5 Exercise Chapter 7<br />

In the case of a counter, the LoaD instruction depends on the state of the<br />

ACCU. As we want this load to be an unconditional one, we have to be sure<br />

the ACCU is H. So set the ACCU to H first.<br />

XOB 16<br />

; Code executed at start up<br />

ACC H<br />

; Load the counter with<br />

LD NumberOfFreeSlots ; the value 8 ( unconditionally )<br />

8<br />

EXOB<br />

; end of start-up program<br />

5. We then simply decrement the counter 100 each time a car enters the lot and<br />

increment the counter as soon as one leaves the lot.<br />

Each time we have a rising edge on the input 0 ( Sensor at the parking lot entrance<br />

) we want to decrement the counter “NumberOfFreeSlots”:<br />

STH NewCar_Signal<br />

DYN DynamiseNewCar<br />

DEC NumberOfFreeSlots<br />

The DYN instruction memorises the state of the Input 0 in a flag (Dynamise-<br />

NewCar)from one program cycle to the next. The ACCU is then set as soon as<br />

the DYN instruction sees that the Input 0 has gone from 0 to 1.<br />

The DECrement instruction is only executed, if the ACCU is set. Do the same<br />

thing for the parking lot<br />

Exit.<br />

STH Car_leaving_Signal<br />

DYN DynamiseCar_leaving<br />

INC NumberOfFreeSlots<br />

© Saia-Burgess Controls Ltd. Page 7E-10

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

Saved successfully!

Ooh no, something went wrong!