BalloonMonitor_PIC
(On PIC receiving messages from BalloonMonitor)
Initialize Pins & Timer0, Interrupts, Receive Enable
MainLoop
if Timer0 flag set, goto Timer0_set
else goto MainLoop
End
Timer0_set
Clear Timer 0 flag
If RC0 is high, Pull it down, i.e goto Pull_Line_Down
else goto Pull_Line_Up
End
Pull_Line_Down
pull Timer output line low
Reset counter to 0
Form startbyte
Goto MainLoop
End
Pull_Line_Up
pull Timer output line high
End
Interrupt Routine
Read receive register and store in RECEIVED_MSG
Increment Counter
if counter reached 8 goto Chk_Msg
else keep Xoring, ie goto Xoring
End
Chk_Msg
if Xored values equal 0 goto CheckSum_Matched
End
Xoring
Keep xoring bytes received
End
CheckSum_Matched
if Checksum value received corresponded with the one that should be received when balloon is popped
goto BalloonPopped
End
BalloonPopped
Pull Balloon monitor popped indication line high
Disable interrupts
End
MainLoop
if Timer0 flag set, goto Timer0_set
else goto MainLoop
End
Timer0_set
Clear Timer 0 flag
If RC0 is high, Pull it down, i.e goto Pull_Line_Down
else goto Pull_Line_Up
End
Pull_Line_Down
pull Timer output line low
Reset counter to 0
Form startbyte
Goto MainLoop
End
Pull_Line_Up
pull Timer output line high
End
Interrupt Routine
Read receive register and store in RECEIVED_MSG
Increment Counter
if counter reached 8 goto Chk_Msg
else keep Xoring, ie goto Xoring
End
Chk_Msg
if Xored values equal 0 goto CheckSum_Matched
End
Xoring
Keep xoring bytes received
End
CheckSum_Matched
if Checksum value received corresponded with the one that should be received when balloon is popped
goto BalloonPopped
End
BalloonPopped
Pull Balloon monitor popped indication line high
Disable interrupts
End