Maker Pro
Maker Pro

Debugging an avr atmega 8 microcontroller code

Himadri Bandyopadhyay

May 4, 2014
1
Joined
May 4, 2014
Messages
1
Please help me with debugging the code
The error message is
exit code 2
Code:
#include"at8ports.h"
#include<avr/io.h>
#include<util/delay.h>
void init_settings()
{
   DDRB_OUT(0);   
   DDRB_OUT(1);   
   DDRB_OUT(2);   
   DDRB_OUT(3);   
   DDRB_OUT(4);   
 
   DDRB_OUT(5); 
   DDRB_OUT(6); 
 
   DDRB_OUT(7);   
     }

int main(void)
{

  init_settings();
  While(1)
  {
  PORTB=0xoo;
    _delay_ms(50);
    PORTB=0x01;
    _delay_ms(50);
    PORTB=0x02;
    _delay_ms(50);
    PORTB=0x04;
    _delay_ms(50);
    PORTB=0x08;
    _delay_ms(50);
    PORTB=0x10;
    _delay_ms(50);
    PORTB=0x20;
    _delay_ms(50);
    PORTB=0x40;
    _delay_ms(50);
    PORTB=0x80;
    _delay_ms(50);
    }
   }

the led pattern on the bread board will be
00000000
00000001
00000010
00000100
00001000
00010000
and so on...
 
Last edited by a moderator:

KrisBlueNZ

Sadly passed away in 2015
Nov 28, 2011
8,393
Joined
Nov 28, 2011
Messages
8,393
What compiler are you using?

What does the message "Exit code 2" mean? Look up the compiler documentation.

When you post code, surround it with (CODE) and (/CODE) tags (use square brackets instead of parentheses). This makes it appear in a monospaced font with whitespace preserved, so things line up.
 
Top