microcontroller programming

Discussion in 'Programmer's Corner' started by kamalakgkannan, Sep 4, 2005.

  1. kamalakgkannan

    Thread Starter New Member

    Jul 2, 2005
    I know to satisfactory extent to make hardware designs. But nothing about the software. Can anyone help me in teaching right from the very basic state, how to write programs for running applications using microcontroller. I would prefer the helper to send his/her teaching materials through my mail ID,

    E-mail removed to prevent spambots picking it up. Please put a link to your e-mail in your profile if you wish people to contact you. Thanks

    Thanks in return,

  2. Brandon

    Senior Member

    Dec 14, 2004
    Software = Hardware. Software was the easy solution to make customized hardware which can be changed very easily for upgrades, etc. Also, software is a way to cut down hardware costs when you have multiple devices which could use all the same hardware with a slightly different software package, hense all the different variations of video cards. Some of the card you can reflash their bios (their software) and turn the card into a different model. Makes it very easy for companies and very cheap for them.

    Microcontrollers have numerous languages which they can be programmed in. Solely depends upon the compiler you decide to use, if any. You can write them in C, Basic, or cut the chase and do it all in high level machine (asmb).

    When you conceive your project, you need to figure out are that time what you expect you want to keep hardware (things that you know will NEVER change) and what should be software (things you need to change or calibrate to get the device to work) and you design your device in that manner.

    Now if your asking how to program in general, each microcontroller typically comes with its preferred programming method and programmer application and a manual to walk you through it.
  3. Dave

    Retired Moderator

    Nov 17, 2003
    Can I suggest if you are genuinely interested in learning how to programme microcontrollers that you invest in a microcontroller and start working on programming an actual device.

    Personally, when i started programming microcontrollers I got hold of a PIC and made an I/O exerciser board and developed some simple programmes using assembly language. I then migrated onto programming the microcontroller in C, which is a much better way of developing programmes. I guess what I'm saying is start practically, and start from the bottom.

    If your interseted in taking the PIC route, have look at microchip's website, where there are lots of resources on how to program PIC microcontrollers and datasheets which include all the relevant information (about hardware as well as software) about the microcontroller of your choice. In addition you can download the free version of MPLAB IDE for developing and programming PIC programs in assembly language.
  4. atferrari

    AAC Fanatic!

    Jan 6, 2004
    Hola kamalakgkannan,

    Let's be practical. If you like to go the PIC way (my strong suggestion), here you have my suggestions, pretty much in line with what I did when starting with PICs, (after other micros):

    Download MPLAB - free IDE (Integrated Development Environment) from Microchip site. Heavy but consistent.

    Minimum Win ME or, better, XP. (Even if not recommended, older IDE 6.62 runs in my WIN98 PC, somewhat lousily but runs).

    Look for PIC tutorials, here:
    Nigel did a good job to offer consistent material for a start.

    If you can afford, buy the programmer from Microchip, PicStart Plus. Costly but always updated so you will not miss even the fancier new ones.

    Buy three 16F628. Why? Because:

    It's cheap

    It's full of peripherics

    Following basic procedure you can blink a LED (usual first test to see if you initialized it properly) easily.

    If you buy one, during the weekend (sure it will be in the week end) it will be burnt or damaged or you simply would want to have them handy for a two-micros application like IR wireles, or... (your choice). Anyway, I always buy three of any but have burnt just one 16C57 up to now.

    One advice that will save you many hours / days / weeks looking for "that bit", "this register" or "how to do this or that":

    "read the f***ing manual" (RTFM for short).

    If you enter the Microchip site and so many others, more than 40% of the questions are basic ones that could have been answered just by reading the manual in full, once.

    If you read first the generic manual (for the 16F628 would be the mid-range family manual), later, the specific one would be easier and you will find everything "familiar" to you.

    That will give a good insight and make you aware of what requires further study for every new application of the micro. Their manuals have no good indexes but once you get used to them it takes little time to find the point in question.

    Try to learn from the beginning how to initialize the micro properly. That caused many problems to me in the past, until I decided to approach it with a routinely strict procedure with excelent results. PM me if one day you like to get some advice.


    Assembler, BASIC or C.

    I don't program in C nor BASIC (for PICs) but yes in assembler. But, at least, for your first micro you should do in assembler to ensure that you know what are you dealing with.

    I know I've been wordy but the idea is trying to offer a minimal full picture.

    A ladder is climbed step by step and, starting with step one. Happy climbing! and ¡Buena suerte!