Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how control 16 LED with a pin of PIC uc?

Status
Not open for further replies.

mf1364

Full Member level 3
Full Member level 3
Joined
Dec 4, 2007
Messages
185
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Activity points
2,700
Hello every body
I want to control 16 LED with a pin of my PIC because I don't have extra pins and the others pin are busy so can you advice me any multiplexer IC that I can connect it to my PIC via SPI and turn on and turn off LEDs
 

Try MAX350. But what about SPI clock and all??
Use can also use serial to parallel shift register. But you need another pin to control the output.

Hope this helps.
Good Luck.
 
Last edited:
  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
Looks like there's quite a few interesting articles on that Smileys Workshop, thanks for the link Alex :)
 

If you only have one pin to spare then your going to need to use an asynchronous protocol such as RS232. You could have a second microcontroller that receives the Tx signal via UART and is dedicated to controlling your 16 LED's. Work out some basic protocol which you can send to the second micro to control the LED's.

If the free pin is not a dedicated hardware UART pin you will need to bit-bang the Tx signal. There should be plenty of sample code out there. You could possibly also use Manchester encoding such as is used in RC5 remote control transmissions. There a lot of code examples on here on how to decode these.
 
  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
You could use a CPLD. In CPLD side, there will be two inputs, one is from MCU and the other is from crystal as input CLK. You could define instruction from these two signals. Then you could control many LEDs.
 

Try MAX350. But what about SPI clock and all??
Use can also use serial to parallel shift register. But you need another pin to control the output.

Hope this helps.
Good Luck.
Thx but as I said I want a IC that have interface with micro just through one pin but as you know better than me in MAX350 we should connect 3 pins (DIN , SCLK , CS) and as I said before I have just 1 pin others are busy .please advice me a multiplexer IC with 1 pin contact
 

Thx but as I said I want a IC that have interface with micro just through one pin but as you know better than me in MAX350 we should connect 3 pins (DIN , SCLK , CS) and as I said before I have just 1 pin others are busy .please advice me a multiplexer IC with 1 pin contact

Actually your requirement in the first post wasn't very clear.
I want to control 16 LED with a pin of my PIC because I don't have extra pins and the others pin are busy so can you advice me any multiplexer IC that I can connect it to my PIC via SPI and turn on and turn off LEDs

Alex
 

  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
If you have one pin available you can use it for device select (SS) and connect the clock (SCLK) and data line (MOSI) in parallel since this is not a problem in SPI.
This can be done assuming that the SPI pins are already used with SPI and the mcu is the master

**broken link removed**
 
  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
....as I said I want a IC that have interface with micro just through one pin but as you know better than me in MAX350 we should connect 3 pins (DIN , SCLK , CS) and as I said before I have just 1 pin others are busy .please advice me a multiplexer IC with 1 pin contact

Your initial posting indicated that you have the SPI interface available, which is three pins not one. So which is it, do you have the SPI interface available or not?

There are I2C Port Expanders available as well, however the I2C interface requires two pins. They may exist, but I am not aware of a 1-Wire multiplexer.

BigDog
 

Thanks , dear friend but as I said I have just one pin and your solutions need at least 3 pins . do you know a Ic that can get commands trough PIC via just 1 pin and control LEDs . really need your helps

---------- Post added at 08:56 ---------- Previous post was at 08:53 ----------

If you only have one pin to spare then your going to need to use an asynchronous protocol such as RS232. You could have a second microcontroller that receives the Tx signal via UART and is dedicated to controlling your 16 LED's. Work out some basic protocol which you can send to the second micro to control the LED's.

If the free pin is not a dedicated hardware UART pin you will need to bit-bang the Tx signal. There should be plenty of sample code out there. You could possibly also use Manchester encoding such as is used in RC5 remote control transmissions. There a lot of code examples on here on how to decode these.
I think your solution is the nearest way for my request please give me example and schematic because I don't have any idea for applying your solution

---------- Post added at 09:00 ---------- Previous post was at 08:56 ----------

You could use a CPLD. In CPLD side, there will be two inputs, one is from MCU and the other is from crystal as input CLK. You could define instruction from these two signals. Then you could control many LEDs.
please explain more what is CPLD ? is it an IC ?

---------- Post added at 09:07 ---------- Previous post was at 09:00 ----------

Actually your requirement in the first post wasn't very clear.


Alex
as I said I don't enough pin , exactly one of my PIC pin is available so I ask you to advice me a IC that I can use it my project and drive LEDs , this IC should need just one pins of micro . I hope my explanation be completed .
 

....as I said I don't enough pin , exactly one of my PIC pin is available so I ask you to advice me a IC that I can use it my project and drive LEDs , this IC should need just one pins of micro . I hope my explanation be completed .

Use another PIC which has enough IOs and connect it to your main microcontroller via UART (if hardware UART is not available on that pin use software UART), use your own protocol to on/off LEDs connected to the second MC.

For example in 8bit data transmission first 4bits(0 to 3) to represent LED address (0 to 15 total 16nos) and next bit (4th bit) to represent the state. Do this if you have enough budget .

Hope this helps
Good Luck.
 
  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
As I said above and anandpv2009 says use a second micro which has enough I/O's to drive your LEDs, either directly or to control 74HC595, ULN2003 or any display IC.

As for schematic just look for any PIC UART projects but really you just need to use the Tx pin on your micro to connect to the Rx pin of the second micro and your done. Use the protocol suggested above or come up with your own, maybe with Xon, Xoff flow control for safety.

Just search for PIC Software UART if you can't use Hardware UART. Good Luck
 

If you have one pin available you can use it for device select (SS) and connect the clock (SCLK) and data line (MOSI) in parallel since this is not a problem in SPI.
This can be done assuming that the SPI pins are already used with SPI and the mcu is the master

**broken link removed**
thx, do you think , is there a shift register with 16 bit parallel out put ?
 

Hello every body
I made a mistake because as Alexan said I can use the free pin for CS and connect the clock and data pins of shift register to clock and data of my PIC , and now please introduce me 16 bit out shift register because it's decreasing the price and, please notice that I got right ? when I send 00000001b through SPI to shift register it makes the first pin 5v and other pins 0 volt ,right ?
 

when I send 00000001b through SPI to shift register it makes the first pin 5v and other pins 0 volt ,right ?

Yes that is correct but note that when you have 16-bit shift register you have to send 16 bits so that the new values are applied to all outputs, if you sens only 8 bits then the previous data will be shifted 8 times to the right.

Example

send 00001111
output 0000111100000000

then send 00000000
output 0000000000001111

so in order to apply a new 16 bit value you have to send 16 new bits so that the old outputs are shifted out completely.
The alternative is to reset the output and then send as many bits as you want but you don't have an additional reset pin available from the mcu so you can't apply this.

Any of the previously recommender solutions can be uses, it is up to you to choose.

Alex
 
  • Like
Reactions: mf1364

    mf1364

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top