Block diagram for the receiver. It consists of a Atmel board controlling an LCD, speaker and the RF receiver.


 
Method Summary
calButtonScan()
          Polls PortD for pushbuttons.
init()
          Loads initial state.
main()
          Calls button scanning every 30 ms, and handles updates.
t0_ovfl()
          Controls timing of button scanning state machine
t1_compa()
          Controls sound timing.
uart_rx()
          Runs receive state machine.
Method Detail

init

void init()
Loads initial state. Sets receiver to 9 bit mode, 1200 baud Setup ports, LCD Set timer0 to overflow every ms for button polling Set timer1 to overflow and clear every ms for sound

calButtonScan

void calButtonScan()
Polls PortD for pushbuttons. PD.8 is set calibrations dist PD.7 is clear calibration dist PD.5 is toggle sound on/off (default is off)

uart_rx

void uart_rx()
Runs receive state machine. Must receive high byte first with 1 in 9th bit, followed by low byte with 0 in 9th bit Sets flag for processing in main

t0_ovfl

void t0_ovfl()
Controls timing of button scanning state machine

t1_compa

void t1_compa()
Controls sound timing. Toggles PortA to create 500 Hz square wave, and creates pulse of length PULSE_DURATION (50 ms) only is sound is enabled. Implements pulse repetition rate set in main

main

void main()
Calls button scanning every 30 ms, and handles updates. On update flag, combines high and low bytes to int, then displays then to LCD, after subtracting calibration distance. Reloads pulse repetition rate with currDist multiplied by 8