photosensor.c File Reference

#include "t89c51cc02.h"
#include "datatypes.h"
#include "photosensor.h"
#include "adc.h"
#include "sharp.h"
#include <stdlib.h>

Go to the source code of this file.

Functions

void Photosensor_init ()
 initialize photosensor subsystem
void Photosensor_toggle (void)
 toggles LED of selected photosensor
WORD Photosensor_read (BYTE sensornr)
 read the value of a single photosensor

Variables

BYTE psensor
const char psensor_select [] = {0,0x08,0x10,0x20,0x40,0x80,0,0}


Detailed Description

Definition in file photosensor.c.


Function Documentation

void Photosensor_init void   ) 
 

initialize photosensor subsystem

The photosensors are turned off by default.

Definition at line 31 of file photosensor.c.

References Photosensor_PowerOff, and psensor.

Referenced by main().

WORD Photosensor_read BYTE  sensornr  ) 
 

read the value of a single photosensor

The given sensor is activated first and than sampled with a simple differential scheme.

Parameters:
sensornr number of photo sensor to read
Returns:
voltage value of given sensor

Definition at line 79 of file photosensor.c.

References ADC(), Photosensor_PowerOff, Photosensor_select, and SHARP_PWRCTL.

Referenced by main().

void Photosensor_toggle void   ) 
 

toggles LED of selected photosensor

The photosensor is selected with the Photosensor_select function.
Invalid sensor numbers will turn off all photosensors.

Definition at line 44 of file photosensor.c.

References Photosensor_PowerOff, Photosensor_select, and psensor.


Variable Documentation

BYTE psensor
 

stores number of active photosensor

Definition at line 21 of file photosensor.c.

Referenced by Photosensor_init(), and Photosensor_toggle().

const char psensor_select[] = {0,0x08,0x10,0x20,0x40,0x80,0,0}
 

bit masks to activate 1 of 5 photo sensors

Definition at line 24 of file photosensor.c.


Generated on Wed Oct 24 12:57:24 2007 for SensorControl by  doxygen 1.4.6