#include "datatypes.h"
#include "t89c51cc02.h"
Go to the source code of this file.
Defines | |
#define | SHARP_PWRCTL P3_2 |
#define | SHARP_PWRCTL_MASK 0x04 |
#define | SHARP_ONLY 0x03 |
#define | SHARP_TIMER_RELOAD_H 0x7d |
#define | SHARP_TIMER_RELOAD_L 0xcb |
#define | Sharp_PowerOn() P3=(P3 & SHARP_ONLY)|SHARP_PWRCTL_MASK; Sharp_TimerInit(); |
#define | Sharp_PowerOff() SHARP_PWRCTL=0; TR1=0; ET1=0; |
Functions | |
void | Sharp_init (void) |
initializes GP2D120 subsystem | |
void | Sharp_TimerInit (void) |
initializes an ISR to signal that the Sharp GP2D120 is ready to be read. | |
WORD | Sharp_read (void) |
read Sharp GP2D120 sensor if it is active | |
void | Sharp_Timer_interrupt (void) interrupt 3 using 2 |
Timer ISR for delaying the Sharp GP2D120. |
Definition in file sharp.h.
|
bit mask to clear all enable bits for optic sensors |
|
deactivates the Sharp GP2D120 and its Timer Definition at line 21 of file sharp.h. Referenced by main(), and Sharp_init(). |
|
deactivates all optic sensors except for the Sharp GP2D120 and starts the Sharp Timer ISR (see Sharp_Timer_interrupt ) Definition at line 19 of file sharp.h. Referenced by main(). |
|
Port pin that activates the powersupply for the Sharp GP2D120 Definition at line 6 of file sharp.h. Referenced by Photosensor_read(), and Sharp_read(). |
|
bit mask for accessing the Shapr powercontrol flag |
|
reload values to get approx. 25ms timing @ 16MHz: 0x10000 - 0x8235 = 0x7dcb - HIByte Definition at line 14 of file sharp.h. Referenced by Sharp_Timer_interrupt(), and Sharp_TimerInit(). |
|
reload values to get approx. 25ms timing @ 16MHz: 0x10000 - 0x8235 = 0x7dcb - LOByte Definition at line 16 of file sharp.h. Referenced by Sharp_Timer_interrupt(), and Sharp_TimerInit(). |
|
read Sharp GP2D120 sensor if it is active
Definition at line 86 of file sharp.c. References ADC(), SHARP_PWRCTL, and sharp_ready. Referenced by main(). |
|
Timer ISR for delaying the Sharp GP2D120.
This Timer ISR delays the Sharp GP2D120 and signals its readiness after 50ms via the sharp_ready semaphore. The interrupt is triggered every 25ms. Therefor the routine uses a flag (wait_bit) to signal its second run. The sensor readiness is signalled in the second run of the ISR. The ISR deactivates itself after its second execution. Definition at line 64 of file sharp.c. References sharp_ready, SHARP_TIMER_RELOAD_H, SHARP_TIMER_RELOAD_L, and wait_bit. |
|
initializes an ISR to signal that the Sharp GP2D120 is ready to be read. Initializes an ISR to signal that the Sharp GP2D120 is ready to output a valid distance reading. Activates Timer 1 which counts for 25ms twice and sets a readiness signal upon 2nd ISR invocation. (
Definition at line 39 of file sharp.c. References sharp_ready, SHARP_TIMER_RELOAD_H, SHARP_TIMER_RELOAD_L, and wait_bit. |