新手上路
- 积分
- 20
- 金钱
- 20
- 注册时间
- 2017-10-17
- 在线时间
- 1 小时
|
1金钱
TIM4_PWM_Init(7199,0);
......
void SetMotorSpeed(unsigned char ucChannel,signed char cSpeed)
{
// static short sMotorSpeed = 0;
short sPWM;
// float fDir = 1;
if (cSpeed>=100) cSpeed = 100;
if (cSpeed<=-100) cSpeed = -100;
sPWM = 3600 - fabs(cSpeed)*72;
switch(ucChannel)
{
case 0:
TIM_SetCompare3(TIM4,sPWM);
......
TIM_ TIM_SetCompare3 这个函数什么意思?为什么调节SPWM的值能改变占空比,spwm的值为什么要是负数?
|
|