I didn't find the STACK initialization.
And the Watchdog, too.
Mark Jordan
On 3 Feb 2005 at 12:56, Javier Fiasche wrote:
>
> Here goes the inicialization routine
>
>
> void init_mega32(void)
> {
>
> #ifndef DEGUB
> MCUCSR|=0x80;// Disable JTAG
> #endif
>
> // Port A initialization
> PORTA=0b00001000;
> DDRA=0b00001000;
> // Port B initialization
> DDRB=0b00000000;
> PORTB=0b00001111;
> // Port C initialization
> DDRC=0b10110000;
> PORTC=0b10000000;
> // Port D initialization
> DDRD=0b11100000;
> PORTD=0b00000000;
>
> // Timer/Counter 0 initialization
> // Clock source: System Clock
> // Clock value: Timer 0 Stopped
> // Mode: Normal top=FFh
> // OC0 output: Disconnected
> TCCR0=0x00;
> TCNT0=0x00;
> OCR0=0x00;
>
> // Timer/Counter 1 initialization
> // Clock source: System Clock
> // Clock value: Timer 1 Stopped
> // Mode: Normal top=FFFFh
> // OC1A output: Discon.
> // OC1B output: Discon.
> // Noise Canceler: Off
> // Input Capture on Falling Edge
> TCCR1A=0x00;
> TCCR1B=0x00;
> TCNT1H=0x00;
> TCNT1L=0x00;
> OCR1AH=0x00;
> OCR1AL=0x00;
> OCR1BH=0x00;
> OCR1BL=0x00;
>
> // Timer/Counter 2 initialization
> // Clock source: System Clock
> // Clock value: Timer 2 Stopped
> // Mode: Normal top=FFh
> // OC2 output: Disconnected
> ASSR=0x00;
> TCCR2=0x00;
> TCNT2=0x00;
> OCR2=0x00;
>
> // External Interrupt(s) initialization
> // INT0: Off
> // INT1: Off
> // INT2: Off
> GICR|=0x00;
> MCUCR=0x00;
>
> // Timer(s)/Counter(s) Interrupt(s) initialization
> TIMSK=0x00;
>
> // USART initialization
> // Communication Parameters: 8 Data, 1 Stop, No Parity
> // USART Receiver: On
> // USART Transmitter: On
> // USART Mode: Asynchronous
> // USART Baud rate: 9600 (Double Speed Mode)
> UCSRA=0x02;
> UCSRB=0x18;
> UCSRC=0x86;
> UBRRH=0x00;
> UBRRL=0x0C;
>
> // Analog Comparator initialization
> // Analog Comparator: Off
> // Analog Comparator Input Capture by Timer/Counter 1: Off
> // Analog Comparator Output: Off
> ACSR=0x80;
> SFIOR=0x00;
>
> }
>
>
>
> Any ideas???
>
>
> thanks javierMessage
RE: [AVR-Chat] Re: Bootup/reset very big problem
2005-02-03 by Mark Jordan
Attachments
- No local attachments were found for this message.