Defines | Functions

engine.h File Reference

Engines control This file provides simply how-to use eb_ebb library. More...

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

Defines

#define ENGINE_EN_ON   1
 Enables Engine.
#define ENGINE_EN_OFF   0
 Disables Engine.
#define ENGINE_DIR_BW   1
 Backward direction.
#define ENGINE_DIR_FW   0
 Forward direction.

Functions

void init_engine_A ()
 Inicializes Engine A - enables PWM outputs and sets IOs.
void init_engine_B ()
 Inicializes Engine B - enables PWM outputs and sets IOs.
void engine_A_en (unsigned status)
 Enables or disables the ouput on engine A.
void engine_B_en (unsigned status)
 Enables or disables the ouput on engine B.
void engine_A_dir (unsigned dir)
 Changes motor A direction.
void engine_B_dir (unsigned dir)
 Changes motor B direction.
void engine_A_pwm (unsigned pwm)
 Sets motor A PWM value.
void engine_B_pwm (unsigned pwm)
 Sets motor B PWM value.

Detailed Description

Engines control This file provides simply how-to use eb_ebb library.

From main function is called init_perip function where is initialized servos, engines, power switch, CAN,ADC and serial port. After this initialization is shown how to control each devices. This sample also include simply sample of sending and receiving CAN message.

Due to small number of PWM channels are only one PWM assigned to one motor. For this case there is two ways how to stop the engine. If you use engine_x_pwm(0); the motors will be stopped by shorting its coils. This will stop as fast as possible, but it also generates huge electromagnetic noise. If you want to stop smoothly use engine_x_en(ENGINE_EN_OFF); this will disconnect the power from the engines.


Define Documentation

#define ENGINE_DIR_BW   1

Backward direction.

#define ENGINE_DIR_FW   0

Forward direction.

#define ENGINE_EN_OFF   0

Disables Engine.

#define ENGINE_EN_ON   1

Enables Engine.


Function Documentation

void engine_A_dir ( unsigned  dir  ) 

Changes motor A direction.

Parameters:
dir direction parameters are defined in engine.h

Here is the call graph for this function:

Here is the caller graph for this function:

void engine_A_en ( unsigned  status  ) 

Enables or disables the ouput on engine A.

Causes smooth stop, without break.

Parameters:
status status parameters are defined in engine.h

Here is the caller graph for this function:

void engine_A_pwm ( unsigned  pwm  ) 

Sets motor A PWM value.

Parameters:
pwm Unsigned int, 0~100%
Note:
0 causes fast stop

Here is the caller graph for this function:

void engine_B_dir ( unsigned  dir  ) 

Changes motor B direction.

Parameters:
dir direction parameters are defined in engine.h

Here is the call graph for this function:

Here is the caller graph for this function:

void engine_B_en ( unsigned  status  ) 

Enables or disables the ouput on engine B.

Causes smooth stop, without break.

Parameters:
status status parameters are defined in engine.h

Here is the caller graph for this function:

void engine_B_pwm ( unsigned  pwm  ) 

Sets motor B PWM value.

Parameters:
pwm Unsigned int, 0~100%
Note:
0 causes fast stop

Here is the caller graph for this function:

void init_engine_A (  ) 

Inicializes Engine A - enables PWM outputs and sets IOs.

Uses PWM channel - PWMMR2. If is somthing other set on PWM channels, it will affect the main PWM frequency If the engine B is set it will afect its output for one cycle

Here is the caller graph for this function:

void init_engine_B (  ) 

Inicializes Engine B - enables PWM outputs and sets IOs.

Uses PWM channel - PWMMR2. If is somthing other set on PWM channels, it will affect the main PWM frequency If the engine A is set it will afect its output for one cycle

Here is the caller graph for this function: