Single PIC to Blink 5 LEDs Independently?


Closed Thread
Results 1 to 40 of 69

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    If the array is 0-based then it should be this:

    OnTime(7) = PRI_HULL_LGHTS_ON_MS
    OffTime(7) = PRI_HULL_LGHTS_OFF_MS

    Oh, man - a real newbie mistake. Thanks Steve!

  2. #2
    Join Date
    May 2006
    Location
    Del Rio, TX, USA
    Posts
    343


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    Been there, done that, missing hair to prove it!

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    That was it, all right. Code works as expected - no need to switch back to PORTB.1(x). Now all I have to do is add the interrupt and handler.

    Thanks again, Steve - I poured over that code at 12:30 am last night but didn't spot that index error.

  4. #4


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    This may not be the right place to ask a technical question about the PIC 16F88 chip, but I thought I'd start here.

    I've got the prototype working and have been focusing on the schematic/board layout to finish this project (finally). After getting back some test PCBs for the blinking LEDs, I noticed that the 5 steady on LEDs connected to PORTA.0 via a 2N2222A transistor are not as bright as the other 5 blinking LEDs connected to PORTB.1-6 (note that PORTB.0 is needed for a button and that PORTB.7-8 are used for other blinking lights). I've looked over the datasheet for the PIC 16F88 but I'm a bit confused by the current limitations on page 163 (18.0 Electrical Characteristics). I had hoped that by using a 10k resistor between the 16F88 pins and the base of the 2N2222A that I could sink more current and hence drive more LEDs (PORTA.0 will ultimately need to drive 10 LEDs (5 per side of the model - total of 200mA for PORTA) while each of PORTB.1-6 will drive 2 LEDs (total of 200mA for PORTB). I see that it says 'Maximum current sunk by PORTA/B: 100mA' but I thought that a transistor (maybe a MOSFET?) would work.

    Am I dreaming here? Do I need to look for some other solution? I'd hate to move away from this single chip utilizing Darrel's most elegant code.

    PBP Code: Formation_Running_Engine_Lights_16F88_4Mhz_Ext_FINAL.txt

    Eagle Schematic: SE66_Main_Brd.pdf

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,132


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    I am not sure that I understood what you want to do. But looking on your schematic, I really do not think that is a good idea to have a pot drive the collector of the 2N2222 and then the transistor drive a load of 200mA. It is not good practice.

    If you need to control the power to your load, then a PWM controlling the base of the transistor is sure more appropriate.

    Ioannis

  6. #6


    Did you find this post helpful? Yes | No

    Default Re: Single PIC to Blink 5 LEDs Independently?

    I got the design from another source. The idea was to provide a way to control the brightness of the LEDs without having to have the trim pot inside the model (the PCB will be in a base for easy access).

    The trim pots work great for all the other instances, just not the 5 steady-on LEDs. Also, I cannot use PWM in this code at all - it completely throws off the blinking algorithm created by Darrel.

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. How to blink 8 LEDs at different rates- concurrently?
    By rmteo in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 26th April 2010, 23:47
  3. single sided PCB
    By schu4647 in forum General
    Replies: 1
    Last Post: - 10th December 2008, 18:22
  4. Can't Blink 2 LEDs
    By dfort in forum mel PIC BASIC
    Replies: 2
    Last Post: - 5th March 2008, 22:36
  5. Tx and Rx of Single Pin PIC's
    By Dwayne in forum Code Examples
    Replies: 0
    Last Post: - 26th May 2004, 14:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts