xtaens 发表于 2010-12-31 15:26:34

哪位大哥知道ICC AVR中的WDT();函数的原型在那个文件夹里啊,,谢谢

下面是我用icc的生成向导生成的代码,但 WDR(); //this prevents a timout on enabling在目录的那个文件夹里,我全部搜了一遍也没找到

请明白的大侠指点一下,,他到底藏在哪里了,,还是没有这个函数啊;;;

谢谢了

祝本坛和各位坛友新年快乐!!!!

//ICC-AVR application builder : 2010-12-31 下午 03:23:17
// Target : M48
// Crystal: 7.3728Mhz

#include <iom48v.h>
#include <macros.h>

void port_init(void)
{
PORTB = 0x00;
DDRB= 0x00;
PORTC = 0x00; //m103 output only
DDRC= 0x00;
PORTD = 0x00;
DDRD= 0x00;
}

//Watchdog initialize
// prescale: 4K
void watchdog_init(void)
{
WDR(); //this prevents a timout on enabling
WDTCSR = 0x49; //WATCHDOG ENABLED - dont forget to issue WDRs
}

#pragma interrupt_handler wdt_isr:7
void wdt_isr(void)
{
//watchdog timeout
}

//call this routine to initialize all peripherals
void init_devices(void)
{
//stop errant interrupts until set up
CLI(); //disable all interrupts
port_init();
watchdog_init();

MCUCR = 0x00;
EICRA = 0x00; //extended ext ints
EIMSK = 0x00;

TIMSK0 = 0x00; //timer 0 interrupt sources
TIMSK1 = 0x00; //timer 1 interrupt sources
TIMSK2 = 0x00; //timer 2 interrupt sources

PCMSK0 = 0x00; //pin change mask 0
PCMSK1 = 0x00; //pin change mask 1
PCMSK2 = 0x00; //pin change mask 2
PCICR = 0x00; //pin change enable
PRR = 0x00; //power controller
SEI(); //re-enable interrupts
//all peripherals are now initialized
}

Gorgon_Meducer 发表于 2010-12-31 15:56:23

macros.h里面
而且,就一句话 asm("wdr")

xtaens 发表于 2011-1-1 21:57:04

回复【1楼】Gorgon Meducer 傻孩子
-----------------------------------------------------------------------

就这一句话能行吗

Gorgon_Meducer 发表于 2011-1-2 15:03:10

能行,保准能把你家狗狗喂饱

xtaens 发表于 2011-1-2 18:13:43

回复【3楼】Gorgon Meducer 傻孩子
-----------------------------------------------------------------------

O(∩_∩)O谢谢傻孩子大哥

xyqdoudou 发表于 2011-1-2 18:20:13

这就是个宏 里面是个汇编指令 就和CLI()SEI()一样。傻孩子已经给你说清楚了

xtaens 发表于 2011-1-2 18:20:45

回复【3楼】Gorgon Meducer 傻孩子
-----------------------------------------------------------------------

大哥能否指点一下怎么用atmega48单片机测量一个波形的宽度(脉宽有窄和宽的)吗,不用外部中断,可以用定时器

最好不用定时器,直接写

谢谢
页: [1]
查看完整版本: 哪位大哥知道ICC AVR中的WDT();函数的原型在那个文件夹里啊,,谢谢