历史上的今天
今天是:2024年10月24日(星期四)
2019年10月24日 | ATMEGA48利用按键控制时钟proteus仿真
2019-10-24 来源:51hei
ATMEGA48时钟程序源码:
#include //共阳数码管键码 const unsigned char disp_table_ca[]= { 0xC0,0xF9,0xA4,0xB0,0x99, 0x92,0x82,0xF8,0x80,0x90 }; char a_second=0; char b_second=0; int count=0,flag; void delay(unsigned int x) { int i,j; for(i=0;i void main() { DDRD=0xff; DDRB=0XFF; PORTC=0XFF; while(1) { PORTB=0B00000001; PORTD=disp_table_ca[a_second]; delay(1); PORTB=0B00000010; PORTD=disp_table_ca[b_second]; delay(1); if((PINC&0B00000001)==0) { delay(20); if((PINC&0B00000001)==0) flag=1; while((PINC&0B00000001)==0); } if((PINC&0B00000010)==0) { delay(20); if((PINC&0B00000010)==0) flag=2; while((PINC&0B00000010)==0); } if((PINC&0B00000100)==0) { delay(20); if((PINC&0B00000100)==0) flag=3; while((PINC&0B00000100)==0); } if(flag==1) { count++; if(count%49==0) b_second++; if(b_second==10) { b_second=0; a_second++; if(a_second==6) a_second=0; } } if(flag==2) { count++; if(count%49==0) b_second--; if(b_second==-1) { b_second=9; a_second--; if(a_second==-1) a_second=5; } } if(flag==3) { a_second=0; b_second=0; } } }
上一篇:LCD1602高手使用详解
史海拾趣
|
每次安装到最后都是出现一个错误提示对话框: ToolsMsmCA(Error):Setup package issue: Xml file not found: 然后进度条就发生了传说中的自动回滚Rolling back 那位大侠遇到过我这种情况啊 麻烦指导一下啊 谢谢… 查看全部问答> |
|
第一个hello,world程序,编译沒有错误,执行时提示:Connection was not created 模拟器可以打开,然后弹出Connection was not created,不是模拟器设置的问题,我已经选了Win32[WCE emulator],也选择了标准SDK 我是超级新手,多谢各位帮帮忙啊,另外应该怎样学Wince编程啊,怎么知道使用的 ...… 查看全部问答> |
|
今天中午闲暇之余,看了向农姐姐的一个帖子,是关于面试的,拒绝了一个女孩子,源于一个问题“如果她来EEWORLD,只能从最底层做起,做些别人不愿意做的事。。。”这不得不勾起了我的回忆,往事历历在目啊。。 ...… 查看全部问答> |




