Книга: Advanced PIC Microcontroller Projects in C
Project PDL
Project PDL
The PDL of the project is shown in Figure 6.35. The program is in two sections: the main program and the interrupt service routine. Inside the main program, TMR0 is configured to generate interrupts every 5ms and the counter is incremented with a one-second delay. Inside the interrupt service routine, the timer interrupt is reenabled and the display digits are refreshed alternately every 5ms.
MAIN PROGRAM:
START
Configure PORTB as outputs
Configure PORTC as outputs
Clear variable Cnt to 0
Configure TMR0 to generate interrupts every 5ms
DO FOREVER
Increment Cnt between 0 and 99
Delay 1 second
ENDDO
END
INTERRUPT SERVICE ROUTINE:
START
Re-configure TMR0
IF Digit 1 updated THEN
Update digit 2
ELSE
Update digit 1
END
END
Figure 6.35: PDL of the project