A Performance Analysis System for the Sport of Bowling

A Performance Analysis System for the Sport of Bowling A Performance Analysis System for the Sport of Bowling

cs.hbg.psu.edu
from cs.hbg.psu.edu More from this publisher
01.06.2015 Views

Appendix A: SMARTDOT Module Embedded Software Flowcharts COMMUNICATION TASK FLOWCHART SWITCH TO COMM A B C Initialize Communications Wait for Wand = TRUE Wand Present = FALSE Dark = FALSE Level Count = 0 Shutdown Count = 0 Set Timer 0 (T0) for Wand Detection Delay 40 msecs for Wand to switch to 38400 baud Retry Count = 3 Receive Time Out = 200 msecs Did Command Terminate Normally? NO YES Transmit 'XON" @ 38400 baud (acknowledge successful completion) IDLE MODE Transmit "HI" @ 38400 baud to Wand ("Clear to Send") Update Run Time Count Wand Interrupt (T0) (darkness for 125 msecs) Receive Command Byte from Wand @ 600 baud Shutdown Count++ Transmit "HI" to Wand @ 38400 Echo Command Byte to Wand @ 38400 baud IDLE MODE Wand Interrupt (T0) (receive NULL @ 600 baud) Wait for Wand = FALSE Wand Present = TRUE Process Command 'A' - Set AUTO Mode 'S' - Set SINGLE Mode 'T' - Transmit Data 'X' - Set TEST Mode 0x0X - Set CFG Bytes X and X+1 Done All Retries? NO YES B C A To: SHUTDOWN SAVE RUN TIME Figure A-5 A-6

Appendix A: SMARTDOT Module Embedded Software Flowcharts On: Timer 0 (T0) Overflow A WAND DETECTION ISR FLOWCHART B Disable Interrupts Push ACC Push PSW Waiting for Dark? NO Is Sample = LITE Level? NO Did LITE Pulse Just End? YES Was it the Correct Length? YES Dark = FALSE Sample = ADAT (from previous conversion) YES YES NO NO Update Run Time Turn ON TSL251 (start next ADC conversion) Is Sample < Dark Level? NO Reset Level Count Level Count++ (counting LITE samples) Turn OFF TSL251 (waits for ADC to finish) A YES Level Count++ (counting DARK samples) Pop PSW Pop ACC Enable Interrupts Reached Minimum Dark Time? NO Shutdown Count++ Was Shutdown Detected? NO YES YES Dark = TRUE (Wand is in place) Waited Too Long? YES Push SAVE RUN TIME on to Stack NO Shutdown = TRUE Figure A-6 B RETURN FROM INTERRUPT A-7

Appendix A: SMARTDOT Module Embedded S<strong>of</strong>tware Flowcharts<br />

COMMUNICATION TASK FLOWCHART<br />

SWITCH<br />

TO COMM<br />

A<br />

B<br />

C<br />

Initialize Communications<br />

Wait <strong>for</strong> Wand = TRUE<br />

Wand Present = FALSE<br />

Dark = FALSE<br />

Level Count = 0<br />

Shutdown Count = 0<br />

Set Timer 0 (T0) <strong>for</strong> Wand Detection<br />

Delay 40 msecs <strong>for</strong> Wand<br />

to switch to 38400 baud<br />

Retry Count = 3<br />

Receive Time Out = 200 msecs<br />

Did<br />

Command<br />

Terminate<br />

Normally?<br />

NO<br />

YES<br />

Transmit 'XON" @ 38400 baud<br />

(acknowledge successful completion)<br />

IDLE MODE<br />

Transmit "HI" @ 38400 baud<br />

to Wand ("Clear to Send")<br />

Update Run Time Count<br />

Wand Interrupt (T0)<br />

(darkness <strong>for</strong> 125 msecs)<br />

Receive Command Byte<br />

from Wand @ 600 baud<br />

Shutdown Count++<br />

Transmit "HI" to Wand<br />

@ 38400<br />

Echo Command Byte<br />

to Wand @ 38400 baud<br />

IDLE MODE<br />

Wand Interrupt (T0)<br />

(receive NULL @ 600 baud)<br />

Wait <strong>for</strong> Wand = FALSE<br />

Wand Present = TRUE<br />

Process Command<br />

'A' - Set AUTO Mode<br />

'S' - Set SINGLE Mode<br />

'T' - Transmit Data<br />

'X' - Set TEST Mode<br />

0x0X - Set CFG Bytes X and X+1<br />

Done<br />

All<br />

Retries?<br />

NO<br />

YES<br />

B<br />

C<br />

A<br />

To: SHUTDOWN<br />

SAVE RUN TIME<br />

Figure A-5<br />

A-6

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!