mc_interface.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define mci_get_motor_direction()   mci_direction

Functions

void mc_motor_init (void)
 use to init programm
void mci_backward (void)
void mci_forward (void)
U16 mci_get_measured_current (void)
 Get the current measured in the motor.
U8 mci_get_measured_speed (void)
 Measured of speed.
U8 mci_get_motor_speed (void)
U8 mci_get_potentiometer_value (void)
 Get the potentiometer value.
Bool mci_motor_is_running (void)
 get the motor state
void mci_run (void)
 mci_run starts the motor with predefined parameter
void mci_set_motor_direction (U8 direction)
void mci_set_motor_speed (U8 speed)
void mci_set_speed (U16)
void mci_stop (void)
void mci_store_measured_current (U16 current)
 Set the variable 'mc_measured_current' for initialization.
void mci_store_measured_speed (U8 measured_speed)
 set Measured of speed (for initialization)
void mci_store_potentiometer_value (U8 potentiometer)
 Set the 'mc_potentiometer_value' variable with the potentiometer value.

Variables

Bool mci_direction
 User Input parameter to set motor direction.
Bool mci_run_stop
 User Input parameter to launch or stop the motor.


Define Documentation

U8 mci_get_motor_direction ( void   )     mci_direction

Definition at line 27 of file mc_interface.h.

Referenced by main(), and mc_switch_commutation().


Function Documentation

void mc_motor_init ( void   ) 

use to init programm

Parameters:
@post configuration of hardware and sotware
Precondition:
none

Definition at line 48 of file mc_interface.c.

References mc_init_HW(), mc_init_SW(), mci_stop(), and mci_store_measured_speed().

Referenced by main(), and mci_run().

00049 {
00050   mc_init_HW();
00051   mc_init_SW();
00052 
00053   mci_stop();
00054   mci_store_measured_speed(0);
00055 }

Here is the call graph for this function:

Here is the caller graph for this function:

void mci_backward ( void   ) 

Definition at line 103 of file mc_interface.c.

00104 {
00105   mci_direction = CCW;
00106 }

void mci_forward ( void   ) 

Definition at line 93 of file mc_interface.c.

00094 {
00095   mci_direction = CW;
00096 }

U16 mci_get_measured_current ( void   ) 

Get the current measured in the motor.

Precondition:
Launch ADC scheduler
Postcondition:
Get ADC Channel 12 result (Current value on 8bits).

Definition at line 144 of file mc_interface.c.

References mci_measured_current.

Referenced by mc_control_current(), and ushell_task().

00145 {
00146 /*  U16 value_to_return;
00147   value_to_return = mci_measured_current>>6;
00148   if (value_to_return > 994)
00149   {
00150     value_to_return = value_to_return - 994;
00151   }
00152   else
00153   {
00154     value_to_return = 994 - value_to_return;
00155   }
00156   return value_to_return;*/
00157   return mci_measured_current;
00158 }

Here is the caller graph for this function:

U8 mci_get_measured_speed ( void   ) 

Measured of speed.

Returns:
return value of speed (8 bits)
Precondition:
none
Postcondition:
none

Definition at line 134 of file mc_interface.c.

References mci_measured_speed.

Referenced by main(), mc_control_speed(), and ushell_task().

00135 {
00136   return mci_measured_speed;
00137 }

Here is the caller graph for this function:

U8 mci_get_motor_speed ( void   ) 

Definition at line 72 of file mc_interface.c.

References mci_cmd_speed.

Referenced by mc_regulation_loop(), and mc_switch_commutation().

00073 {
00074   return mci_cmd_speed;
00075 }

Here is the caller graph for this function:

U8 mci_get_potentiometer_value ( void   ) 

Get the potentiometer value.

Precondition:
Launch ADC scheduler
Postcondition:
Get ADC Channel 6 result (Potentiometer value on 8bits).

Definition at line 175 of file mc_interface.c.

References mci_potentiometer_value.

Referenced by mc_regulation_loop().

00176 {
00177   return mci_potentiometer_value;
00178 }

Here is the caller graph for this function:

Bool mci_motor_is_running ( void   ) 

get the motor state

Parameters:
@pre initialization HW and SW
Postcondition:
We know if the motor is running or not

Definition at line 36 of file mc_interface.c.

References mci_run_stop.

Referenced by mc_switch_commutation().

00037 {
00038   return mci_run_stop;
00039 }

Here is the caller graph for this function:

void mci_run ( void   ) 

mci_run starts the motor with predefined parameter

Parameters:
@pre initialization HW and SW
Postcondition:
New value in Hall variable

Definition at line 196 of file mc_interface.c.

00197 {
00198    mc_motor_init();  // launch initialization of the motor
00199    mci_run_stop = RUN;
00200    mci_set_motor_speed(DUTY_RAMP_UP); /* set a speed for the ramp-up */
00201    mc_set_Open_Loop();      /* set the regulation type */
00202    mc_regulation_loop();    /* execute the regulation one time */
00203    mc_ramp_up_init();
00204    PSC_Run();
00205 }

void mci_set_motor_direction ( U8  direction  ) 

Definition at line 82 of file mc_interface.c.

References mci_direction.

Referenced by mc_control_position().

00083 {
00084 //  if ((mci_direction == CW) || (mci_direction == CCW)) mci_direction = direction;
00085    mci_direction = direction;
00086 }

Here is the caller graph for this function:

void mci_set_motor_speed ( U8  speed  ) 

Definition at line 62 of file mc_interface.c.

References mci_cmd_speed.

Referenced by main(), mci_run(), and mci_set_speed().

00063 {
00064   mci_cmd_speed = speed;
00065 }

Here is the caller graph for this function:

void mci_set_speed ( U16   ) 

Definition at line 214 of file mc_interface.c.

00215 {
00216    mci_set_motor_speed((U8)speed);
00217 }

void mci_stop ( void   ) 

Definition at line 207 of file mc_interface.c.

00208 {
00209    PSC_Stop();
00210    mci_run_stop  = STOP;
00211 }

void mci_store_measured_current ( U16  current  ) 

Set the variable 'mc_measured_current' for initialization.

Precondition:
none
Postcondition:
'mc_measured_current' set with the current value

Definition at line 165 of file mc_interface.c.

References mci_measured_current.

Referenced by ADC_EOC().

00166 {
00167   mci_measured_current = ((63*mci_measured_current)+(64*current))>>6;
00168 }

Here is the caller graph for this function:

void mci_store_measured_speed ( U8  measured_speed  ) 

set Measured of speed (for initialization)

Precondition:
none
Postcondition:
mc_measured_speed initialized

Definition at line 123 of file mc_interface.c.

References mci_measured_speed.

Referenced by mc_estimation_speed(), mc_motor_init(), and ovfl_timer().

00124 {
00125   mci_measured_speed = measured_speed;
00126 }

Here is the caller graph for this function:

void mci_store_potentiometer_value ( U8  potentiometer  ) 

Set the 'mc_potentiometer_value' variable with the potentiometer value.

Precondition:
Launch ADC scheduler
Postcondition:
'mc_potentiometer_value' set with the potentiometer value

Definition at line 185 of file mc_interface.c.

References mci_potentiometer_value.

Referenced by ADC_EOC().

00186 {
00187   mci_potentiometer_value = potentiometer;
00188 }

Here is the caller graph for this function:


Variable Documentation

Bool mci_direction

User Input parameter to set motor direction.

Definition at line 21 of file mc_interface.c.

Referenced by mci_backward(), mci_forward(), mci_set_motor_direction(), and ushell_task().

Bool mci_run_stop

User Input parameter to launch or stop the motor.

Definition at line 22 of file mc_interface.c.

Referenced by main(), mci_motor_is_running(), mci_run(), mci_stop(), and ushell_task().


Generated on Wed Jul 12 16:55:23 2006 for Atmel BLDC Sensorless on ATAVRMC100 by  doxygen 1.4.7