IO space vs Memory space writes

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

Hi all. Very new to AVR, but very not-new to programming.

 

Quick question:

Is using store-direct ("sts") to write IO ports considered hackish?

I see that the .def of PORTB is a relative offset in IO land (it's missing the 0x20 offset into memory space).

 

If I'm mixing memory mapped IO writes (above 0x3f) with standard-IO writes, it starts to feel like address space juggling. Yeah(?)

 

Thanks-

 

(btw, I see that "out" is a smaller instruction, and will be smaller/faster)

This topic has a solution.
Last Edited: Wed. Dec 27, 2017 - 05:24 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you going to use assembler for programming? If not why worry, the compiler will do what needs to be done.

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

Assembler. I'm curious (not worried) about the exact things that a compiler abstracts.

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

primaryring wrote:
Very new to AVR, but very not-new to programming.

So are you familiar with other similar microcontrollers, or is the "very not-new to programming" in entirely other domain(s) ?

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

awneil wrote:

So are you familiar with other similar microcontrollers, or is the "very not-new to programming" in entirely other domain(s) ?

 

I'd say familiar with other similar. I have production code on the ARM cortex m4 (ARMv7E-M Harvard architecture).

Everything else is in 'other domains'. I'm a rendering engineer on gaming consoles.

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you are using assembler then the thing to do is to download AVR001: Conditional Assembly and portability macros, it will select between In/Lds and Out/Sts depending on the appropriate register address.
 

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

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

js wrote:

If you are using assembler then the thing to do is to download AVR001: Conditional Assembly and portability macros, it will select between In/Lds and Out/Sts depending on the appropriate register address.

 

Behold! Address juggling macros!

Much appreciated.

 

Last Edited: Wed. Dec 27, 2017 - 02:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AVR001: Conditional Assembly and portability macros

Have they been ported to the gnu assembler?  (huh.  001, eh?  That has to be pretty ancient!)

 

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

Link to macros.inc from atmel
http://www.atmel.com/Images/avr001.zip