Thread: C with AVR ATMEGA

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    24

    C with AVR ATMEGA

    Ok, so i started a thread a few weeks before about micro controller, and i decided to leave the board to find out further about what microcontrollers i am going to use. The result is :

    AVR ATMEGA

    Maybe the ATMEGA 16, but this is only a probability. So for starters :

    - From where should i begin to learn?
    - On what level of C knowledge do you have to know to program a micro controller?
    - Can anyone give an introduction about this AVR and ATMEGA?
    - Any tutorials on that?

    Well, i'm looking forward to see your replies.

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm not able to answer your question, since I don't know what you are trying to do [nor do I know much about the ATMega product], but I will ask some further questions that will allow someone to PERHAPS help you.
    What are you trying to achieve with your project (as the end goal)? That will determine what you need to learn to fulfill the goal.

    It also determines how much C or other programming knowledge you need. This applies more or less regardless of what embedded chip you are using.

    If you have decided to use this product, surely you know enough about it to know what it can do and that it is in fact meaningful for your project. So why do you need an introduction?

    Datasheet with a lot of information [at least that SHOULD contain 99% of what you need to know to use one of these part] can be found here:
    Atmel Products - Datasheets

    If you don't understand much of that, then add to the list of things to learn "How to read data-sheets and understand them".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    Thanks for the quick reply and thank you for the links on the datasheet, it is very helpful.

    I forgot to mention that this is not my personal project, but school project and directed students to use ATMEGA microcontrollers, that's why i need an introduction since i don't have an idea about what i'm dealing with.

    As for the project, some goals are like making digital voltmeters or other measuring stuff.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm sure there is a "introduction" somewhere on the Atmel website. Googling finds a few hits that look plausible, but I'll let you choose.

    I'm quite experienced with these things with 20+ years of working as a programmer, 15+ years working mainly on embedded microcontrollers , so it's hard to determine "what is the minimum you require to solve your problem". I think I could produce a volt-meter in a matter of a few hours, if I got the time to sit down and do that on it's own.

    What is the most complicated C program that you've written so far?

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    Well, the most complicated was making word frequency counter along with sorting with array, and i was helped by a kind user in this board too. Does the programming still need something more?

    Also, can you give me some tips on how to program a microcontroller? any special notes that differ from normal programming?

  6. #6
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    A microcontroller isn't that different from your average PC processor in most ways. It's not as fast, and it doesn't have as much memory, etc. And of course you will need to use a different compiler and there will be some process for getting the code from the PC to the microcontroller board.

    Of course, depending on how complete the standard library for your microcontroller is, you may have to write your own functions for a lot of things that standard library "does for you" when using say Visual Studio on windows or gcc on Linux.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  7. #7
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    So, do you think that making word frequency and sorting it is enough for microcontroller programming or are there special cases?

    I've try downloading WinAVR and the trial CodeVision, which do you think is better.

    Also i feel that there are other software to implement the code in the chip , am i wrong? If that is so, then i will never see a result until i get my hands on the microcontroller, or are there any simulation software in programming?

  8. #8
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The only ATMel chips I've ever used are ATMel Flash memory - so I have no idea on the details of which toolset is best or some such.

    Edit: And I suspect you may need a bit more skill than a word frequency program - not a lot, but a little. Particularly, you may need to understand how to convert an integer value into the corresponding floating point (or fixed point?) value.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #9
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    Could you provide some links or the thread here with the xplanation? Sorry for asking too much.

    Oh , just out of curiosity, why would i need to change an integer value to float point (is it the same as float numbers?) in microcontroller programming?

  10. #10
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I have no good web-site link, no. And I'm sure google (or something similar) works where you live too.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #11
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    OK, that's fine, thanks very much for the replies

  12. #12
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I just realized I didn't answer the direct question: integer to floating point would be needed to translate a A/D converters output to something sensible, e.g. you get a value between 0..255, and you should display a voltage value between 0..2.0V [for example - haven't looked at the A/D converter that probably is part of the Atmel part].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  13. #13
    Registered User
    Join Date
    Dec 2008
    Posts
    24
    Ok, i understood about the conversion to a some kind of integer range from a real value, but doesn't A/D produce binary numbers? like 0010?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Atmel AVR
    By ssharish2005 in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 07-08-2008, 12:12 PM
  2. C-Programming of ATmega...
    By Erhard Henkes in forum C Programming
    Replies: 1
    Last Post: 06-20-2007, 03:22 PM