上面我们虽然完成了用中断控制电机转动的程序,但实际上这个程序还是没多少实用价值的,我们不能每次想让它转动的时候都上下电啊,是吧。还有就是它不但能正转还得能反转啊,也就是说不但能转过去,还得能转回来呀。
#include<reg51.h>#define uint unsigned int #define uchar unsigned char #define ms *77 // f = 12 M #define LEDLen 4 #define Dj_star() {IE=0x81; pri_dj=0; } #define Dj_stop() {IE=0x00; pri_dj=1;
#include<reg51.h>#define uint unsigned int #define uchar unsigned char #define ms *77 // f = 12 M #define LEDLen 4 #define Dj_star() {IE=0x81; pri_dj=0; } #define Dj_stop() {IE=0x00; pri_dj=1;