80 likes | 209 Views
Team 5 Software Design. Madalina Vintila David Wilkinson Michelle Zhang Zac Greenawalt. Flowchart. Pseudo Code for the Pen. Initialization; While true { If pb flag set { Clear pb flag 2 channel conversion; Store sample in memory location Set data ready flag }
E N D
Team 5 Software Design Madalina Vintila David Wilkinson Michelle Zhang Zac Greenawalt
Pseudo Code for the Pen Initialization; While true { If pb flag set { Clear pb flag 2 channel conversion; Store sample in memory location Set data ready flag } else { if prev_press flag set { transmit end of character } } If data ready flag set { clear data ready flag Take sample from memory & add to buffer for transmitter Take battery count add to transmitter buffer Transmit (when buffer full) } If CC > max value { add CC value to transmitter stack transmit } }
Subroutines Timer interrupt service subroutine (120Hz) { If PB pressed { Set flag to do conversion set previous press flag } Else { clear previous press flag } } CC interrupt { Increment cc value++ } Transmit subroutine { Clear CC Transmit buffer data }
Pseudo Code for the Base Initialization; While true { If receiver flag { clear receiver flag read from SPI; parse data check for end of character info – set flag if present else { store ATD into buffer } increment battery status variable with CC received } If end of character flag set { clear flag attempt character match with buffer data if match, display on LCD else display error mark (?) clear data stack } }
Subroutines CC interrupt { if discharging { Increment cc value++ } else { Decrement cc value -- } } Timer interrupt { update base & pen battery status on LCD } Transceiver interrupt { set receiver flag }