motorcontroller.c File Reference

#include <avr/io.h>
#include "motorcontroller.h"
#include "timer.h"

Functions

void setPortD (void)
 Set portD as output.
void setMotorSpeed (double uTotal)
 Sets the speed and direction of the motor.
double setError (double presentValue)
 Calculate the error.
double pController (void)
 Proportional controller.
double dController (void)
 Derrivative controller.

Variables

double oldError = 0
double error = 0
double timeGap = 0
const int KP = 250
const int KD = 20

Function Documentation

double dController ( void   ) 

Derrivative controller.

Returns:
The derrivative value

double pController ( void   ) 

Proportional controller.

Returns:
The proportional value

double setError ( double  presentValue  ) 

Calculate the error.

Parameters:
presentValue Frequency to determine the error from
Returns:
The current error

void setMotorSpeed ( double  uTotal  ) 

Sets the speed and direction of the motor.

Parameters:
uTotal Value calculated by the PD-controller

void setPortD ( void   ) 

Set portD as output.


Variable Documentation

double error = 0

const int KD = 20

const int KP = 250

double oldError = 0

double timeGap = 0


Generated on Sat Jun 9 13:19:03 2007 for Automatisk Guitartuner by  doxygen 1.5.2