I was trying some online assembler. In the listing below all assembly statements compile ok except
OUT PORTB, R24. Above it is OUT 0x08, R21 whic works. I thought that all the AVR register and port names can be used in inline assembler, but seem they can't.
So how do I define/introduce a constant or port name like PortD, or if reserved, _PORTD or something?
In some assemblers you just write like: PORTD EQU 0Fh or Something equ 123 etc.
Otherwise said: why doesn't OUT PORTB, R24 work?
thanks!
Thanks!
the following code still does not compile:
"OUT _SFR_IO_ADDR(PORTA), R12 \n\t"
I look your link, but it was so terribly complicated.
Why can't I just use simple assembler in CC?
Can you give me an example how to output to address range $00 - $3F that must be used with instructions/commands IN and OUT. That is for example: what do I need to do in my code to output to PORTA (=0x22)?
What includes and defs etc. to use. I have used assembler a lot but not avr and not inline c. All is so frustrating and confusing.
Thanks
Mixing ASM and C isn't my specialty, but I think maybe the reason why the defines aren't working is in sfr_defs.h. It seems to do different things depending on whether it's included by a C or ASM compiler. In that case, the PORTA defines may be optimized for C use and not compatible with inline ASM.