#i nclude
#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; P1=0xff; shach;
delay(800ms); delay(800ms);delay(400ms); shache = 1; }
#define Chilun_Num 8
/* 齿轮数 8 个*/
#define set_display_num() { LEDBuf[0] = tmp / 1000; LEDBuf[1] = tmp / 100 % 10;
LEDBuf[2] = tmp / 10 % 10; LEDBuf[3] = tmp % 10; }
uchar LEDBuf[LEDLen] = {0,0,0,0};
void read_num (); /* 读播码盘 到 set_round_num * 8 */
void display ();
void delay(uint delay_time) { uint i; for (i=0; i < delay_time ; i++) ; }
void run ();
void fx_run();
uint round_num = 0; /* 记录已转的 齿轮数 , 中断1次 加 1*/
uint set_round_num = 0; /* 播码盘设置 圈数 */
uint set_pwm_width = 0; /* 播码盘设置 步进电机 正向速度 */
bit one_round_flg = 0;
***it led_1000 = P0^7; //use for display
***it led_100 = P0^6; //use for display
***it led_10 = P0^5; //use for display
***it led_1 = P0^4; //use for display
***it key_start = P3^0;
***it key_puse = P3^0;
***it key_clear = P3^1;
/* P3^2 接齿轮传感器 中断 */ ***it bujin_zx_stop = P3^3; /* 接步进电机 ,正向到位传感器 ,为 0 停机 */
***it bujin_fx_stop = P3^4; /* 接步进电机 ,反向到位传感器 ,
#i nclude
#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; P1=0xff; shach;
delay(800ms); delay(800ms);delay(400ms); shache = 1; }
#define Chilun_Num 8
/* 齿轮数 8 个*/
#define set_display_num() { LEDBuf[0] = tmp / 1000; LEDBuf[1] = tmp / 100 % 10;
LEDBuf[2] = tmp / 10 % 10; LEDBuf[3] = tmp % 10; }
uchar LEDBuf[LEDLen] = {0,0,0,0};
void read_num (); /* 读播码盘 到 set_round_num * 8 */
void display ();
void delay(uint delay_time) { uint i; for (i=0; i < delay_time ; i++) ; }
void run ();
void fx_run();
uint round_num = 0; /* 记录已转的 齿轮数 , 中断1次 加 1*/
uint set_round_num = 0; /* 播码盘设置 圈数 */
uint set_pwm_width = 0; /* 播码盘设置 步进电机 正向速度 */
bit one_round_flg = 0;
***it led_1000 = P0^7; //use for display
***it led_100 = P0^6; //use for display
***it led_10 = P0^5; //use for display
***it led_1 = P0^4; //use for display
***it key_start = P3^0;
***it key_puse = P3^0;
***it key_clear = P3^1;
/* P3^2 接齿轮传感器 中断 */ ***it bujin_zx_stop = P3^3; /* 接步进电机 ,正向到位传感器 ,为 0 停机 */
***it bujin_fx_stop = P3^4; /* 接步进电机 ,反向到位传感器 ,
举报