LED flasher

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
I am new and just learning things. I have a project which I first built using a 555 timer circuit. now I would like to try building it with a microcontroller.
The project is to have an LED flasher with an option 10 different frequencies and
and an option of 5 different periods of time that it will run for, before repeating or resetting the frequency or time.
I am totally new I have downloaded swordfish. I would like to know where I can find information on how to learn the code and find all the different things i will need for this project
 

donpetru

Joined Nov 14, 2008
185
First you must decide on a microcontroller (PIC or Atmel) and then learn a programming language (Basic, Pascal or C / C++). Then you have to choose a program to compile and last but not least, to know how to interpret a microcontroller datasheet. These four steps are required for fine experiences in the field of microcontrollers and an application approach, like the one above, takes time and money.
So, it is not that simple!
 

Shagas

Joined May 13, 2013
804
Interpretting 250-page MCU datasheets is a pain .
I'm still trying to figure out how to use interrupt registers , can't find a decent tutorial on it.
 

Potato Pudding

Joined Jun 11, 2010
688
For an LED Flasher mcu trainer combo, you might look at the pickit2 debug express with 44pin Demo board.

You get a programmer and a PIC16F887 dev board with some surface mount LEDs on it.

The Lessons/demos for that dev board will take you almost to your expressed goals, but leave you room to customize your circuit and code.

There are many things you might want to consider before you start.
Some of these are very important. One of these is that you use the mcu for control but there should be little if any current sourced or sunk by the mcu.

I would try to stay below 10mA per pin. Anything more than that and you need to understand how simple it is to control a $0.02 transistor switch with less than that 10mA current and drive power hungry devices like LED's easily and more directly.

If you are coming from the generous drive ability of a 555 timer, that makes mention of current capacity for an MCU seem like a good idea.

Otherwise there is the coding aspect. ASM; assembler type code is practically deprecated. The advantage for a person just learning is that you get a strong connection to the timing of the code. C-code is more complex, which makes it simpler. It is the difference between pointing at a jug of water and miming taking a drink, versus saying "I want some water, if you don't mind passing me that pitcher over there. Thanks." Or you could hex code which is like lurching over to grab the pitcher and pouring it down your throat.

If you look at the datasheets for your target MCU they will provide the instruction set. That instruction set will typically be given in ASM and Hex OP codes. Buuuuut... those same data sheets will often have example code to help demonstrate usage of peripherals. Those examples are sometimes in ASM, sometimes in C- Code, and sometimes in both, and-or in HEX.
 
Last edited:

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
Thank you for that I will get the pickit2 debug express with 44pin Demo board.
Is it possible to have a stand alone finished project so that once it is programmed it no longer needs to be connected to a computer?
 

bance

Joined Aug 11, 2012
315
Yes, the demo board is just a development platform....

It's an easy way to start working with MCU's because the circuit is set up for you and guaranteed to work if your code is good. Usually the pins are broken out via jumper switches, so you can change what is operated by each pin.

There is usually some example code supplied also.

Once you become more familiar with working with MCU's you will move onto using In Circuit Programming which is most probably the way you will programme your stand alone project. The computer is only required to write the code and transfer it to the MCU.

HTH Steve.
 

absf

Joined Dec 29, 2010
1,968
now I would like to try building it with a microcontroller.
The project is to have an LED flasher with an option 10 different frequencies and
and an option of 5 different periods of time that it will run for, before repeating or resetting the frequency or time.
How about this? Would this work? The AVR version should be similar.

The LED can be replaced with a 2x16 LCD which would take 6 wires. There can be two outputs: one for frequency and one for period. The 2 outputs can be ANDed together to form one output. That way I think would be easier to code.

Next, would be the software. See how soon you are able to write the software to fulfill your need if you start learning PIC/AVR now.

Allen
 

Attachments

Last edited:
yeah its correct first u have to decide on a microcontroller its maybe 8051 , or PIC or AVR and then learn a programming language Embedded "C".I thing for this LED flasher 8051 is enough. you must choose timer option here for LED flash. If u have to choose like 8051 you must enable the TMOD register for timer operation. Its a 8 bit register upper four bits for Timer 1 and lower four bits for Timer 0.Here the main bit GATE bit.this is decide controller operation may be controlled by s/w or H/w.



BacklinksVault
 
Last edited:

Shagas

Joined May 13, 2013
804
Then get an Arduino and don't get a PICkit unless you plan on using PICs.
You must have confused someone else's post with mine . I never said I have a PICkit.
I've got an AVRISPMkii and some avr MCU's
It's going fine and I like it , but I still haven''t figured out how to use the more advanced registers but.... i'm guessing there is no secret to this , just learning and practicing and more learning and more practicing
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
Hi looking at all these different options I think I will go ahead and order my pickit.
But could someone let me know the difference between pic's, mcu's, avr's, 1851?
 

Shagas

Joined May 13, 2013
804
MCU = mictrocontroller unit , i'f i'm not mistaken.

I started a week ago with AVR. Apparently there is not much diffrence in Pic and AVR for a beginner , or at least that's what everyone says.
 

bance

Joined Aug 11, 2012
315
They are all micro-controllers, just from different manufacturers....

There are many different kinds but they all fulfil the same role, each family have various models, which may contain different peripherals and/or bus widths (8 bit, 16 bit, 32 bit etc.)

There is also Arduino and TI msp430 among others....

You would be best to start with one and stick with it until you are quite familiar with it, then you can try different ones....

Also, although a development board is useful to start with, (for the reasons I mentioned in a previous post) you may wish to start with a slightly less complicated PIC. The 16f887 has many peripherals and requires some setting up before use, (as you will discover.)

Gooligum has some very useful tutorials and also sell a dev board.... You may feel that is a better way to go as a complete beginner. Of course you will get lots of help from people on the various forums, So have a good look around before making any descisions. Most importantly have fun!!!!:D

The Gooligum board is just that, there is no programmer, so you would still need a pickit2 or pickit3. of course you could just use a breadboard if you feel confident enough to make your own circuits all you need is a couple of caps, a crystal and a resistor or two.
 
Last edited:

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
thank you I have sent of for the pickit2 so I will start with that but I will also look at gooligum. I am sure it will all open up as I learn things. I am already enjoying my journey into electronics and intend to continue doing so.
 

Thread Starter

lotusmoon

Joined Jun 14, 2013
227
should I have got pickit 3 rather than pickit 2 as I could probable exchange them. or is it best to start with pickit2 and work up to pickit 3? I want to make a LED flasher with several frequency options and time options and am a total beginner.

later I would like to go on to having LCD showing the frequencies and times I think this may be more complicated would pickit2 cover this?
 
Last edited:
Top