Choosing a microcontroller

Thread Starter

WVU Engineer

Joined Jan 18, 2008
15
Hello,

Beginning a project where i wish to create a simple display of leds. I am going to have a ring of led's which are initially going to be all off. Then i wish to make it so they all light up, one at a time until all lit, then all go off one at a time, and keep repeating this process. I read in another forum that someone suggested a microcontroller. I have been using them in my lab classes, and am aware of how to program them in assembly, as well as C. My question is, i do not know how to select one. My last question is, once it is programmed, it is going to need a constant voltage source to retain the program, correct? so how do i go about programming one chip without loosing the program, until i get it into place?

Thank you
 

nanovate

Joined May 7, 2007
666
I'd recommend the Atmel AVR. The tools are pretty cheap and (half price if you are a student). The WinAVR compiler is free and is industrial strength -- commercial grade. Take a look at the following for more information:

www.avrfreaks.net
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=index

(please read the guidelines though since "Which is better PIC vs AVR" questions can start a flame war)

My last question is, once it is programmed, it is going to need a constant voltage source to retain the program, correct?
Nope, they should retain their program without power applied. So you can program it then install into the circuit.

What does WVU stand for?
 

Dave

Joined Nov 17, 2003
6,970
(please read the guidelines though since "Which is better PIC vs AVR" questions can start a flame war)
There has been an extensive discussion on the PIC Vs AVR debate: http://forum.allaboutcircuits.com/showthread.php?t=2601

Personally I use PICs, however this is not so much based on technical need, more my personal preference for familiarity. Several members here advocate the AVR family of uCs.

Dave
 

Dave

Joined Nov 17, 2003
6,970
And I am the Cypress PSoC guy :) And when it doesn't have the power, I use a Spartan 3 FPGA with a soft processor and surrounding HDL.

Steve
I too can wholeheartedly recommend Spartan-3s, but whether it is appropriate as an alternative suggestion to a dedicated uC is another thing. We've just started looking at using the new Xilinx DSP dedicated devices - should be interesting.

Dave
 

mik3ca

Joined Feb 11, 2007
189
Hello,

Beginning a project where i wish to create a simple display of leds. I am going to have a ring of led's which are initially going to be all off. Then i wish to make it so they all light up, one at a time until all lit, then all go off one at a time, and keep repeating this process. I read in another forum that someone suggested a microcontroller.
microcontrollers are good, but they must be programmed in order to do an excellent job.

If you use decade counters, XOR gates, and proper logic, you can pull the same thing off, and no programming will be necessary.

I have been using them in my lab classes, and am aware of how to program them in assembly, as well as C. My question is, i do not know how to select one.
First, compile your code that you want to feed into the micro. you might get an intel HEX file. check the size of the compiled file (probably your HEX file), and that should be the maximum amount of bytes you will need.

get a micro that has an EEPROM or flash ROM built into it. if your HEX file is 1234 bytes, a micro with 2K will work. If I only wanted 2K, I go with Atmel's AT89C2051. Next determine how many LED's you want to deal with. Also, determine your space constraints. If you are using 16 LED's and you have a small board space, you are better off going with a 40-pin microcontroller since it has more I/O pins. If you have alot of board space, add some latches to the I/O pins, and have another I/O pin control the latch enable pin, so you can connect even more LED's.

Look at the datasheet, your environment, and your item restrictions/needs, The datasheet will have the majority of your answers.

My last question is, once it is programmed, it is going to need a constant voltage source to retain the program, correct?
If you are programming into an EEPROM, PROM, EPROM, or FLASH ROM chip, then you don't need to leave the power on. If you are just writing to RAM, then yes, you do need to leave the power on.
 

Thread Starter

WVU Engineer

Joined Jan 18, 2008
15
If i wanted to use basic chips instead of a microcontroller and i wanted a string of 43 LED's. What would be the best way to go about this? Would i just have to find some way to cascade 4 different decade counters together... Or i am i just thinking about this way to much and there is an easier way (without a microcontroller).
 

mik3ca

Joined Feb 11, 2007
189
You connect the outputs of the two counters together through XOR gates where Q1 of counter 1 and Q1 of counter 2 is connected through an XOR gate, Q2 and counter 1 and Q2 of counter 2 is connected through an XOR gate.

the outputs of the XOR gates go to the LED's.

since you want the number of "on" LED's to increase as the count continues, you would also want to connect the higher Q output to the lower Q output through diodes.

now play with the count pin of the counter. when you use any one counter, the LED's turn on. Each one turns on every time the count pin goes from low to high (and/or vice versa). as soon as you do the same to the other counter, the LED's that were on go off. The reason for this is because of the XOR gates. Remeber, an XOR gate gives a logic high only when an input is a logic high.
 
Top