Is it possible to display the value being used for a given register? For example can I send the address being used for PORTB or SPDR to the Serial port for display?
Not looking for the value of that register but the address of the register.
In the PIC processor world with the CCS compiler, we have "getenv()" that will return that, but not that I am aware of here unless you were to look at the assembly language file if it gets created by the compiler (you may have to turn on a compile option). It makes sense with the PIC processors so you can make your code portable between processors (the CCS compiler works with a whole bunch of the different PIC processors and Port B for example may be at different addresses in the map for different processors). Is there a hidden .h file somewhere the compiler is using? Somehow it knows about the register map - it may be in the board descriptions.
@LarryD, great question. I'm seeing some very odd behavior the last 2 days where before everything was fine. Even a simple SPI master isn't working as expected. I want to make sure I don't have something going on in a header file or compiler issue. I'd like to verify the address being used is what the datasheet says it should be.
I had already tried Serial.println(&PORTB); but get an error "call of overloaded 'println(volatile uint8_t*)' is ambiguous".
The datasheet might be correct, Paul, but is the define in the include file?
Yes. Look at the files in \arduino-\hardware\tools\avr\avr\include\avr. Each of the files for various avr chips defines a value for PORTB (in terms of something else).
PaulS:
Yes. Look at the files in \arduino-\hardware\tools\avr\avr\include\avr. Each of the files for various avr chips defines a value for PORTB (in terms of something else).
That was what I was getting at back in #4, I just wasn't sure where it was defined. Over in the PIC forums we have seen cases where the Compiler writers got the definitions wrong (they soon fixed it, but not before people ran into it).