Digital Clock Using the PIC microcontroller


A final project for: ECE 551, Computer Systems Manufacturing Lab

Dept. of ECE, UMASS Amherst

Project Description

  • Using Microchip's PIC 16C71 microcontroller, we programmed a digital clock with an alarm clock and several features. The chip was tested and demonstated on the 16Cxx demonstration board. The program prompts the user for the current time and the time at which the alarm should go off, if desired. It then displays, to within a tenth of a second each minute, the current time. Communication to a terminal is through PORT A on the demonstration board.

    If an alarm has been set, beeps sound and lights flash each second for fifteen seconds at the appropriate time. The lights are port B on the board. At any time, the user has the option to interrupt timing with a number of commands. By pressing certain keys, the user may shut off the alarm, hold time still, scroll seconds, minutes, or hours, or reset the clock to where it asks for the alarm time. While the alarm is sounding, the user may shut it off, and has the additional option of "snoozing" for a minute. By this we mean that the alarm stops and resumes one minute from when it started. All of these times are easily adjustable by making minute changes in the code. The number of beeps can be set, and the snooze function could delay the alarm as long as one wants. We minimized our use of registers and code density, so that countless features could be added.

    Design Process

  • For a program of this complexity, we divided our workload carefully into tasks. We set up the PICSTART board with com connections for programming and terminal interface. In Windows, we kept Procomm and MPASM, MPSIM, and PICSTART on-screen at all times. Programming was done in Notepad, and at times, from DOS in Microsoft's basic editor, since it gives line numbers.

    We worked on display, the alarm, and the timing for one second in parallel. When we had them working together harmoniously, we added an assortment of additional functionalities. In this way, we were able to accomplish all of our goals simultaneously without bumping heads. Programming does not always lend itself to working in groups, so those concerned must find some way to separate the design into equal sections.

    Since we had already done a simple design on the PIC, we were familiar with the instruction set and error messages, as well as how to set up our workstation for greatest efficiency. Crucial to the design process was learning every instruction available in the data book, with all of its quirks. In particular, we made use of xorwf, xorlw, btfss, and btfsc, especially for checking bits of the status register. For diplaying to the terminal, we found that escape sequences were very useful.

    We faced certain confusing quirks in the instruction set along the way. Although you may reference any of 128 file registers, only registers 0A through 2F are GPR's, and guaranteed not to interfere with correct execution of your program. Also, XORWF seems as though it should leave the result in the working register, but instead places it in the file register.

    Absolute indexing, through a GOTO command, spans the entire 1KBytes of address space, as do calls to procedures. Microchip has certainly done a good job with functionality, and so they can get away with a few confusing instructions and conventions. Although the limited instruction set seems ponderous, there are ways to emulate any assembler commands one may be used to. The capabilities of such a processor are limited only by memory space and imagination.

    Manufacturability

  • The programmability of the PIC improves its time-to-market and eliminates the possiblity of respin. Although this product would not be in high demand in and of itself, its capabilities can be easily exploited for similar applications. The algorithms for keeping accurate time without a real-time processor as well as for incrementing through seconds, minutes, and hours could be applied to any timing application.

    Acknowledgements

    special thanks to:
  • Justin's Mom: Judith Konieczny
  • Bob's Mom: Barbara Kebler
  • Chris's Mom: Janet Szczuka
  • Technicians: Keith Shimeld and Ed O'Donnell
  • best gal: Kerrie Okraska
  • The makers of Mountain Dew for giving us the caffeine we needed to finish the design.
    For all the current updates in sports see: ESPN's SportsZone

    We are temporarily employed with the following companies:

  • Bob: MITRE Corporation
  • Chris: Viewlogic Systems, Inc.

    "Give a man a fish, and he will eat for a day. Teach that man to fish, and he will eat for a lifetime."


    szczuka@ecs.umass.edu or cszczuka@viewlogic.com

    searles@ecs.umass.edu

    kebler@ecs.umass.edu

  • burleson@ecs.umass.edu (Last Update: 12/18/95)