42步进电机驱动程序

更新时间:2023-07-06 09:25:28 阅读: 评论:0

42步进电机驱动程序#include < reg51. H >
#define uint unsigned int
#clefine uchar unsigned char
#define ms * 77
/ / f = 12 M
#define LEDLen 4
#define Dj star () Pri dj = 0; }
#define Dj_stop () {IE = 0x00; Pri_clj = 1; Pl = 0 XFF; =〃0〃. Delay (800 ms) : Delay (800 ms) ; Delay (400 ms); =1; }
#define Chilun Num 8
/ * the gear number 8 * /
#define t display num () {LEDBuf [0] = TMP / 1000; [1]二TMP / 100%10; \
LEDBuf [2]二TMP / 10 %; LEDBuf [3]二TMP % 10 }
欲扬先抑的作文Uchar LEDBuf [LEDLen]二{0, 0, 0, 0} Shache Shache
LEDBuf
Void read num () : / * read the sowing code to t round num *
Void display ();
Void delay (uint delay_time) {uint I; For (1 = 0; I < delay_time;
I + +); }
Void run ();
Void fx_run ();
Uint round_num 二0; / * record the number of gears that have been turned, interrupted 1 times plus 1 * /
Uint t_round_num 二0; / * sowing platter ts the winding number * /
早上的图片
Uint t_pwm_width = 0; / * sowing platter ts the step motor to the speed * /
Bit one_round_flg 二0;
Sbit led_1000 二P0 八7; / / u for the display
Sbit led_100 = P0 6; / / u for the display
Sbit led_10 = P0 5: / / u for the display
Sbit led_l = P0 4; / / u for the display
Sbit key_start 二P3 八0;
Sbit key_pu 二P3 八 0;
Sbit key_clear = P3 1;
/ * * / P3 八  2 pick up gear nsor interrupt
Sbit bujin_zx_stop 二P3 八3; / * take the step into the motor, the nsor is in place, 0 stop * /
射手男和天蝎女
Sbit bujin_fx_stop = P3 4; / * take the step into the motor, the rever position nsor, 0 down * /
Sbit shache 二P3 八5; / * the brake control relays 0 potential effective * /
Sbit pri_dj = P3 6; /* the main motor control relays 0 potential effective * /
Void main () {
TCON = 0 xOl;
清炖猪脚汤The display ();
While (1) {
IE 二〃0 x00〃;
Round num 二0;
The display ();
If (bujin_fx stop) fx run ();
While (key_start);
Delay (8ms);
If (! Key_start) {
Read_num ();
/ / t_round_num 二8;
While (! Key_start);
The run ();
焦作影视城
Fx_run ();
Void run () {
Pound sign define Delay_time 180 / * turn around 50 cycles, 4 steps per cycle, 50 * 4 二200, 200
* 1. 8 二360 * /dns选择
Uchar I;
Pl 二0 XFF;
Set_pwm_width 二15 + t_pwm_width / 10;
While (1)
While (!)
Dj_star ();随便英语
For (I 二〃0〃;)
Pl 二0 xf9;
延迟(延迟时间);//bujinzxstop=P3 3;
Pl=0xfc://bujinfxstop=P3 4;
延迟(延迟时间);//keypu=P3 0;
Pl=0xf6;//keyclear=P3 1;
延迟(延迟时间);//shache=P3 5;
Pl=0xf3;//pridj=P3 6;
失业率计算公式
如果(i==tpwmwidth)Pl=Oxff; i=0;—圆fig二0;while (! one_round flg &

本文发布于:2023-07-06 09:25:28,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1081482.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图