We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-07-19
Package Version: 1.0.0.0
Example: 1.0.0.0
Category: Brushed
Downloaded: 5724 times
Not followed.
License: MIT license
DC Motor 8 click is a DC motor driver. It can drive simple DC motors with brushes, providing them with a significant amount of current and voltage up to 40V.
Do you want to subscribe in order to receive notifications regarding "DC Motor 8 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "DC Motor 8 click" changes.
Do you want to report abuse regarding "DC Motor 8 click".
Library Description
Initializes and defines GPIO driver and constant values wich can be used in example code and also enables chip.
Key functions
void dcmotor8_setFreq(uint16_t freq, uint8_t step) - Function sets frequency and current duty for PWM Timer5.
void dcmotor8_startMotor(uint16_t delayTime, uint8_t stopEnable) - Function sets delay time witch decides when PWM Timer5 will be stoped and started again. If stopEnable is 1 the PWM Timer5 will be stoped, and if 0 will be not stoped.
Examples Description
The demo application is composed of three sections:
void applicationTask() { char txt[4] = {0}; //Sets frequency 20kHz and current duty 36000 (Duty range is from 0 to 65535) dcmotor8_setFreq(_DCMOTOR8_20KHZ, _DCMOTOR8_DUTY_36000); //Enables motor stop working and sets 20 sec work time and 4 sec disabling time dcmotor8_startMotor(_DCMOTOR8_DELAY_20SEC, _DCMOTOR8_DELAY_4SEC, _DCMOTOR8_STOP_ENABLE); //Writes on USB UART value of current duty for PWM Timer5 IntToStr(pwmPeriod, txt); mikrobus_logWrite("Value of PWM timer period is: ", _LOG_TEXT); mikrobus_logWrite(txt, _LOG_LINE); Delay_ms(100); }
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.