13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

Advanced Function <strong>Instruction</strong>FUN111 D PSTACKSTACKFUN111 D PSTACK• When no data has yet been pushed into the stack or the pushed in data has already been popped out (Pr = 0),the stack empty flag "EPT" will set to 1. In this case any further pop up actions, will be ignored. If more data ispushed than popped out, sooner or latter the stack will be full (pointer Pr points to ST L position), and the stackfull flag "FUL" will set to 1. In this case any further push actions, will be ignored. As with queue, the stackpointer in normal case should not be changed by other instructions. If there is a special application whichrequires to set the Pr value, then its effective range is 0 to L (0 means empty, 1 to L respectively correspond toST 1 to ST L). Beyond this range, the pointer error flag "ERR" will set to 1, and the instruction will not be carriedout.X0X1111P.STACKEN IW :ST :RR02I/O L : 10Pr :OW :R 1R 20EPTFULERR• The program at left assumes that the initial content of thestack is just as in the diagram of a stack on thepreceding page. The operation illustrated in this exampleis to push a data and than pop it from stack. The resultsare shown below. Under any circumstances, Pr alwayspoint to the data that was most recently pushed into thestack.PrPr5 R1 4STQUST1 1111 R2 ST1 1111 R2ST2 2222 R3 ST2 2222 R3ST3 3333 R4 ST3 3333 R4ST4 4444 R5 OW ST4 4444 R5 OWST5 5555 R6 ×××× R20 ST5 R6 5555 R20ST6 R7 ↑ ST6 R7ST7 R8 OW unchanged ST7 R8ST8 R9 ST8 R9ST9 R10 ST9 R10ST10 R11 ST10 R11After push(X1=1,X0 from 0→1) After pop up(X1=0,X0 from 0→1)7-97

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

Saved successfully!

Ooh no, something went wrong!