AVR sbi command - Error: number must be positive and less than 32

Posted by Simon on Stack Overflow See other posts from Stack Overflow or by Simon
Published on 2010-04-10T09:10:03Z Indexed on 2010/04/10 9:13 UTC
Read the original article Hit count: 762

Filed under:
|
|

I've spent a good while getting my AVR development system set up with the full GCC tool chain (everything is the most recent current stable version) and I have solved most issues with it but one.

This following code gives me an error which I just don't get. The AVR assembly manual states that the sbi instruction can accept 0-7 as a constant expression but it still errors out on me. Can anyone shed some light onto why it does this please?

  #ifndef __AVR_ATmega168__
      #define __AVR_ATmega168__
  #endif

  #include <avr/io.h>

      rjmp Init

  Init:

      ser r16
      out DDRB, r16
      out DDRD, r16

      clr r16

      out PORTB, r16
      out PORTD, r16

  Start:

      sbi PORTB, 0
      rjmp Start

The line in question is sbi PORTB, 0.

Compiled / assembled with:

avr-gcc ledon.S -mmcu=atmega168

© Stack Overflow or respective owner

Related posts about avr

Related posts about avr-gcc