Help on write source code.

Discussion in 'Programmer's Corner' started by ron roberts, Jan 17, 2010.

  1. ron roberts

    Thread Starter Active Member

    May 7, 2008
    Is there any good websites out there on programming microcontrollers?
    I’ve see a lot on the web but most of them just explain about the microcontrollers and how it works and how to program it with a HEX file with a pacific piece of software.
    I won’t to understand a lot more on how to write the instructions (source code) don’t get me wrong I have wrote simple instructions before but nothing taxing. I’ve paid for more complex programming in the past but I would like to program something along the lines of a MIDI control device.

    So what am I trying to achieve?

    MIDI to Parallel Conversion Bridge between any MIDI standard controller and any device capable of being controlled electrically by on/off switches is my aim so I can use it in applications such as: Player pianos or a pipe organ.

    Any help. Thanks

    P.S please don’t just say go back to school I know that.

    That’s what I got when I last asked the above on the last forum I joined a long time ago, never been back since.
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    Did you have a microcontroller in mind? Some microcontrollers compilers allow you to use BASIC some use C and so on. If you have a brand you would like to learn, that would help up help you.

    The PARALLAX BasicSTAMP will allow you to program the chip using their version of BASIC. Quite easy to understand. Easy to learn, yet still very powerful.
  3. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    Sounds to me like you want to learn how to program first.

    If you have never programmed before then forget about microcontrollers for a little while. It is too much for you to learn.

    Learn how to program first. BASIC and Pascal are two very easy to learn programming languages. You should be able to find free compilers for these languages and tons of websites.

    It sounds looks to me like English is not your first language to you should try to find a website in your own language. It is hard enough to learn programming, I can't imagine how hard it must be to learn it in a language that is not your first language. Maybe you can find books at your local library. They don't need to cover microcontrollers. Just Pascal or Basic.

    Once you get to know Pascal or Basic, you can move on to microcontrollers. MikroElektronika has compilers in Pascal, BASIC and C.

    Good luck!
  4. hgmjr

    Retired Moderator

    Jan 28, 2005
    Do you have a specific microcontroller in mind?

  5. ron roberts

    Thread Starter Active Member

    May 7, 2008
    I’ve always thought my self a quick learner, I must confess I usually work backwards to most, i.e. I see the end product and back work it in my mind then I usually completely understand how it works then i would be capable of designing one from scratch.

    I understand how microcontrollers work and some of the differences between different microcontrollers, but understanding how to set down the instructions is where I’m lost. I’ve seen loads of HEX files but only 3 or 4 codes and it just don’t make any sense (yet) if only one could find a set of codes for a particular microcontroller.

    I.e. something like
    0Dah: this would make the out put go low.
    0ah: this would make the out put go high.
    And so on.

    I know it’s probably not that straightforward but there must be a set of commands to start from. I do under stand some of it like this one below.

    msg1 db "enter a number or any other character to exit: $"

    I’m assuming that: msg would display a message.

    The 1 would be the first message it comes across.

    The first " would be the start of text to be displayed.

    Then the message: enter a number or any other character to exit.

    The second “ would be the end of the text to be displayed.

    I think the $ is where one would enter a number from 1 to 9.

    What’s the db for and what does it do.

    Sorry for boring you all but I’m at a los with this program writing now.
    It just reminds me of writing a game for my old BBC atom computer in the 80’s.
  6. ron roberts

    Thread Starter Active Member

    May 7, 2008
    The members on this forum are quick to respond. Sorry my last post will look as I hadn’t seen all the responses since my first post, well I didn’t, I left my computer on the page after I submitted my first post then went for my tea came back and typed and submitted the above post sorry.

    Anyway thank you all for your input.
    I’m from the UK I’m just a bit lazy when typing; it comes from years of texting.

    hgmjr & retched
    I was thinking of concentrating on AVR Atmel probably ATmega168. I’ve never programmed one with my own work.
    The only microcontroller I’ve programmed with my own work is a pic16f84.
    Last edited by a moderator: Jan 17, 2010
  7. retched

    AAC Fanatic!

    Dec 5, 2009
    If your looking to do some LED stuff and some breadboarding, get a development board. A good one to get is Arduino. It uses the amtel ATMEGA328. It has a built in USB access and 9v power regulator on board. The board has 3.3v and 5v ready to power your projects. All for ~30$us.
    Arduino has a VERY active community and the chips can be programmed in C. So no messy HEX or Assembly.

    A good place to pick one up is: for 55pounds a whole starter kit with breadboard, leads, and 10 experiments including leds, motors, servos, temperature sensor, and much more:
    and information on programming them:

    The kit includes:
    Arduino Prototyping Bundle (Arduino Duemilanove board (328), breadboard & acrylic holder)
    75 Piece Jumper Wire Bundle
    Printed 29 page Experimenter's Guide
    11+1 Breadboard Layout Sheets
    USB Cable
    Multi-compartment Plastic Storage Box
    9v Battery - Arduino Adapter
    Loads of components
    5mm Red LEDs (x10)
    5mm Green LEDs (x10)
    10mm Red LED (x1)
    Toy Motor (x1)
    Mini Servo Motor (x1)
    8-Bit Shift Register (74HC595) (x1)
    Piezo Element (x1)
    Pushbuttons (x2)
    Potentiometer (10k) (x1)
    Photo Resistor (x1)
    Temperature Sensor (TMP36) (x1)
    Relay (5v DPDT) (x1)
    Transistors (2N222A) (x2)
    Resistors (560 Ohm x25, 2.2k Ohm x3, 10k Ohm x3)
    Diodes (1N4001) (x2)