LED Bargraph chip (guitar LED bling-age) ..do with a PIC?


Results 1 to 11 of 11

Threaded View

  1. #7
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Ok, my first attempt. I'm a beginner, so I welcome any comments towards a more efficient way of doing what I've just done (see code below)

    I'm using the Microchip low count board...which only has 4 LEDs - the code I've kludged together below works fine as I turn the potentiometer on the Low Pin Count Board.

    I don't think doing 'log' will be so tough after all (on account, there'll only be six LEDs involved when this is on the guitar, just a matter of tweaking with those individual thresholds to get it looking 'right').

    My next attempt will be to get a sample & hold vibe going down (which I'm thinking will just be some form of short 'pause' in each of those 'blocks' & some resistors/caps in series with the LEDs?)

    Code:
    Start:
    ADCIN 2, DC_In ; Read the DC level IN
    DC_In = DC_In /2 '256 is too much resolution...cut it down by 50%
    IF DC_In < 10 THEN
    low PortC.0 
    low PortC.1 
    low PortC.2 
    Low PortC.3
    endif
    IF DC_In > 25 THEN
    HIGH PortC.0 
    low PortC.1 
    low PortC.2 
    Low PortC.3
    endif
    IF DC_In > 55 THEN 
    High PortC.0 
    High PortC.1 
    low PortC.2 
    Low PortC.3
    endif
    IF DC_In > 85 THEN
    High PortC.0 
    High PortC.1 
    high PortC.2 
    Low PortC.3
    endif
    IF DC_In > 110 THEN
    High PortC.0 
    High PortC.1 
    high PortC.2 
    HIGH PortC.3
    ENDIF
    GOTO START
    end
    Last edited by HankMcSpank; - 10th July 2009 at 13:59.

Similar Threads

  1. Calulating BJT base resistance for PIC led switching?
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 20th November 2008, 08:41
  2. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 20:19
  3. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 14:28
  4. PIC chip resetting. Very weird
    By The Master in forum Off Topic
    Replies: 0
    Last Post: - 28th October 2007, 17:07
  5. Help on coding/ selecting PIC chip for project
    By lovemeok in forum General
    Replies: 0
    Last Post: - 27th July 2006, 19:21

Members who have read this thread : 0

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