?? motor.c
字號:
#include "hardware.h"#include "motor.h"void init_MotorPort(){ //Dead Zone=0, PreScalero1=2; TCFG0|=(0<<24)|2; //divider timer0=1/2; TCFG1&=(~0xf); TCNTB0= MOTOR_CONT; TCMPB0= MOTOR_MID; TCON|=0x2; //update mode for TCNTB0 and TCMPB0. TCON&=~0x2; TCON|=0x19; //timer0 = auto reload, start. Dead Zone}void SetPWM(int value){ TCMPB0= MOTOR_MID+value;}void exit_MotorPort(void){ TCON&=~0x1f;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -