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 RECEIVE BYTE (from Wand) A UART RECEIVE TASK FLOWCHART B C Wait for Start Bit Wait for Parity Bit Reset Receive Time Out Bit Sample Interrupt T0) Bit Sample Interrupt (T0) Turn ON TSL251 (starts ADC conversion) New Bit = FALSE NO Is PARITY Bit corrrect? Halt Bit Sample Timer (T0) Wait for Dark Wand Interrupt (T0) Valid START Bit? NO YES New Bit = FALSE Turn OFF TSL251 (ADC has already finished) Set Bit Sample Timer (T0) for 4800 Hz YES Wait for Stop Bit Wait for 1 to 0 Transition Wait for Data Bit Bit Sample Interrupt (T0) Wand Interrupt (T0) Bit Sample Interrupt (T0) New Bit = FALSE Initialize Bit Sampling New Bit = FALSE Bit Dark Counter = 0 DARK Level = ZERO Level Start Bit Sample Timer (T0) Bit Count = 0 Bit Sample Count = 0 New Bit = FALSE Shift Bit into RCV Byte NO Valid STOP Bit? NO Done All 8 Data Bits? Push NO RESPONSE on to Stack YES New Bit = FALSE YES A B Figure A-7 C RETURN A-8

Appendix A: SMARTDOT Module Embedded Software Flowcharts BIT SAMPLE ISR FLOWCHART RECEIVE TIME OUT ISR FLOWCHART On: Timer 0 (T0) Overflow A B On: Timer TI Overflow Disable Interrupts Is this a Middle Bit Sample? NO Take All 8 Bit Samples? NO Disable Interrupts Sample = ADAT (from previous conversion) YES YES NO Reached Time Out? Start ADC conversion (TSL251 is already ON) A Is Sample < Dark Level? YES NO DARK Samples = 2? YES NO YES Halt Time Out Timer (TI) Level Count++ (counting DARK samples) Bit = 1 Bit = 0 Push NO RESPONSE onto Stack DARK Level = ZERO Level (hysteresis between LITE and DARK) DARK Level = ONE Level (hysteresis between LITE and DARK) Bit Sample Count++ Enable Interrupts Enable Interrupts B RETURN FROM INTERRUPT RETURN FROM INTERRUPT Figure A-8 Figure A-9 A-9

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

RECEIVE<br />

BYTE<br />

(from Wand)<br />

A<br />

UART RECEIVE TASK<br />

FLOWCHART<br />

B<br />

C<br />

Wait <strong>for</strong> Start Bit<br />

Wait <strong>for</strong> Parity Bit<br />

Reset Receive Time Out<br />

Bit Sample Interrupt T0)<br />

Bit Sample Interrupt (T0)<br />

Turn ON TSL251<br />

(starts ADC conversion)<br />

New Bit = FALSE<br />

NO<br />

Is<br />

PARITY<br />

Bit<br />

corrrect?<br />

Halt Bit Sample Timer (T0)<br />

Wait <strong>for</strong> Dark<br />

Wand Interrupt (T0)<br />

Valid<br />

START<br />

Bit?<br />

NO<br />

YES<br />

New Bit = FALSE<br />

Turn OFF TSL251<br />

(ADC has already finished)<br />

Set Bit Sample Timer (T0)<br />

<strong>for</strong> 4800 Hz<br />

YES<br />

Wait <strong>for</strong> Stop Bit<br />

Wait <strong>for</strong> 1 to 0 Transition<br />

Wait <strong>for</strong> Data Bit<br />

Bit Sample Interrupt (T0)<br />

Wand Interrupt (T0)<br />

Bit Sample Interrupt (T0)<br />

New Bit = FALSE<br />

Initialize Bit Sampling<br />

New Bit = FALSE<br />

Bit Dark Counter = 0<br />

DARK Level = ZERO Level<br />

Start Bit Sample Timer (T0)<br />

Bit Count = 0<br />

Bit Sample Count = 0<br />

New Bit = FALSE<br />

Shift Bit into RCV Byte<br />

NO<br />

Valid<br />

STOP<br />

Bit?<br />

NO<br />

Done<br />

All 8<br />

Data Bits?<br />

Push NO RESPONSE<br />

on to Stack<br />

YES<br />

New Bit = FALSE<br />

YES<br />

A<br />

B<br />

Figure A-7<br />

C<br />

RETURN<br />

A-8

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

Saved successfully!

Ooh no, something went wrong!