Communications Overview
Communication Protocol State Diagrams:
PIC-to-PIC communication was implemented according to the communication standards issued by the protocol committee. The following state diagrams outline the events that occur during an engagement
Radio Operation:
The hull and helm radios were used to communicate information between the two to successfully operate. This information included navigation and display commands to the hull from the helm, iButton information to and from both the hull and the helm, and admiral commands (stand down) directed to the helm and then relayed to the hull. The information was generated into packets by the two xBee PICs (hull and helm), and then transferred to the radios via EUSART. The radios handled address-checking as well as checksum validating, but it was up to the xBee PICs to send the messages to the correct address and calculate an accurate checksum value. Additionally, the xBee PICs were required to handle admiral command messages issued throughout the game.
xBee PICs:
The hull and helm xBee PICs communicated both to their respective radios via EUSART and helper PICs via SSP. The hull xBee PIC communicated to two different helper PICs; one to generate the left motor PWM and one to generate the right motor PWM. Additionally, commands to turn on and off the pump as well as indication LEDs were transmitted to the helper PICs. A three-byte packet was used to organize all of the information that needed to be sent out to the helper PICs. In this case, no information was ever needed by the xBee PIC from the helper PICs, so SSP communication was one-way.
A three-byte packet was sent out to the helper PICs which contained all the information necessary for the hull to navigate and display properly. A header was used to validate each packet, and bytes two and three contained PWM values, pump commands, and LED commands. Bits 1 and 2 of the special byte were alloted for the “special functions” required by any other hull in the competition.
 
 
The helm xBee PIC only had one helper PIC, but two-way communication was required in order to both acquire sensor data as well as respond to display data. Sensor information was collected, handled and packaged by the helm helper PIC and sent via SSP to the helm xBee PIC. This sensor information included accelerometer (direction) commands, magnetic switch (speed) commands, and mechanical switch (pump and special option) commands. The sensor inputs were collected and sent out in the exact form specified by the communication protocol (Navigation and Special byte). The helm helper PIC also received information from the helm xBee PIC to use on the display panel of the helm. The boat number was sent to the helper PIC and then handled by 7-segment LED display code to designate which boat the helm was currently controlling. Additionally, when the helm xBee PIC received admiral commands regarding which base was active, the xBee PIC would send this to the helper PIC, which would then light the appropriate colored LED on the helm display.