next up previous contents index

[ENGN3213 Home]

Polling

  Polling is a technique whereby a routine monitors the status of, say, a peripheral until it is ready. When reading a character from a keyboard, a program might contain a loop that checks a register indicating that a character is ready to be read. The loop is repeated and is exited only when the character is ready. This technique was used in subroutine getac in program chario1s.s (HLAB6). Polling was also used in subroutine pdelay in program file timer2c.c (HLAB6). Here, the polling loop was written in C as:

       while  ((TER1 & 0x0002) ==  0x0000) {};
The loop repeats until bit 2 of the timer event register TER1 is set.


next up previous contents index

[ENGN3213 Home]

ANU Engineering - ENGN3213