Engines control This file provides simply how-to use eb_ebb library. More...
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. |
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 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.
void engine_A_dir | ( | unsigned | dir | ) |
Changes motor A direction.
dir | direction parameters are defined in engine.h |
void engine_A_en | ( | unsigned | status | ) |
Enables or disables the ouput on engine A.
Causes smooth stop, without break.
status | status parameters are defined in engine.h |
void engine_A_pwm | ( | unsigned | pwm | ) |
Sets motor A PWM value.
pwm | Unsigned int, 0~100% |
void engine_B_dir | ( | unsigned | dir | ) |
Changes motor B direction.
dir | direction parameters are defined in engine.h |
void engine_B_en | ( | unsigned | status | ) |
Enables or disables the ouput on engine B.
Causes smooth stop, without break.
status | status parameters are defined in engine.h |
void engine_B_pwm | ( | unsigned | pwm | ) |
Sets motor B PWM value.
pwm | Unsigned int, 0~100% |
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
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