Lighting LEDs

Discussion specific to the 24-pin ZX microcontrollers, e.g. ZX-24r, ZX-24s and ZX-24t.
Post Reply
abcuser
Posts: 13
Joined: 26 March 2008, 20:21 PM

Lighting LEDs

Post by abcuser »

I like to know is there any way to output a voltage of 2.5volts on Pins 5,6 and 7 to light up 3 LED's on the zx24a.
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Lighting LEDs

Post by dkinzer »

abcuser wrote:I like to know is there any way to output a voltage of 2.5volts on Pins 5,6 and 7 to light up 3 LED's on the zx24a.
Being a digital device, there is no way to output a particular voltage other than logic 1 and logic zero.

That said, it is relatively easy to drive LEDs. Unless you have some special type of LED, you illuminate an LED by driving it with a certain current - the higher the current, the brighter the output (being careful not to exceed the maximum allowable current). I find it convenient to drive LEDs by connecting the anode to a current limiting resistor, the other side of which is connected to a +5V, and then connecting the cathode to an I/O pin. To illuminate the LED, the the I/O pin to logic 0 and current will flow. Setting the I/O pin high will turn off the LED.

You calculate the size of the current limiting resistor by the equation below.

Code: Select all

Rlimit = (Vcc - Vf) / Iled
where Iled is the current that you want to flow through the LED and Vf is the "foward voltage" drop across the LED at that current. These values are obtained from the datasheet for the LED.

If you can provide a link to the datasheet for the LED in question we may be able to provide more specific information. Also, it would be helpful if you would explain why you believe that you need 2.5 volts.
- Don Kinzer
abcuser
Posts: 13
Joined: 26 March 2008, 20:21 PM

Post by abcuser »

It worked, thanks. I did it using resistors
Post Reply