Connect with us

c programming

Discussion in 'Microcontrollers, Programming and IoT' started by donkey, Nov 24, 2012.

Scroll to continue with content
  1. donkey

    donkey

    1,289
    56
    Feb 26, 2011
    anyone able to help out finding a hand on approach to cprogramming designed around microcontroller programming?
    I see the basics but I want something easy to follow if there is something like that
     
  2. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,448
    2,809
    Jan 21, 2010
    If I were you, I'd grab some book which concentrates on a particular device (PIC, Arduino, etc). Once you've learned how to handle one device, move along to another.

    Some things will be similar, others will be very different. Trying to learn "generic" C for uC's is not really going to do more than confuse you (or be so general it's useless)
     
  3. CocaCola

    CocaCola

    3,635
    5
    Apr 7, 2012
    I agree with what Steve said, you really need to focus on a book for a particular micro family... Like any language the syntax will be fairly consistent but all the calls to whatever inside the chip will be different from chip to chip...

    FYI I faced a similar dilemma when I was trying to get into micros (and it's part of my lingering issue in mastering C) every C book I found was a generic overview or computer based and half the stuff simply did not apply...

    My biggest learning tool (with micros) was picking a compiler that had an active community and following user forums on a daily basis... I choose PicBasic Pro because of the fact I already knew BASIC and that saved me learning the basic syntax of say C, aka lazy by nature :) ... The support for the compiler as well as the 'BASIC stamp' that the compiler was modeled over was huge with PICs, at the time comparable to what you see for Arduino now...

    Anyway I know you want C so follow Steve's advice, pic a chip, pick a compiler and read the forums... I'm betting that you will get a much better understanding from the forums then you will any single book on the subject...
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    10,793
    2,435
    Nov 17, 2011
    What's your previous knowledge?
    - Do you know "C" and want to extend C-programming to µCs??
    - Do you know how to program a µC in Assembler and now want to go for "C"?
    - Do you know anything about µCs at all?

    While C is not a particularly difficult programming language, it has its quirks. It helps to become familiar with C first before starting to program a µC. Otherwise you may have to fight a battle along two frontlines: the programming language and the µC.
    Or you do it the other way round.

    A few noteable differences between C-programming on a PC or on a µC (I don't claim completeness of the list):
    - On a PC you have access to powerful libraries. On a µC you usually try to keep the code small and libraries are often less powerful.
    - On a µC you typically deal with lots of bitwise operations. Possible on a PC, but in my view uncommon.
    - On a PC you usually have access to floating point arithmetic. Few µCs support this in hardware and the software solutions (libraries) are so much slower than pC hardware.
    - On a µC size of code and data do matter very much more than on a PC
    - ...

    I suggest you first get acquainted with C using any of the free C compilers for PCs. Once you've mastered the basics of C go ahead and transfer that knowledge to programming a µC. For almost each type of µC you will find a community on the internet with sample code, sample circuits and lots of helpful information. Google "experiments with microcontrollers in C".
    You may even ask here :D

    I found this list of books which might befit your interest.

    Another approach could be to look for a learning kit.

    Harald
     
  5. donkey

    donkey

    1,289
    56
    Feb 26, 2011
    my programming skills were limited to BASIC ad they're bout 20 years rusted. so in other words my skills are nought.
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    10,793
    2,435
    Nov 17, 2011
    Here's a list of C prograrmming sites.

    I really think you should grasp the basics of C before moving on to µCs. What's your prior knowledge of µCs?

    Harald
     
  7. dpenelob

    dpenelob

    15
    0
    Mar 27, 2013
    If you just want to learn C, get Kerningham/Ritchie's "C Programming".
    If you are able to write the sample programs given there, you might
    eventually go on to µCs, since there you have to consider some more
    aspects than on your PC (p.ex. input/output is certainly not possible
    via printf/scanf as on the PC).
     
  8. foTONICS

    foTONICS

    332
    9
    Sep 30, 2011
    ++++1 for this. Last summer I taught myself basic assembly programming for the PIC16f627a to prepare myself for the uController class I had coming up. We ended up using the HCS12 board which runs on a motorola and used the asmIDE which was COMPLETELY different than the .asm and MPLAB I was used to. The only thing I felt that learning a different family taught me was how memory was organized and how registers were manipulated.

    I've wanted to get into arduino's and such but I want to become more comfortable with PICs before I start branching out
     
  9. ads

    ads

    6
    0
    Mar 4, 2013
    I personally use mikroc it has many easy to use libraries. I all so recommend their development boards for value. there is more than enough information and example projects on their web site www.mikroe.com
     
  10. ads

    ads

    6
    0
    Mar 4, 2013
    Im also available to help with the coding in c
     
  11. ads

    ads

    6
    0
    Mar 4, 2013
    hi donkey how did you go with your research did you find a solution to that suits you
     
  12. donkey

    donkey

    1,289
    56
    Feb 26, 2011
    I am trying a few avenues but with work and kids finding time to sit down long enough to study is very hard
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-