
Variable P1 is de®ned in include ®le `AT892051.h' and this is a reserved name
for port 1 of the microcontroller. The built-in C function rand() generates a
random integer number between 1 and 32 767 and this function is used to
generate a random number and store it in variable LED. The generated
number is complemented and output to port 1 of the microcontroller and
the process is repeated inde®nitely with about 1 second delay between each
output pattern.
PROJECT 4 ± Cyclic LED Pattern
Function
This project turns on the LEDs connected to port 1 in a cyclic manner such
that ®rst only 1 LED is on, then 2 LEDs are on, then 3, 4, 5, ... , 8 are on
(Fig. 3.7). ...