Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Assembly language or C

  1. Feb 20, 2012 #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 ?
     
  2. jcsd
  3. Feb 20, 2012 #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.
     
  4. Feb 21, 2012 #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: Feb 21, 2012
  5. Feb 21, 2012 #4

    rcgldr

    User Avatar
    Homework Helper

    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.
     
  6. Feb 23, 2012 #5
    thanks for the response guys,
    I like to go straight to C i learnt 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.
     
  7. Feb 23, 2012 #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
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Assembly language or C
  1. C++ to Assembly (Replies: 4)

  2. Assembly language (Replies: 5)

  3. New to assembly language (Replies: 12)

Loading...