; ***************************************************************
; * Copyright (c) 2001, Embed Inc (http://www.embedinc.com) *
; * *
; * Permission to copy this file is granted as long as this *
; * copyright notice is included in its entirety at the *
; * beginning of the file, whether the file is copied in whole *
; * or in part and regardless of whether other information is *
; * added to the copy. *
; * *
; * The contents of this file may be used in any way, *
; * commercial or otherwise. This file is provided "as is", *
; * and Embed Inc makes no claims of suitability for a *
; * particular purpose nor assumes any liability resulting from *
; * its use. *
; ***************************************************************
;
; Include file for the HAL PIC application. This application is
; for the SpookyEyes Halloween device. The device has 8 LEDs, a
; light sensor, and a speaker. It is meant to be somewhat hidden
; in the dark near where people might walk by on Halloween. The
; intent is to lead the casual observer to believe the device is
; some sort of scary beast. The illusion is enhanced by the
; "animal" reacting to the observer.
;
; The LEDs are arranged in two groups of 4, with each group
; simulating one glowing eye. Only one LED from each group is
; lit at a time. Different LEDs are lit randomly to simulate
; the eyes looking around. The same LED from each group is always
; chosen to maintain a constant distance between the eyes. The
; eyes also shut off occasionally for a short time to simulate
; blinking.
;
; The speaker is used to randomly emit pre-programmed sounds. These
; are usually grunts, growls, etc. A total of about 7 seconds of
; sound can be pre-programmed, which can be broken into an arbitrary
; number of separate sounds.
;
; The LEDs and the speaker are immediately shut off whenever the
; light level rises above a threshold or rises faster than a certain
; rate. This is intended to make the animal dissappear when someone
; shines a flashlight in its direction. The LEDs are mounted facing
; out from the board edge, and the speaker is connected by wires
; about 1/2 meter long. This allows the board to be positioned
; edge-on to the observer, and the speaker to be hidden from sight.
; If the board is well placed, in a bush for example, it becomes
; nearly impossible to see in the dark with only a flashlight
; from a few meters away. Once the light is removed, the animal
; resumes its regular grunting and blinking after a few seconds.
;
include "hallib.inc"
;
; Application configuration parameters
;
gbank equ 0 ;direct register bank for global variables
;
; Derived constants.
;
gbankadr equ bankadr(gbank) ;address within reg bank for global variables
;
;**********
;
; Global flag bits. As many GFL0 thru GFLn variables as needed are
; automatically created by the /FLAG preprocessor directive. After all
; flags are defined, NFLAGB will be left indicating the number of GFLx
; variables created. For each flag, the string substitution macro
; flag_<name> is defined to be "gfl<n>,<bit>". The flag_<name> symbol
; can be used directly with bit instructions.
;
/flag audon ;audio output on, currently playing a sound
/flag 100ms ;set every 100mS by the interrupt routine
/flag blink ;eyes are blinking, LEDs currently off
/flag adconv ;time to start a new A/D conversion
/flag newoff ;just detected new reason to go into OFF mode
/flag off ;in OFF mode, no sound, no lights
;
;**********
;
; I/O pin declaration. Three constants are declared for each I/O pin.
; xxx_REG is the register containing the bit for the pin, xxx_TRIS is the
; corresponding tri-state enable register, and xxx_BIT is the number of
; the bit within the registers.
;
/inbit light porta 0 ;analog input for light level
/outbit ledl1 portb 0 1 ;LED left 1 lit when 0
/outbit ledl2 portb 1 1 ;LED left 2 lit when 0
/outbit ledl3 portb 2 1 ;LED left 3 lit when 0
/outbit ledl4 portb 3 1 ;LED left 4 lit when 0
/outbit ledr1 portb 4 1 ;LED right 1 lit when 0
/outbit ledr2 portb 5 1 ;LED right 2 lit when 0
/outbit ledr3 portb 6 1 ;LED right 3 lit when 0
/outbit ledr4 portb 7 1 ;LED right 4 lit when 0
/outbit pwm portc 2 0 ;PWM for audio output