FeedbackSensor.c File Reference

#include "FeedbackSensor.h"
#include <avr/interrupt.h>
#include <avr/signal.h>

Include dependency graph for FeedbackSensor.c:

Go to the source code of this file.

Functions

 SIGNAL (SIG_INTERRUPT0)

Variables

volatile int feedback_value0
volatile int feedback_value1


Function Documentation

SIGNAL ( SIG_INTERRUPT0   ) 

Interrupt-Service-Routine (ISR) for incremental encoder on INT0

Definition at line 108 of file FeedbackSensor.c.

References feedback_value0.

00108                        {
00109 
00110      cli();
00111 
00112      register unsigned char pd = PIND;
00113 
00114      if (( (pd & (1<<PIND6))>=1  &&  (pd & (1<<PIND2))==0 ) ||
00115          ( (pd & (1<<PIND6))==0  &&  (pd & (1<<PIND2))>=1 ) 
00116      ) {
00117           if (feedback_value0 < 127) {
00118                feedback_value0++;
00119           }
00120 
00121      } else {  
00122           if (feedback_value0 > -127) {
00123                feedback_value0--;
00124           }    
00125      }
00126 
00127      sei();
00128 }


Variable Documentation

volatile int feedback_value0

globals for ISR

Definition at line 7 of file FeedbackSensor.c.

Referenced by FeedbackSensor::enableSensor(), FeedbackSensor::getFeedback(), FeedbackSensor::init(), and SIGNAL().

volatile int feedback_value1


Generated on Wed Mar 25 12:58:40 2009 for Crawling Robot Microcontroller Software by  doxygen 1.5.5