历史上的今天
今天是:2024年10月23日(星期三)
2019年10月23日 | AVR单片机定时器做的门铃程序+电路
2019-10-23 来源:51hei
#define F_CPU 1000000UL
#include #include #include #define INT8U unsigned char #define INT16U unsigned int #define DoorBell() (PORTD ^= 0x01) / #define Key_DOWN() ((PINB & 0x80) == 0x00) volatile INT16U soundDelay; //两个不同取值分别对应于"叮","咚" int main() { DDRB = 0; PORTB = 0xff; DDRD = 0xff; TCCR1B = 0x01; TCNT1 = -700; sei(); while(1) { if( Key_DOWN() ) { TIMSK = _BV(TOIE1); soundDelay = -700; _delay_ms(400); soundDelay = -1000; _delay_ms(600); TIMSK = 0x00; } } } ISR ( TIMER1_OVF_vect ) { DoorBell(); TCNT1 = soundDelay; }
史海拾趣
|
讨教一下,有没有能在win7/08server下可以使用的stc-isp驱动捏?? RT!!! 下载了http://www.mcu-memory.com/提供的5.01海外版!还是不行!!! We are trying to connect to your MCU ... Chinese:正在尝试与 MCU/单片机 握手连接 ... Connection is failure. You can try: 1.Give your MCU Power On Reset. 2 ...… 查看全部问答> |
|
本人刚开始学弹片,对C语言也是刚刚接触,看了 对于入门还不错. 在这里贴出自己写的键盘扫描实现,小弟初学者,也没考虑那么多,如效率之类的 有不足之处 欢迎大家讨论 #include #include #define uint unsigned int #define uchar unsigned char s ...… 查看全部问答> |
|
求一个 vs2005 下 C# 写的适用于 2440+wince5.0 的串口通讯程序 求一个 vs2005 下 C# 写的适用于 2440+wince5.0 的串口通讯程序 越详细越好 我刚接触这一块 C#的语法还没学全 以前也从没在win下编过程 但是头儿要求的特别急 想找个例程边看边学 希望有大侠能指点一下 同时希望有这种例程的能给我 ...… 查看全部问答> |
|
请教高手 jffs2_get_inode_nodes(): Data CRC failed on node...问题 /bin/mount -n -t jffs2 /dev/mtdblock/3 -o rw,noatime /app jffs2: Erase block size too small (16KiB). Using virtual blocks size (32KiB) instead Empty flash at 0x02407104 ends at 0x02407200 set hw ether and ip of eth0 eth0: Sett ...… 查看全部问答> |
|
不敢说项目中就会用它,但是可以多一种方案多一个选择。 完成后分享过程中的点滴。 [ 本帖最后由 sblpp 于 2010-10-13 18:55 编辑 ]… 查看全部问答> |
|
IAR编译器下本来的工程应该是Debug,Release,但是ST给的Demo中的 TM3210E-EVAL如何产生的?属于Debug呢还是Release呢?… 查看全部问答> |
|
我刚开始学430在编译下面代码的时候,IAR报错 Error[Pe020]: identifier \"P1REN\" is undefined E:\\workspace\\main.c 12 #include \"io430.h\"#include \"intrinsics.h\" int main( void ){ // Stop watchdog timer to prevent time out ...… 查看全部问答> |




