mc_interface.c File Reference

Go to the source code of this file.

Functions

void Do_Sensor_Interrupt (void)
void mci_backward (void)
void mci_forward (void)
U8 mci_get_direction (void)
U16 mci_get_measured_current (void)
U8 mci_get_measured_speed (void)
Bool mci_motor_is_running (void)
void mci_run (void)
void mci_set_direction (U8 direction)
void mci_set_speed (U16 speed)
void mci_stop (void)
void mci_store_measured_current (U16 current)
void mci_store_measured_speed (U8 measured_speed)
void PSC_Start (void)
void svpwm_init (void)

Variables

Bool mci_direction = CW
 User Input parameter to set motor direction.
U32 mci_measured_current = 0
 Motor Input parameter to get the motor current.
U8 mci_measured_speed = 0
 Motor Input parameter to get the motor speed.
U8 mci_potentiometer_value = 0
 Motor Input to set the motor speed.
volatile Bool mci_run_stop = STOP
 User Input parameter to launch or stop the motor.
volatile S16 User_Speed = 0
 User Input parameter to set motor speed.


Function Documentation

void Do_Sensor_Interrupt ( void   ) 

void mci_backward ( void   ) 

Definition at line 97 of file mc_interface.c.

Referenced by ushell_task().

00098 {
00099   mci_direction = CCW;
00100 }

Here is the caller graph for this function:

void mci_forward ( void   ) 

Definition at line 87 of file mc_interface.c.

Referenced by ushell_task().

00088 {
00089   mci_direction = CW;
00090 }

Here is the caller graph for this function:

U8 mci_get_direction ( void   ) 

Definition at line 107 of file mc_interface.c.

00108 {
00109   return mci_direction;
00110 }

U16 mci_get_measured_current ( void   ) 

Get the current measured in the motor

Precondition:
Launch ADC scheduler

Definition at line 138 of file mc_interface.c.

Referenced by ushell_task().

00139 {
00140   return (U16)(11*(mci_measured_current/128));
00141 }

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 128 of file mc_interface.c.

Referenced by ushell_task().

00129 {
00130   return mci_measured_speed;
00131 }

Here is the caller graph for this function:

Bool mci_motor_is_running ( void   ) 

This function returns the motor command value

Parameters:
none 
Precondition:
initialization HW and SW
Returns:
none
Postcondition:
We know if the motor is running or not /

Definition at line 53 of file mc_interface.c.

00054 {
00055   return mci_run_stop;
00056 }

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 159 of file mc_interface.c.

Referenced by ushell_task().

00160 {
00161    mci_run_stop = RUN;
00162    Disable_interrupt();
00163    svpwm_init();
00164    Do_Sensor_Interrupt();
00165    Enable_interrupt();
00166    PSC_Start();
00167 }

Here is the caller graph for this function:

void mci_set_direction ( U8  direction  ) 

Definition at line 77 of file mc_interface.c.

00078 {
00079    mci_direction = direction;
00080 }

void mci_set_speed ( U16  speed  ) 

store the speed set point

Parameters:
speed 
Precondition:
none
Returns:
none /

Definition at line 66 of file mc_interface.c.

Referenced by ushell_task().

00067 {
00068    User_Speed = speed;
00069 }

Here is the caller graph for this function:

void mci_stop ( void   ) 

This function stops the motor

Parameters:
none 
Precondition:
none
Postcondition:
none

Definition at line 175 of file mc_interface.c.

Referenced by ushell_task().

00176 {
00177    PSC_Stop();
00178    mci_run_stop  = STOP;
00179 }

Here is the caller graph for this function:

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 148 of file mc_interface.c.

Referenced by main().

00149 {
00150   mci_measured_current = (127 * mci_measured_current + 128*current)/128;
00151 }

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 117 of file mc_interface.c.

Referenced by main().

00118 {
00119   mci_measured_speed = measured_speed;
00120 }

Here is the caller graph for this function:

void PSC_Start ( void   ) 

void svpwm_init ( void   ) 

Referenced by mci_run().

Here is the caller graph for this function:


Variable Documentation

Bool mci_direction = CW

User Input parameter to set motor direction.

Definition at line 36 of file mc_interface.c.

U32 mci_measured_current = 0

Motor Input parameter to get the motor current.

Definition at line 41 of file mc_interface.c.

Referenced by mci_get_measured_current(), and mci_store_measured_current().

U8 mci_measured_speed = 0

Motor Input parameter to get the motor speed.

Definition at line 40 of file mc_interface.c.

Referenced by mci_get_measured_speed(), and mci_store_measured_speed().

U8 mci_potentiometer_value = 0

Motor Input to set the motor speed.

Definition at line 42 of file mc_interface.c.

volatile Bool mci_run_stop = STOP

User Input parameter to launch or stop the motor.

command for motor

Definition at line 37 of file mc_interface.c.

volatile S16 User_Speed = 0

User Input parameter to set motor speed.

Definition at line 38 of file mc_interface.c.


Generated on Tue Sep 16 18:11:25 2008 for Atmel BLDC Sinusoidal on ATAVRMC100 by  doxygen 1.5.3