Compiler error? I/O address not correct

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I this a bug, ar have I set something wrong?
In Avr Studio 4 the configuration is set to ATMEGA168 yet Im haveing problems which 'might be attributed to the following generated code. (Mega 168).

51: UCSR0B &= ~(1<<TXEN0); // DISABLE Tx
+0000022D: 918000C1 LDS R24,0x00C1
+0000022F: 7F87 ANDI R24,0xF7
+00000230: 938000C1 STS 0x00C1,R24

The Data sheet states that when using LD and ST instructions 0x20 must be added to the address.
This doesn't look like its being compiled correctly and might explain the problems Im having.

AVR Studio 4.13.528
GUI Version 4, 13, 0, 528
JTAGICE mkII 1, 0, 1, 140
ATmega168 190

Advise anyone?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ignore my post - I wasnt thinking clearly!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
when using LD and ST instructions 0x20 must be added to the address.
That would be the case for ports in the I/O space, but newer chip have some ports in ram space and are defined as such so you don't need to add the offset..but looks like you know that already. :)

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly