Development tool and IDE for ATmega328 in Assembly coding

Status
Not open for further replies.

Alan8947

Full Member level 4
Joined
Sep 21, 2016
Messages
215
Helped
9
Reputation
18
Reaction score
11
Trophy points
1,298
Activity points
3,746
Hi

I have been studying the datasheet of ATmega328, I finish 200pages including SPI, USART. I plan to finish study to about 270 that include 2-wires and ADC. I read the assembly codes in the examples in the datasheet, so far, I understand them. It was hard at the very beginning to get used to the datasheet, but it's been smooth.

I want to try writing some assembly code to play around. I bought a kit from Amazon a year ago planning to play with my grand daughter, but as I study, I really got interested and study more than I should. I don't know whether this kit can even do assembly coding. Anyone familiar with this kit?

https://www.amazon.com/dp/B08C4SK6H3

If not, can anyone suggest what to buy and what IDE I should use to do assembly. Any good books? I have a few books, but I think they are all in C++. I'll get to C++ eventually. But for now, I want to get my hands wet on assembly.

I am an old timer, my career started with assembly programming in 1980 with 8085. I still like assembly programming. Call me crazy.

thanks
 

C++ is one way, C is another way. ASSY is a way to optimize the bloated (size) and or to speed up performance of the microcontroller. I think It usually requires more effort to solve problems in ASSY vs c or c++.
 
Last edited:
Hi,

I´m sorry for the PC problem.

I have NO IDEA what are the Hex stuff and all.
The Assembler (software) generates the machine code.
The HEX file is the machine code saved in INTEL-HEX-Format.
Basically this is what you upload to the microcontroller using the programmer (hardware) or the bootlaoder.
It is the executable code.


Klaus
 

    Alan8947

    Points: 2
    Helpful Answer Positive Rating


You can define R23 ith a different name?

yes, you can use whatever name you like, you also don't need to use name and use R23 directly... just to note that you can change to aonther free register (like R16 or higher, why? because LDI instruction uses register R16 to R31 to load directly.

are the ":" on the first few lines a mistake?
no, they are comments in the assembly file , I commented the stack initialization as a fresh reset in a microntroller shouldn't need it, but anyway its recommended in case of using a bootloader (like in your board)

what is lo8(RAMEND)?...
RAMEND is 0x08FF it's a 16bit value to represent the last address of the RAM memory. lo8(RAMEND) indeed will get the lower byte, in this case 0xFF, hi8(RAMEND) gets the higer byte so in this case, 0x08
an alternative is to define two constants:
RAMEND_LO 0xFF
RAMEND_HI 0x08
and use them accordingly, but I included ths other way, because it's more readable, as the value you will need is a 16 bit value of 0x08FF but the instructions are only of 8 bits values (very common escenario)

is 50 decimal?
yeah, direct numbers are in decimal 50, for hex values you can append '0x' and for octal values '0' (so be careful of leading 0s)

Should add { and } for sobroutine like below?
in Assembler you don't use brackets {} for subroutines, you usually have a label: and call (rcall) from somewhere in the code, just note that a subroutine should ha a RET instruction somewhere to return from the place it was called.
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…