COACH Master PIC
The COACH Master PIC exchanges messages over XBee with the PLAYER E128, decides where the PLAYER should Tag Out, and exchanges messages over SSP with the COACH Slave PIC. SSP communication is interrupt driven and a continuous loop of 7 messages exchanged between the two PICs. XBee<->Master PIC communication takes place over EUART and is partially interrupt driven. The COACH responds to receive interrupts but initiates a message transmission chain on a 5 Hz timeout interrupt (transmit interrupts are disabled; the code polls for the flag only if a 5 Hz timeout just occurred). The COACH also responds to interrupts-on-change for the buttons associated with RESET and PAIR.
Code
|
PseudoCode
|
COACH Slave PIC
The COACH Slave PIC exchanges messages over SSP with the COACH Master PIC and reads all the sensors and switch inputs (except Tag Out location) to send to the COACH Master PIC. The COACH Master PIC only sends one byte of useful information to the COACH Slave PIC: (1) whether Active Communication with the PLAYER is present, and (2) what the PLAYER's energy level is. The COACH Slave PIC uses these pieces of information to appropriately light or extinguish its respective displays.
Code
|
PseudoCode
|