HAL PIC Example Project

This page provides an example of a PIC project.  The project is the firmware for the SpookyEyes Halloween device.  This device is described in HAL.INS.ASPIC

Be sure to read the legal notice before using any software found on this web site. 

This project follows the structure and conventions described on the main PIC development resources page.  All the source code is available for download and may be used for free in commercial applications with minor restrictions.  See the copyright notice at the start of each source module for details. 

The firmware runs on a PIC 16F876, which is probably hooked up pretty much as indicated by the schematic.  There were some changes made and various experimental versions, so this schematic may not correspond exactly to the picture. 

Below are the source files for this project:


Include file to declare PIC environment. 


Project-specific include file. 


Startup code, run from reset.  Include module-level initialization. 


System-level initialization. 


Main operating code after initialization complete. 


Low level I/O port handling. 


Interrupt handler. 


A/D handler. 


Contains the logic for driving the LEDs to simulate the eyes. 


Random number generator. 


High level sound output management.  The low level sound output is performed in the interrupt routine. 


Great horned owl sound.  This is the PIC assembler source code for one of the sounds.  This file was generated by the WAV_HAL program from a WAV file.  The HAL firmware contains other sounds which are not shown here. 

To get all the project files and build scripts, go to the PIC software downloads page and download the HAS PIC project. 

Last Updated 12 February 2004