ImageVerifierCode 换一换
格式:DOCX , 页数:44 ,大小:24.68KB ,
资源ID:18464740      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/18464740.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(舞蹈机器人Word文件下载.docx)为本站会员(b****3)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

舞蹈机器人Word文件下载.docx

1、 /定义电机0的状态Aunsigned char state0_B=0; /定义电机0的状态B unsigned char state1_A=0; /定义电机1的状态Aunsigned char state1_B=0; /定义电机1的状态B unsigned char state2_A=0; /定义电机2的状态Aunsigned char state2_B=0; /定义电机2的状态Bunsigned char state3_A=0; /定义电机3的状态Aunsigned char state3_B=0; /定义电机3的状态Bunsigned char state4_A=0; /定义电机4的状态

2、Aunsigned char state4_B=0; /定义电机4的状态Bunsigned char state5_A=0; /定义电机5的状态Aunsigned char state5_B=0; /定义电机5的状态Bunsigned char state6_A=0; /定义电机6的状态Aunsigned char state6_B=0; /定义电机6的状态B/unsigned char state7_A=0; /定义电机7的状态A/unsigned char state7_B=0; /定义电机7的状态B/unsigned char state8_A=0; /定义电机8的状态A/unsigne

3、d char state8_B=0; /定义电机8的状态Bunsigned int temp=0xffff;unsigned int temp_595;unsigned int temp_0;unsigned int temp_1;unsigned int temp_2;unsigned int temp_3;unsigned int temp_4;unsigned int temp_5;unsigned int temp_6;unsigned int temp_7;unsigned char P17_temp;unsigned char P17_flag;unsigned int num_0

4、=0xffff;unsigned int num_1=0xffff;unsigned int num_2=0xffff;unsigned int num_3=0xffff;unsigned int num_4=0xffff;unsigned int num_5=0xffff;unsigned int num_6=0xffff;/unsigned int num_7=0xffff;/unsigned int num_8=0xffff;unsigned int count_0=0;unsigned int count_1=0;unsigned int count_2=0;unsigned int

5、count_3=0;unsigned int count_4=0;unsigned int count_5=0;unsigned int count_6=0;/unsigned int count_7=0;/unsigned int count_8=0; void WR_595(); void OUT_595(); void scan(); void start_595(void); void stop(void); void moto0(unsigned char s0); void moto1(unsigned char s1); void moto2(unsigned char s2);

6、 void moto3(unsigned char s3); void moto4(unsigned char s4); void moto5(unsigned char s5); void moto6(unsigned char s6); void moto7(unsigned char s7); void scan0(unsigned int n0); void scan1(unsigned int n1); void scan2(unsigned int n2); void scan3(unsigned int n3); void scan4(unsigned int n4); void

7、 scan5(unsigned int n5); void scan6(unsigned int n6); void scan7(unsigned int n7); void delay50ms(int ms);/*/*将显示数据送入74HC595内部移位寄存器 */void WR_595(void) uchar j ; temp_595=temp; for (j=0 ;j16 ;j+) temp_595=temp_5950 ; k-)/* 开关电机 */* 0-关电机 /关某位用 1 或,其他位为0 */* 1-正转 /开某位用 0 与,其他位为1 */* 2-反转 */void moto0

8、(unsigned char s0) switch(s0) case 0: temp_0=temp; temp_0|=0x0003; temp=temp_0; break ; /关电机 case 1: temp_0&=0xfffe; /正转 case 2:=0xfffd; /反转void moto1(unsigned char s1) switch(s1) temp_1=temp; temp_1|=0x000c; temp=temp_1; temp_1&=0xfffb;=0xfff7; void moto2(unsigned char s2) switch(s2) temp_2=temp; t

9、emp_2|=0x0030; temp=temp_2; temp_2&=0xffef;=0xffdf;void moto3(unsigned char s3) switch(s3) temp_3=temp; temp_3|=0x00c0; temp=temp_3; temp_3&=0xffbf;=0xff7f;void moto4(unsigned char s4) switch(s4) temp_4=temp; temp_4|=0x0300; temp=temp_4; temp_4&=0xfeff;=0xfdff;void moto5(unsigned char s5) switch(s5)

10、 temp_5=temp; temp_5|=0x0c00; temp=temp_5; temp_5&=0xfbff;=0xf7ff;void moto6(unsigned char s6) switch(s6) temp_6=temp; temp_6|=0x3000; temp=temp_6; temp_6&=0xefff;=0xdfff;void moto7(unsigned char s7) switch(s7) temp_7=temp; temp_7|=0xc000; temp=temp_7; temp_7&=0xbfff;=0x7fff;/* 脉冲电机控制 */* num_i-输入电机

11、的转动角数 */* state0_B-前一个电平状态 */* state0_A-当前电平状态 */void scan0(unsigned int n0) num_0=n0;void scan1(unsigned int n1) num_1=n1;void scan2(unsigned int n2) num_2=n2;void scan3(unsigned int n3) num_3=n3;void scan4(unsigned int n4) num_4=n4;void scan5(unsigned int n5) num_5=n5;void scan6(unsigned int n6) n

12、um_6=n6;/* void scan7(unsigned int n7) num_7=n7;void scan8(unsigned int n5) */void scan(void)/* 第 0 个扫描 */ state0_B=state0_A; state0_A=in0; if(state0_A!=state0_B) /判断是否有电平跳变 count_0+; if(count_0num_0) moto0(0); start_595(); count_0=0; num-; num_0=0xffff; /* 第一个扫描 */ state1_B=state1_A; state1_A=in1;

13、if(state1_A!=state1_B) /判断是否有电平跳变 count_1+; if(count_1num_1) moto1(0); count_1=0; num_1=0xffff;/* 第二个扫描 */ state2_B=state2_A; state2_A=in2; if(state2_A!=state2_B) /判断是否有电平跳变 count_2+; if(count_2num_2) moto2(0); count_2=0; num_2=0xffff;/* 第三个扫描 */ state3_B=state3_A; state3_A=in3; if(state3_A!=state3_

14、B) /判断是否有电平跳变 count_3+; if(count_3num_3) moto3(0); count_3=0; num_3=0xffff;/* 第四个扫描 */ state4_B=state4_A; state4_A=in4; if(state4_A!=state4_B) /判断是否有电平跳变 count_4+; if(count_4num_4) moto4(0); count_4=0; num_4=0xffff;/* 第五个扫描 */ state5_B=state5_A; state5_A=in5; if(state5_A!=state5_B) /判断是否有电平跳变 count_

15、5+; if(count_5num_5) moto5(0); count_5=0; num_5=0xffff;/* 第六个扫描 */ state6_B=state6_A; state6_A=in6; if(state6_A!=state6_B) /判断是否有电平跳变 count_6+; if(count_6num_6) P2=0xff; count_6=0; num_6=0xffff;/* 第七个扫描 * state7_B=state7_A; state7_A=in7; if(state7_A!=state7_B) /判断是否有电平跳变 count_7+; if(count_7num_7) m

16、oto7(0); count_7=0; num_7=0xffff;/* 第八个扫描 * state8_B=state8_A; state8_A=in8; if(state8_A!=state8_B) /判断是否有电平跳变 count_8+; if(count_8 count_8=0; */* 主程序 */void main(void) SCLK_595=0 ; stop(); run=0; P17_flag=1; while(1) while(P17_flag) P17_temp=P1; P17_temp |=0x7f; if(P17_temp=0x7F) P17_flag=0; switch(run) case 0: /0-1秒,双手向前伸直,与身体成90度 num=2; moto0(1); scan0(950); /11

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1