13.07.2015 Views

[Instruction] Contents

[Instruction] Contents

[Instruction] Contents

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.

Advanced Function <strong>Instruction</strong>FUN110 D PQUEUEQUEUEFUN110 D PQUEUE• If no data has yet been pushed into the queue or the pushed in data has already been popped out (Pr = 0),then the queue empty flag will be set to 1. In this case, even if there is further popping out action, thisinstruction will not be executed. If data is only pushed in and not popped out, or pushed in is more than thatpopped out, then the queue finally becomes full (pointer Pr indicates the QU L position), and the queue full flagis changed to 1. In this case, if there is more pushing in action, this instruction will not execute. The pointer forthis instruction is used during access of the queue, to indicate the data that was pushed in the earliest. Otherprograms should not be allowed to change it, or else an operation error will be created. If there is a specificapplication, which requires the setting of a Pr value, then its permissible range is 0 to L (0 means empty, and 1to L respectively correspond to QU1 to QUL). Beyond this range, the pointer error flag "ERR" will be set as 1,and this instruction will not be carried out.X0X1110P.QUEUEEN IW :QU :RR02I/O L : 10Pr :OW :R 1R 20EPTFULERR• The program at left assumes the queue content is thesame with the queue at preceding page. It will firstperform queue push operation , and then perform popout action. The results are shown below. Under anycircumstance, Pr always point to the first (oldest) datathat was remained in queue.PrPr5 4QUQUQU1 5555 R2 QU1 5555 R2QU2 4444 R3 QU2 4444 R3QU3 3333 R4 QU3 3333 R4QU4 2222 R5 OW QU4 2222 R5 OWQU5 1111 R6 ×××× R20 QU5 R6 1111 R20QU6 R7 ↑ QU6 R7QU7 R8 OW unchanged QU7 R8QU8 R9 QU8 R9QU9 R10 QU9 R10QU10 R11 QU10 R11After push in (X1=1,X0 from 0→1) After pop off (X1=0,X0 from 0→1)7-95

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

Saved successfully!

Ooh no, something went wrong!