Should I Learn Assembly Language or C for New Atmega328 Board?

In summary, if you want to learn how to program in C, you should start by reading other people's projects and doing test and error.
  • #1
reddvoid
119
1
I got new atmega328 board
should i learn assembly language first or jump directly to programming with C ?
is knowing inside architecture necessary for programming micro controller using embedded c ?
 
Technology news on Phys.org
  • #2
No you can go strait into C. You should examine the compiler output though to make sure you have a feel for what it's doing.

You have to know the memory map and register functions for the input and output hardware. But no, you don't have to know the architecture. It'd be a good idea though.
 
  • #3
Using C for your embedded software will improve portability and maintainability of your code. Knowing the details of the hardware architecture is generally not important.

However, the one (and by far most relevant) architectural aspect to keep in mind is choosing data types for variables that match the micro controller's bus width. Using 8-bit unsigned chars will result in the most efficient code size and execution speed for the atmega328.
 
Last edited by a moderator:
  • #4
Did you also get C callable functions (library and header files) for accessing the cpu specific stuff like the timers, serial ports, ... ? If so, you'll need to understand how to use those functions, if not, you'll have to understand how to program those components.

If you were to write your own multi-tasking operating system, you might need to write some assembly code to handle other cpu specific stuff like interrupt handling and task (context) switching.
 
  • #5
thanks for the response guys,
I like to go straight to C i learned memory map and different registers special function registers and about timers and counters from from its data sheet but i feel coding in assembly language is fun but need to remember lot of stuff .
and i know basic embedded c
but where can i get in detail about functions like DDRx programing timers and counters and all . . . programming in C? Any book ,online resources are also welcome.
 
  • #6
reddvoid, I am using also ATMega 328 attached to the board of Arduino, it has been one month I use it...it is also my first time to deal with C programming which is very interesting because after I make the program, I can test it whether it works or not in the real process.

Anw, I am using Proteus simulation software which mean I can reduce the cost of buying stuffs, :D

My suggestion, the best way to dig deeper of C by doing a project.
I am tasked to make project in the factory I am doing my internship, then It gives me pressure, responsibility, and time limited to exert my creativity and spirit!

Anyway I start learning C by just reading from other people projects and doing test and error, it seems fun :D
 

1. Should I learn assembly language or C for the new Atmega328 board?

Both assembly language and C are commonly used for programming Atmega328 boards. It ultimately depends on your personal preferences and project requirements.

2. What are the advantages of learning assembly language for the Atmega328 board?

Learning assembly language allows for more precise control over the hardware and can result in faster and more efficient code. It can also be useful for low-level programming and debugging.

3. What are the benefits of learning C for the Atmega328 board?

C is a high-level language that is easier to learn and read compared to assembly language. It also has a larger community and more resources available for support and development.

4. Is it necessary to learn both assembly language and C for the Atmega328 board?

No, it is not necessary to learn both languages. However, having knowledge of both can be beneficial for certain projects and can help you understand the underlying hardware better.

5. Are there any resources available for learning assembly language and C for the Atmega328 board?

Yes, there are numerous online tutorials, forums, and books available for learning both assembly language and C for the Atmega328 board. It is recommended to explore different resources and find the ones that work best for your learning style.

Similar threads

  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
4
Replies
122
Views
13K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
8
Views
877
  • Programming and Computer Science
4
Replies
107
Views
5K
  • Programming and Computer Science
Replies
15
Views
1K
Replies
6
Views
1K
  • Computing and Technology
Replies
9
Views
1K
  • Programming and Computer Science
Replies
6
Views
2K
  • Computing and Technology
Replies
2
Views
1K
Back
Top