51单片机结合NRF24L01对舵机进行无线控制
时间:11-19
来源:互联网
点击:
interrupt 1 { if(flag_0==1) PWM_Value[0]+=1;if(flag_0==2) PWM_Value[0]-=1;if(flag_1==1) PWM_Value[1]+=1;if(flag_1==2) PWM_Value[1]-=1;if(PWM_Value[0]>=2500)PWM_Value[0]=2500;if(PWM_Value[1]>=2500)PWM_Value[1]=2500;if(PWM_Value[0]<=500)PWM_Value[0]=500;if(PWM_Value[1]<=500)PWM_Value[1]=500;switch(order){case 1:PWM_OUT0=1;TH0=(65536-PWM_Value[0])>>8;TL0=(uchar)(65536-PWM_Value[0]);break; case 2:PWM_OUT0=0;TH0=(65536-(5000-PWM_Value[0]))>>8;TL0=(uchar)(65536-(5000-PWM_Value[0]));break; case 3:PWM_OUT1=1;TH0=(65536-PWM_Value[1])>>8;TL0=(uchar)(65536-PWM_Value[1]);break;case 4:PWM_OUT1=0;TH0=(65536-(5000-PWM_Value[1]))>>8;TL0=(uchar)(65536-(5000-PWM_Value[1]));break;case 5:TH0=60536>>8;TL0=(uchar)60536;break;case 6:TH0=60536>>8;TL0=(uchar)60536;order=0;break;default: order=0;break;}order++;}
51单片机NRF24L01舵机无线控 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)