Defines | Functions | Variables
encoder.c File Reference
#include <stdlib.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "encoder.h"
#include "utils.h"
Include dependency graph for encoder.c:

Go to the source code of this file.

Defines

#define PHASE_A   BITREAD(PIND,PD7)
 Standard includes.
#define PHASE_B   BITREAD(PINE,PE6)

Functions

void encoder_init ()
int16_t encoder_read ()
void encoder_reset ()
 ISR (TIMER3_COMPA_vect)

Variables

volatile int16_t enc_accum
volatile int8_t enc_delta
static int16_t last

Detailed Description

Code for encoder setup and position acquisition. Contains gray code converter code from Peter Dannegger from Mikrocontroller.net, for glitchless encoder position evaluation

Version:
1.0
Author:
Julio Sagardoy

Definition in file encoder.c.


Define Documentation

#define PHASE_A   BITREAD(PIND,PD7)

Standard includes.

AVR includes Own includes

Definition at line 29 of file encoder.c.

#define PHASE_B   BITREAD(PINE,PE6)

Definition at line 30 of file encoder.c.


Function Documentation

void encoder_init ( void  )

Encoder init routine.

Definition at line 77 of file encoder.c.

int16_t encoder_read ( )

Returns actual value in the counter.

Definition at line 47 of file encoder.c.

void encoder_reset ( )

Resets encoder counter to 0. Mandatory to run this after calibration, so it counts from 0.

Definition at line 38 of file encoder.c.

ISR ( TIMER3_COMPA_vect  )

Definition at line 52 of file encoder.c.


Variable Documentation

volatile int16_t enc_accum

Definition at line 33 of file encoder.c.

volatile int8_t enc_delta

Definition at line 32 of file encoder.c.

int16_t last [static]

Definition at line 34 of file encoder.c.



cob_3d_mapping_demonstrator
Author(s): Georg Arbeiter
autogenerated on Wed Aug 26 2015 11:03:46