bumper.h File Reference

#include "datatypes.h"
#include "t89c51cc02.h"

Go to the source code of this file.

Defines

#define Bumper_activate()   P1_4=1
#define Bumper_deactivate()   P1_4=0
#define BUMPERSENSORS_NR   8

Functions

void Bumper_init (void)
 initialize bumper control subsystem
void Bumper_select (BYTE)
 select one of the outer bumper sensors for measurement
WORD Bumper_read (BYTE)
 reads one of the perimeter bumper sensors


Detailed Description

Definition in file bumper.h.


Define Documentation

 
#define Bumper_activate  )     P1_4=1
 

activates reading of Bumper sensors

Definition at line 6 of file bumper.h.

Referenced by Bumper_read().

 
#define Bumper_deactivate  )     P1_4=0
 

deactivates reading of Bumper sensors

Definition at line 8 of file bumper.h.

Referenced by Bumper_init(), and Bumper_read().

#define BUMPERSENSORS_NR   8
 

number of available bumper sensors

Definition at line 11 of file bumper.h.

Referenced by main().


Function Documentation

WORD Bumper_read BYTE  bumpernr  ) 
 

reads one of the perimeter bumper sensors

A given bumper sensor is selected and then being read with the A/D converter.

Parameters:
bumpernr the bumper to be read (0-7)
Returns:
the relative voltage reading of the specified bumper (+5V means no contact)

Definition at line 57 of file bumper.c.

References ADC(), Bumper_activate, Bumper_deactivate, and Bumper_select().

Referenced by main().

void Bumper_select BYTE  sensorid  ) 
 

select one of the outer bumper sensors for measurement

A 74HCT237 decoder IC is used to select one of the bumpers. This function applies the sensor address to its A bus.
The A Bus is connected to P2.0 P2.1 and P1.5 for A0 - A2.

Parameters:
sensorid - number of the bumper to be read

Definition at line 33 of file bumper.c.

Referenced by Bumper_read().


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