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 AvionicsMaster1
    The schematic is not really a schematic just a drawing to sort out the CharliePlex. There are 100 Ohm resistors on each pin.
    The spaces in the lookup didn't seem to make any difference to the running of the program but I will try it without them.
    Almost all of the code is from Richard and even with very slight errors i am finding it very instructive.
    thankyou for your observations
    regards
    Jim

    So Richard when I see 12 in the t,p column I am really looking at TRIS or PORT 1100 and 7 will be 0111 ?
    Regards
    Jim

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


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    So Richard when I see 12 in the t,p column I am really looking at TRIS or PORT 1100 and 7 will be 0111 ?
    yes the tris and port columns are binary 0b1100=0xC = 12 or pbp parlance %1100=$c=12

    this is where i was heading for the led cube , current irq rate is 1000 Hz to drive 64 leds that needs to 5 times faster
    this codes flashes all the odd leds for 1 sec and then all the evens then repeats

    Code:
    '****************************************************************
    '*  Name    : charlieplex.pbp                                        *
    '*  Author  : richard                                   *
    '*  Notice  :                                *
    '*          :                                *
    '*  Date    :                                          *
    '*  Version :    16f1825     @3.3 volts                               *
    '*  Notes   :       *
    '*          :              *
    '*            
    '****************************************************************
      
    #CONFIG
                 __config        _CONFIG1,    _FOSC_INTOSC & _CP_OFF & _WDTE_ON  &  _PWRTE_ON  &  _MCLRE_ON  & _CLKOUTEN_OFF
                  __config      _CONFIG2, _PLLEN_ON & _LVP_OFF
    #ENDCONFIG
    
    DEFINE OSC 32
     
     include "dt_ints-14.bas"
     Include "REENTERPBP.bas"
     
    
    asm      
    INT_LIST macro     
          INT_HANDLER TMR1_INT, _TOCK, PBP ,YES
          
          endm
           INT_CREATE
    ENDASM       
          
           
       
         
    @timer1 =TMR1L
    leds var word
    tmp var byte
    x var byte
    timer1         VAR WORD EXT
    timer1=15543
    T1CON=$31
    @ INT_ENABLE  TMR1_INT
    OSCCON=$70
    ANSELA=0
    ANSELC=0
    
       
    mainloop:
    leds=1365    
    pause 1000 
    leds=2730
    pause 1000  
    goto mainloop  
     
       
        
         
      
    TOCK:
    T1CON.0=0
    timer1=timer1+64536
    T1CON.0=1
    if leds.0[x] then
        lookup x,[12,12,9,9,3,3,5,5,6,6,10,10],tmp
        TRISC =(TRISC&$f0)|tmp
        lookup x,[ 2, 1,4,2,8,4,8,2,8,1 ,4, 1],tmp
        latC =(latC&$f0)|tmp
    endif
    x=x+1
    if x=12 then x=0
    @ INT_RETURN
    Last edited by richard; - 21st June 2016 at 14:46.
    Warning I'm not a teacher

Members who have read this thread : 3

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