Chapter 14

Projects

Project 1: Countdown Timer

The circuit for the countdown timer is shown in Figure 14.1.

image

Figure 14.1 The countdown timer.

The countdown time mm:ss is entered via the keypad and the display shows the time remaining up to 99 min 59 s.

The program for the countdown timer is shown below in Countdown.C

1. //Countdown.C by DW Smith 20-6-12

2. #include <p18f1220.h>

3. #pragma config WDT=OFF, OSC=INTIO2, PWRT=ON, LVP=OFF, MCLRE=OFF

4. #include <delays.h>

5. #include <dwsLCD.h>

6. #include <dwsScan.h>

7. // put variables here

8. char secUnit, secTen, minUnit, minTen, result;

9. void main (void)

10. {

11. //SET UP

12. // OSCCON defaults ...

Get PIC Projects and Applications using C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.