Download presentation
Presentation is loading. Please wait.
Published byRuth Thornton Modified over 9 years ago
1
Light Sensor by Jonathan Pham & Cherub Harder ECE 4437 Dr. Glover
2
QTR-3RC Reflectance Sensor Array Packs three LED/phototransistor pairs Each sensor provides a separate digital I/O-measurable voltage output Sensors spaced at intervals of 0.375 ″ (9.525 mm)
3
Light Sensor Schematic
4
Interfacing the Outputs to Digital I/O Lines Set the I/O line to an output and drive it high. Wait several microseconds to give the 2.2 nF capacitor node time to reach 5 V. Make the I/O line an input (high impedance). Measure the time for the capacitor node voltage to decay by waiting for the I/O line to go low.
5
Reflectance Time Strong Reflectance(Light) - decay time can be as low as several microseconds No Reflectance(Black) – decay time can be as high as a few milliseconds
6
NVIC( Nested Vector Interrupt Controller) Provides global interrupt masking( 154 interrupt sources), prioritization( 8 levels), and handler dispatching Supplies address of function to handle interrupt directly instead of putting interrupt handler in query spmu298a_TivaWare_Peripheral_Driver_ Lib.pdf spmu298a_TivaWare_Peripheral_Driver_ Lib.pdf
7
HWREG( hardware register) A macro that expands to the absolute address of hardware register( 32-bit address!!!) read and write Allow to read and write into the hardware register
8
Enable Counter
9
Enable Counter(cont.) NVIC_DBG_INT defined in hw_nvic.h TRCENA( Trace Enable) Must be set to 1 to use the trace/ debug blocks DWT( Data Watchpoint and Trace) Allows us to use DWT( Data Watchpoint and Trace)
10
Enable Counter(cont.) DWT register contains counters for clock cycles and other miscellaneous things DWT_Base + DWT _O_CYCCNT (E0000004)– Register that contains the counter DWT_Base (E0000000)– Register that enables counter
11
R EFLECTANCE S ENSOR W E W ILL U SE QTR-1RC Reflectance Sensor QTR-1RC QTR-3RC http://www.pololu.com/picture/view/0J625
12
Coding Set the I/O line to an output and drive it high Allow at least 10us for the 10-nF capacitor to charge Make the I/O line an input (high impedance) Measure the time for the capacitor to discharge by waiting for the I/O line to go low
13
Coding Set the I/O line to an output and drive it high Step 1:
14
Coding Allow at least 10us for the 10-nF capacitor to charge Step 2:
15
Coding Make the I/O line an input (high impedance) Step 3:
16
Coding Measure the time for the capacitor to discharge by waiting for the I/O line to go low Step 4:
17
Coding
18
Extras
19
Extras
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.