Connect with us

Debugging an avr atmega 8 microcontroller code

Discussion in 'Microcontrollers, Programming and IoT' started by Himadri Bandyopadhyay, May 4, 2014.

Scroll to continue with content
  1. Himadri Bandyopadhyay

    Himadri Bandyopadhyay

    1
    0
    May 4, 2014
    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: May 5, 2014
  2. KrisBlueNZ

    KrisBlueNZ Sadly passed away in 2015

    8,393
    1,268
    Nov 28, 2011
    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.
     
  3. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,363
    2,758
    Jan 21, 2010
    Do you mean 0x00? (or just plain old 0)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-