生又何欢free
生又何欢free
闷骚青年
关注数: 6
粉丝数: 57
发帖数: 457
关注贴吧数: 21
新人求教,如何用单片机输出0-60V电压 如题,最近遇到一些困难,就是如何用单片机控制输出0-60V的电压?
新人,有问题求前辈解答 void Uart_Init() { TMOD|=0x20; SCON=0x40; PCON|=0x80; TH1=0xf3; TL1=0xf3; TR1=1; ES=1; EA=1; } void Send_Byte(unsigned char dat) { SBUF=dat; while(!TI); TI=0; } void main() { Uart_Init(); P2=0XFF; P0=0XFF; P1=0XFF; P37=1; P36=1; P35=1; P34=1; P33=1; P32=1; while(1) { ////////////////////////////////////////////////////// if(P20==0&&P21==1) { Send_Byte(0x01); Delay_ms(50); } /////////////////////////////////////////////////////// if(P21==0&&P22==1) { Send_Byte(0x02); Delay_ms(50); } /////////////////////////////////////////////////////// if(P22==0&&P23==1) { Send_Byte(0x03); Delay_ms(50); } /////////////////////////////////////////////////////// if(P23==0&&P24==1) { Send_Byte(0x04); Delay_ms(50); } /////////////////////////////////////////////////////// if(P24==0&&P25==1) { Send_Byte(0x05); Delay_ms(50); } /////////////////////////////////////////////////////// if(P25==0&&P26==1) { Send_Byte(0x06); Delay_ms(50); } /////////////////////////////////////////////////////// if(P26==0&&P27==1) { Send_Byte(0x07); Delay_ms(50); } /////////////////////////////////////////////////////// if(P27==0&&P07==1) { Send_Byte(0x08); Delay_ms(50); } /////////////////////////////////////////////////////// if(P07==0&&P06==1) { Send_Byte(0x09); Delay_ms(50); } /////////////////////////////////////////////////////// if(P06==0&&P05==1) { Send_Byte(0x0a); Delay_ms(50); } /////////////////////////////////////////////////////// if(P05==0&&P04==1) { Send_Byte(0x0b); Delay_ms(50); } /////////////////////////////////////////////////////// if(P04==0&&P03==1) { Send_Byte(0x0c); Delay_ms(50); } /////////////////////////////////////////////////////// if(P03==0&&P02==1) { Send_Byte(0x0d); Delay_ms(50); } /////////////////////////////////////////////////////// if(P02==0&&P01==1) { Send_Byte(0x0e); Delay_ms(50); } /////////////////////////////////////////////////////// if(P01==0&&P00==1) { Send_Byte(0x0f); Delay_ms(50); } /////////////////////////////////////////////////////// if(P00==0&&P17==1) { Send_Byte(0x10); Delay_ms(50); } /////////////////////////////////////////////////////// if(P17==0&&P16==1) { Send_Byte(0x11); Delay_ms(50); } /////////////////////////////////////////////////////// if(P16==0&&P15==1) { Send_Byte(0x12); Delay_ms(50); } /////////////////////////////////////////////////////// if(P15==0&&P14==1) { Send_Byte(0x13); Delay_ms(50); } /////////////////////////////////////////////////////// if(P14==0&&P13==1) { Send_Byte(0x14); Delay_ms(50); } /////////////////////////////////////////////////////// if(P13==0&&P12==1) { Send_Byte(0x15); Delay_ms(50); } /////////////////////////////////////////////////////// if(P12==0&&P11==1) { Send_Byte(0x16); Delay_ms(50); } /////////////////////////////////////////////////////// if(P11==0&&P10==1) { Send_Byte(0x17); Delay_ms(50); } /////////////////////////////////////////////////////// if(P10==0&&P32==1) { Send_Byte(0x18); Delay_ms(50); } /////////////////////////////////////////////////////// if(P32==0&&P33==1) { Send_Byte(0x19); Delay_ms(50); } /////////////////////////////////////////////////////// if(P33==0&&P34==1) { Send_Byte(0x1a); Delay_ms(50); } /////////////////////////////////////////////////////// if(P34==0&&P35==1) { Send_Byte(0x1b); Delay_ms(50); } /////////////////////////////////////////////////////// if(P35==0&&P36==1) { Send_Byte(0x1c); Delay_ms(50); } /////////////////////////////////////////////////////// if(P36==0&&P37==1) { Send_Byte(0x1d); Delay_ms(50); } /////////////////////////////////////////////////////// if(P37==0) { Send_Byte(0x1e); Delay_ms(50); } } } 现在是到达一个状态就一直发送,怎么样才能让他只发送一次,下一次到达这个状态再发一次。 如p20==0&&p21==1,发送一次数据,下一次在到达这个状态时,再发送一次。 新人,求前辈解答!万分感谢
有大手能教我小的漂浮术吗? 像小硬币 啥的 能让他飘起来。 表演给女生看
有兄弟要共号的吗?我有火麒麟,30张幻影卡,刀锋,大校军衔 湖北一区的,没时间上了,先找个兄弟共号。毁号的阳痿一辈子。想要的可以加我:845010992
我怎么感觉林逸要悲剧了 但是,将中聚气丹当做破除壁障的丹药时,存在一个致命的缺陷,甚至比聚气丹服用后不能自我修炼升级还要严重
碉堡了 系领导来检查宿舍,我还光着膀子,叼着烟,玩着游戏 有没有,那领导看我的眼神,啊
1
下一页