本帖最后由 aoshi0603 于 2011-12-12 09:28 编辑
用IAR AVR编译的M8程序,能让下面的计数器T1跑起来就行,我仿真时TCNT1就是不增长。不知道为什么,以前用ICC是好用的
工程在附件中。- #include <iom8.h>
- #include <iomacro.h>
- #include <intrinsics.h>
- #include <comp_a90.h>
- void init_time1(void)
- {
- TCCR1B = 0x00; //stop
- TCNT1 = 0x0000; //
- TCCR1A = 0x00;
- TCCR1B = 0x02; //start Timer
- }
- main()
- {
- unsigned int a;
-
- _CLI(); //全局中断禁用
- init_time1();
- MCUCR = 0x00;
- GICR = 0x00;
- //_SEI(); //全局中断使能
-
- while(1)
- {
- a = TCNT1;
- }
- }
|