Charlie-plexing


Closed Thread
Results 1 to 40 of 61

Thread: Charlie-plexing

Hybrid View

  1. #1
    Join Date
    Jun 2016
    Posts
    19


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Hi Richard
    No problem I managed to correct it and also the two in your pairs section.
    I thought they were deliberate to make me work HaHa.

    Code:
    '****************************************************************
    '*  Name    : charlieplex.pbp                                        *
    '*  Author  : richard                                   *
    '*  Notice  :                                *
    '*          :                                *
    '*  Date    :                                          *
    '*  Version :    16f84A                                   *
    '*  Notes   :       *
    '*          :              *
    '*            
    '****************************************************************
    #CONFIG
    cfg = _XT_OSC
    cfg&= _WDT_ON
    cfg&= _PWRTE_OFF
    cfg&= _CP_OFF
      __CONFIG cfg
    #ENDCONFIG
     define osc 10
    led var byte
    tmp var byte
    
      
    ' tris port
    '1 1100 0010    12,2
    '2 1100 0001    12,1
    '3 1001 0100    9,4 
    '4 1001 0010    9,2
    '5 0011 1000    3,8
    '6 0011 0100    3,4
    '7 1010 0100    10,4
    '8 1010 0001    10,1
    '9 0101 1000    5,8
    '10 0101 0010    5,2
    '11 0110 1000    6,8
    '12 0110 0001    6,1
     
       
    mainloop:
        
        for led=0 to 11
            lookup led,[12,12,9,9,3,3,10,10,5,5,6,6],tmp
            TRISA = $f0|tmp
            lookup led,[ 2, 1,4,2,8,4, 4, 1,8,2,8,1],tmp
            PORTA = tmp
            pause 400
        next
        for led = 0 to 11
            lookup led,[12,9,3,10,5,6,6,5,10,3,9,12],tmp
            TRISA = $f0|tmp
            lookup led,[ 2,4,8, 4, 8,8,1,2,1,4,2,1],tmp
            PORTA = tmp
            pause 400
        next 
        
    ;leds 2,9
       tmp=255
    while tmp
        TRISA = $f0|12
        PORTA = 1
        pause 5
        TRISA = $f0|5
        PORTA = 8
        pause 5
        tmp=tmp-1
     wend
     
    ;leds 10,12 
        tmp=255
    while tmp
        TRISA = $f0|5
        PORTA = 2
        pause 5
        TRISA = $f0|6
        PORTA = 1
        pause 5
        tmp=tmp-1
     wend
     
    ;leds 4,8
       tmp=255
    while tmp
        TRISA = $f0|9
        PORTA = 2
        pause 5
        TRISA = $f0|10
        PORTA = 1
        pause 5
        tmp=tmp-1
     wend
     
    ;leds 7,11 
        tmp=255
    while tmp
        TRISA = $f0|10
        PORTA = 4
        pause 5
        TRISA = $f0|6
        PORTA = 8
        pause 5
        tmp=tmp-1
     wend 
    goto mainloop
    Hope you can run the above.
    I do have a problem with one of the three columns.
    I'm okay with the TRISA and PORTA columns but I am having difficulty sorting the 3rd one t, p.
    Some of the numbers fall okay with regard to tris and port but others do not. I must be looking at it wrong.
    I am presuming the t stands for tris and p for port, am I right?
    Regards
    Jim

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,666


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    led__tris____port___ t______p
    1___1100___0010__12__,__ 2
    yes t and p are tris and port in decimal form for us humans

    i can't run your code exactly my setup is wired differently to yours and different to my drawing too it appears
    hence my muddled led 11 , any of the others may may be mislabled also . i was just happy to get the leds lit up , its to jumbled up to rework it.


    i have never tried charlieplexing before, looks like the leds need to lit 15 to 20 at least times per second to minimise flicker. i was going to try a 4x4x4 charlieplex led cube but i'm having doubts now about driving 64 leds @ 20hz and having enough cpu time left to do anything else without using a pic18
    Warning I'm not a teacher

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


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    Couple of things. In your schematic I don't see any current limiting resistors at each pin. They are necessary. When defining the oscillator speed osc needs to be OSC. I think the spaces in your lookup table are some of the problem. Try removing them and see what happens.

Members who have read this thread : 2

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