Charlie-plexing


Closed Thread
Results 1 to 40 of 61

Thread: Charlie-plexing

Hybrid View

  1. #1
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Charlie! We were just talking about you.

    Quote Originally Posted by Charlie View Post
    Hi Robert - a couple questions / thoughts....
    I think you have too many resistors. With the original Charlie-plexing, there should be one current limiter per pin, not per diode, since some combinations rely on the forward volt drop of a diode to keep two others from coming on. I think what you did will work, but once you get beyond 3 pins, you may start having different intensities of LEDs. It would certainly save you some components to go per pin rather than per LED pair.
    Many LEDs on the same pin may be on, but only a single LED per pair can be lit.

    The tri-state properties of a pin control which LED is lit, not forward voltage drop. See Tip #2 in the Microchip PDF.

    LED intensity is not supposed to vary depending on active LEDs.

    Do the red and green diodes have the same volt drop? Green is usually about double red, so there will be still more challenges.
    Probably not, the LEDs I have in stock do not have identical properties. But they are close enough for personal use. I am compensating by using different light intensities; ie: I have varying intensities of LEDs for the same colour. Bulk purchases so I don't have specs.

    Is it your intent that something is green or red, but never off unless broken? I think that might be difficult to do too.
    I don't understand.

    The array will need to be constantly scanned if more than one led should be on at any given time. But you'll want to do that to save power, anyway.
    Yes, definitely scanning to save current.

    Have you done a big truth table to see what happens for each combination? You'll need that to write the code anyway, but it might save you a lot of work.
    Next on my TO-DO list.

    I don't think this is something that can be tested in a simulator easily since it depends on analogue effects.
    Anyway, very cool approach if you can work around those limitations!
    Yes it can be tested, this is digital only. But I don't have Proteus.

    Robert

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Here one I made earlier
    Name:  Xylon.gif
Views: 11913
Size:  210.2 KB

    Actually simulated, it's the display of a tidal state indicator that one day I'll get round to building. The Xylon effect is just to test all bits with the two elements separate.

    George

    N2 does work, just a slightly dodgy GIF
    Last edited by towlerg; - 14th December 2014 at 19:16.

  3. #3
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Quote Originally Posted by towlerg View Post
    ...Actually simulated, it's the display of a tidal state indicator that one day I'll get round to building. The Xylon effect is just to test all bits with the two elements separate.

    George
    Either you messed up recording your GIF, or there's a bug in the top row.

    And it's Cylon.

    Robert



    EDIT: It might also be an Internet Explorer thing, I'm still on XP on my laptop.
    Last edited by Demon; - 14th December 2014 at 20:14.

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    I can power pin 1:
    Name:  CharliePlex pin 1.GIF
Views: 11833
Size:  18.3 KB

    I can power pin 4:
    Name:  CharliePlex pin 4.GIF
Views: 11907
Size:  18.4 KB

    But I can't do the same thing at the same time, two unwanted LEDs come on:
    Name:  CharliePlex pins 1 and 4.GIF
Views: 12014
Size:  18.7 KB
    Edit: I just noticed I missed another unwanted LED between pins 4 and 2.

    I'll probably use a dedicated 18F24K22 running at 64MHz to manage the LEDs. I have to test, but blinking each LED individually might give enough persistence of vision (50 Hz or so).

    I was initially planning on powering all LEDs active on one pin, but that might complicate things beyond my limitted abilities. I like to keep things simple.

    I might also manage a simple keypad, not sure yet. I have enough pins, but tests will show how much the PIC can manage and still give satisfactory visual effects.

    Robert
    Last edited by Demon; - 21st December 2014 at 01:10.

  5. #5
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    As I sit down to think how to manage this, one MAJOR drawback:

    You had better not forget any LEDs on your project 'cause adding one later is going to be "troublesome".

    You can always add it at the bottom of your truth table, but I'm the obsessive compulsive type that likes symetry; LEDs are handled in the logic as they are placed on the circuit board. Remnants of hating spaghetti code on mainframes (COBOL + GOTO = NIGHTMARES).

    Robert

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Some neat stuff I forgot that I found several years ago on Charlie-plexing.

    Code:
    clear
    define osc4
    cmcon0=7
    ansel=0
    adcon0 = 0
    @ device mclr_off
    @ device wdt_off
    @ device bod_off
    @ device cpd_off
    @ device protect_off
    
    led var byte
    ledstates var byte
    trisstate var byte
    delay var word
    noghost var byte
    gpnoghost var byte
    
    noghost= %111111
    delay= 1500
    
    starthere:
    gpio.3 = 0
    if gpio.3 = 1 then
      goto main
    endif
    goto starthere
    
    main:
    for led = 1 to 6
      select case led
        case 0 : ledstates =%001 : trisstate =%100
        case 1 : ledstates =%010 : trisstate =%100
        case 2 : ledstates =%001 : trisstate =%010
        case 3 : ledstates =%100 : trisstate =%010
        case 4 : ledstates =%100 : trisstate =%010
        case 5 : ledstates =%010 : trisstate =%001
        case 6 : ledstates =%100 : trisstate =%001
      end select
      trisio = noghost
      gpio = ( gpio & %111000) | ledstates
      trisio = (trisio & %111000) | trisstate
      pause delay
    next led
    
    for led = 1 to 5
      select case led
        case 1 : ledstates =%000001: trisstate =%101110
        case 2 : ledstates =%011000: trisstate =%101110
        case 3 : ledstates =%000010: trisstate =%101101
        case 4 : ledstates =%010000: trisstate =%101101
        case 5 : ledstates =%000010: trisstate =%011101
      end select
      trisio = noghost
      gpio = ( gpio & %111000) | ledstates
      trisio = (trisio & %111000) | trisstate
      pause delay
    next led
    
    trisio=noghost
    gpio=gpnoghost
    
    goto starthere
    end
    Name:  Multiplex pins schematic.GIF
Views: 12190
Size:  11.8 KB
    Editted to add some colour, original was black on light gray background.

    I wish I could give a link and credit, but I can't find anything on google for this now (been looking for over an hour).

    Robert
    Last edited by Demon; - 14th December 2014 at 21:42. Reason: Added code instead of PDF

  7. #7
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Did this a while ago. Don't know if it will help. http://www.picbasic.co.uk/forum/showthread.php?t=14220

    If you use the above program you'll need to change you define osc line.

    Good luck.

  8. #8
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Demon and AvionicsMaster1
    Thank you for the information.
    I will try your suggestions though I think typing OR seems the easiest.
    Regards
    Jim

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    I will try your suggestions though I think typing OR seems the easiest.
    Though it looks cool to use those symbols I think it's easier just to type OR and know what it means
    .


    NOT sure about that , this is what the book says


    3.4.2 Logical vs. Bitwise

    Logical operators are very different than bitwise operators! There are

    circumstances under which PBP will allow the use of logical operators in
    expressions. This means that no error message will be generated when you
    mistakenly use a logical operator in a bitwise calculation. Consider the following:
    result = PORTB AND %00001111
    ' Returns logical result (1 or 0)
    The above example will compile and give a result. The value of the result can only
    be one or zero (true or false). If the intent is to use a bitwise operation to obtain a
    binary result, you MUST USE BITWISE OPERATORS:
    Code:
       i_term=0
       d_err=4
       i_err= 3 
       i_term= i_err |  d_err
       serout2 PORTA.0,84,[ "3 | 4 ",9,#i_term, 13,10]
       i_term= i_err OR d_err
       serout2 PORTA.0,84,[ "3 OR 4 ",9,#i_term, 13,10]
    PRINTOUT:
    3 | 4 7
    3 OR 4 65535
    Last edited by richard; - 29th June 2016 at 04:36.
    Warning I'm not a teacher

  10. #10
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Richard
    Looking at the PBP3 Compiler Manual it only shows OR as the description for
    | in the Bitwise operators. It does show OR as an operator in the Logical operators.

    Regards
    Jim

  11. #11
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Logical operators are not bitwise operators
    | does a bitwise OR
    OR does a Logical OR

    2 | 3 = 7
    2 OR 3 = ! 0 [ not nothing ]

    Warning I'm not a teacher

  12. #12
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Charlie, about the red-or-green-or-broken question. I can light the red, green or nothing at all if I wish (which is possible in this application).

    I am powering only one pin at a time. Due to the interconnections on the matrix, applying power to more than one pin will have undesired results.

    Pass 1:
    "1" on pin 1, "0" on pin 2, Input remaining pins lights the top left red LED.

    Pass 2:
    "1" on pin 4, "0" on pin 3, Input remaining pins lights the top green LED between pins 3 and 4.

    But...

    Pass 3:
    "1" on pin 1, "0" on pin 2,
    "1" on pin 4, "0" on pin 3, Input remaining pins lights the top left red LED and the top green LED between pins 3 and 4,
    but it also lights
    a red LED between pins 1 and 3 and
    a green LED between pins 4 and 2
    since those circuits are also completed unintentionally.

    Robert

  13. #13
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Richard
    Thank you for the information, seems I have a lot to learn.
    I have been reading up on Bitwise in the PBP Compiler Ref manual.
    Can't find out how to type in the OR operator, doesn't appear to be on my keyboard.
    Anyway I'll keep on reading and see if I can make sense of it.
    Regards
    Jim

  14. #14
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Jim,

    If you can't type | using SHIFT, go through again with ALT.

    Edit: or come here and COPY the character and then PASTE it in your code.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  15. #15
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Depending on the keyboard the | character doesn't look like it on your keyboard. Never could figure out why they do this but it's above the ENTER key and is accessed by using SHIFT and the \ key. It looks like a vertical line separated by a space in the middle. I thought in old programming terminology it's called the pipe symbol.

    Though it looks cool to use those symbols I think it's easier just to type OR and know what it means.

Members who have read this thread : 7

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