欢迎来到天天文库
浏览记录
ID:61484819
大小:102.50 KB
页数:34页
时间:2021-02-04
《舞蹈机器人程序.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、/******************************************************************************舞蹈机器人程序*作者:梦想科技*老高*Email:@163.com*单片机采用AT89S52,晶振频率为:12.00MHz。/******************************************************************************/#include//51芯片管脚定义头文件#include2、rins.h>//内部包含延时函数_nop_()#defineucharunsignedchar#defineuintunsignedintsbitSDATA_595=P3^0;//串行数据输入sbitSCLK_595=P3^1;//移位时钟脉冲sbitRCK_595=P3^6;//输出锁存器控制脉冲ucharrun=0;//步骤标记ucharnum=0;//同时工作的电数uchari;sbitin0=P1^0;sbitin1=P1^1;sbitin2=P1^2;sbitin3=P1^3;sbitin4=P1^4;sbiti3、n5=P1^5;sbitin6=P1^6;sbitin7=P1^7;sbitin8=P0^0;unsignedcharstate0_A=0;//定义电机0的状态Aunsignedcharstate0_B=0;//定义电机0的状态Bunsignedcharstate1_A=0;//定义电机1的状态Aunsignedcharstate1_B=0;//定义电机1的状态Bunsignedcharstate2_A=0;//定义电机2的状态Aunsignedcharstate2_B=0;//定义电机2的状态Bunsignedcharst4、ate3_A=0;//定义电机3的状态Aunsignedcharstate3_B=0;//定义电机3的状态Bunsignedcharstate4_A=0;//定义电机4的状态Aunsignedcharstate4_B=0;//定义电机4的状态Bunsignedcharstate5_A=0;//定义电机5的状态Aunsignedcharstate5_B=0;//定义电机5的状态Bunsignedcharstate6_A=0;//定义电机6的状态Aunsignedcharstate6_B=0;//定义电机6的状态B//unsig5、nedcharstate7_A=0;//定义电机7的状态A//unsignedcharstate7_B=0;//定义电机7的状态B//unsignedcharstate8_A=0;//定义电机8的状态A//unsignedcharstate8_B=0;//定义电机8的状态Bunsignedinttemp=0xffff;unsignedinttemp_595;unsignedinttemp_0;unsignedinttemp_1;unsignedinttemp_2;unsignedinttemp_3;unsignedintte6、mp_4;unsignedinttemp_5;unsignedinttemp_6;unsignedinttemp_7;unsignedcharP17_temp;unsignedcharP17_flag;unsignedintnum_0=0xffff;unsignedintnum_1=0xffff;unsignedintnum_2=0xffff;unsignedintnum_3=0xffff;unsignedintnum_4=0xffff;unsignedintnum_5=0xffff;unsignedintnum_6=0xf7、fff;//unsignedintnum_7=0xffff;//unsignedintnum_8=0xffff;unsignedintcount_0=0;unsignedintcount_1=0;unsignedintcount_2=0;unsignedintcount_3=0;unsignedintcount_4=0;unsignedintcount_5=0;unsignedintcount_6=0;//unsignedintcount_7=0;//unsignedintcount_8=0;voidWR_595();voi8、dOUT_595();voidscan();voidstart_595(void);voidstop(void);voidmoto0(unsignedchars0);voidmoto1(unsignedchars1);voidmoto2(unsignedchars2);voidmoto3(
2、rins.h>//内部包含延时函数_nop_()#defineucharunsignedchar#defineuintunsignedintsbitSDATA_595=P3^0;//串行数据输入sbitSCLK_595=P3^1;//移位时钟脉冲sbitRCK_595=P3^6;//输出锁存器控制脉冲ucharrun=0;//步骤标记ucharnum=0;//同时工作的电数uchari;sbitin0=P1^0;sbitin1=P1^1;sbitin2=P1^2;sbitin3=P1^3;sbitin4=P1^4;sbiti
3、n5=P1^5;sbitin6=P1^6;sbitin7=P1^7;sbitin8=P0^0;unsignedcharstate0_A=0;//定义电机0的状态Aunsignedcharstate0_B=0;//定义电机0的状态Bunsignedcharstate1_A=0;//定义电机1的状态Aunsignedcharstate1_B=0;//定义电机1的状态Bunsignedcharstate2_A=0;//定义电机2的状态Aunsignedcharstate2_B=0;//定义电机2的状态Bunsignedcharst
4、ate3_A=0;//定义电机3的状态Aunsignedcharstate3_B=0;//定义电机3的状态Bunsignedcharstate4_A=0;//定义电机4的状态Aunsignedcharstate4_B=0;//定义电机4的状态Bunsignedcharstate5_A=0;//定义电机5的状态Aunsignedcharstate5_B=0;//定义电机5的状态Bunsignedcharstate6_A=0;//定义电机6的状态Aunsignedcharstate6_B=0;//定义电机6的状态B//unsig
5、nedcharstate7_A=0;//定义电机7的状态A//unsignedcharstate7_B=0;//定义电机7的状态B//unsignedcharstate8_A=0;//定义电机8的状态A//unsignedcharstate8_B=0;//定义电机8的状态Bunsignedinttemp=0xffff;unsignedinttemp_595;unsignedinttemp_0;unsignedinttemp_1;unsignedinttemp_2;unsignedinttemp_3;unsignedintte
6、mp_4;unsignedinttemp_5;unsignedinttemp_6;unsignedinttemp_7;unsignedcharP17_temp;unsignedcharP17_flag;unsignedintnum_0=0xffff;unsignedintnum_1=0xffff;unsignedintnum_2=0xffff;unsignedintnum_3=0xffff;unsignedintnum_4=0xffff;unsignedintnum_5=0xffff;unsignedintnum_6=0xf
7、fff;//unsignedintnum_7=0xffff;//unsignedintnum_8=0xffff;unsignedintcount_0=0;unsignedintcount_1=0;unsignedintcount_2=0;unsignedintcount_3=0;unsignedintcount_4=0;unsignedintcount_5=0;unsignedintcount_6=0;//unsignedintcount_7=0;//unsignedintcount_8=0;voidWR_595();voi
8、dOUT_595();voidscan();voidstart_595(void);voidstop(void);voidmoto0(unsignedchars0);voidmoto1(unsignedchars1);voidmoto2(unsignedchars2);voidmoto3(
此文档下载收益归作者所有