Charlie-plexing


Results 1 to 40 of 61

Thread: Charlie-plexing

Threaded View

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


    Did you find this post helpful? Yes | No

    Default Re: Charlie-plexing

    led 11 failed cause i had a typo and did not convert from my setup to yours properly , sorry



    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,4   '   typo here
    '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,4,1],tmp   ;  and here
            PORTA = tmp
            pause 200
        next 
        
    ;leds 2,9
       tmp=255
    while tmp
        TRISA = $f0|12    ;  and here
        porta = 1    ;  and here
        pause 10
        TRISA = $f0|5    ;  and here
        porta = 8    ;  and here
        pause 10
        tmp=tmp-1
     wend
     
    ;leds 10,12 
        tmp=255
    while tmp
        TRISa = $f0|5    ;  and here
        porta = 2    ;  and here
        pause 10
        TRISa= $f0|1    ;  and here
       porta = 1    ;  and here
        pause 10
        tmp=tmp-1
     wend
     
    ;leds 4,8
       tmp=255
    while tmp
        TRISa= $f0|9    ;  and here
        porta = 2    ;  and here
        pause 10
        TRISa = $f0|10    ;  and here
        porta = 1    ;  and here
        pause 10
        tmp=tmp-1
     wend
     
    ;leds 7,11 
        tmp=255
    while tmp
        TRISa= $f0|10    ;  and here
        porta = 4    ;  and here
        pause 10
        TRISa = $f0|6    ;  and here
        porta = 4    ;  and here
        pause 10
        tmp=tmp-1
     wend 
     
         
        
    goto mainloop
    Last edited by richard; - 21st June 2016 at 06:21.
    Warning I'm not a teacher

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