MY FIRST scrolling 8X8 LED


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jan 2007
    Location
    Houston, TX
    Posts
    96


    Did you find this post helpful? Yes | No

    Default workin sorta

    I like the idea of storing the table to eeprom.
    Here is what I have come up with. So far I have built up A,B,C,D in my library and they are scrolling just fine by shifting 8 times to the left. Now what I want to do is have the letters scroll TOGETHER so that the letters merge into a sentence without 8 columns of dead space between letters.
    I will be trying to figure this out over the weekend. I still need to optimize my table but at its a start.


    Code:
    DEFINE OSC 12
    
    'ADCON1 = 4 'this sets ANO, AN1, AN3 ON
    ADCON1 = 7' ALL DIGITAL
    TRISB = 0
    TRISC = 0
    SINK   VAR PORTB 'ROWS
    SOURCE VAR PORTC 'COLUMNS
    x var byte
    y var byte
    z var byte
    A VAR BYTE
    B VAR BYTE
    S VAR BYTE
    STP VAR BYTE
    'CHAR var byte[8]
    
    SOURCEA VAR WORD
    SOURCEB VAR WORD
    SOURCEC VAR WORD
    SOURCED VAR WORD
    SOURCEE VAR WORD
    SOURCEF VAR WORD
    SOURCEG VAR WORD
    SOURCEH VAR WORD
    
    LETTERS VAR BYTE ' VARIABLE TO HOLD CHARACTERS IN F/N LOOP
    CHAR var byte[26]' ARRAY VARIABLE NAMED CHAR 26 ELEMENTS
    
    '* * * * * * LOAD ARRAY WITH STRING VALUE * * * * * * * * * * *
    
    CHAR[0]= "A"
    CHAR[1]= "B"
    CHAR[2]= "C"
    CHAR[3]= "D"
    CHAR[4]= "E"
    CHAR[5]= "F"
    CHAR[6]= "G"
    CHAR[7]= "H"
    CHAR[8]= "I"
    CHAR[9]= "J"
    CHAR[10]="K"
    CHAR[11]="L"
    CHAR[12]="M"
    CHAR[13]="N"
    CHAR[14]="O"
    CHAR[15]="P"
    CHAR[16]="Q"
    CHAR[17]="R"
    CHAR[18]="S"
    CHAR[19]="T"
    CHAR[20]="U"
    CHAR[21]="V"
    CHAR[22]="W"
    CHAR[23]="X"
    CHAR[24]="Y"
    CHAR[25]="Z"
    
    MAIN2:
    for x = 0 to 10
    lookup x, [0,1,2,3,3,3,2,2,1,1,0], LETTERS      'EQUIVALENT TO a,b,c,d,d,d,c,c,b,b,a
                                        'NOT WORKING OBVIOUSLY
    'FOR LETTERS = 0 TO 2               'LOOKUP ASCII CHARACTERS STORED IN MATRICE ARRAY ,A,B,C
        'FOR STP = 0 TO 1               'SCROLL CHARACTER OFF PAGE NOT SURE HOW TO IMPLEMENT
            'FOR S = 0 TO 1             'MULTIPLEX SCREEN PAUSING ~10ms EACH SCAN
    		  GoSub display	            'FETCH THE 8 ROWS 
            'NEXT S 
        'NEXT STP 
        
    NEXT X		
    GOTO MAIN2
    
    display:             'A   'B   'C   'D   'E  
            Lookup LETTERS, [$0, $0, $0, $0], SOURCEA
            PORTC = SOURCEA
            PORTB = %11111110
            PAUSE 1
            Lookup LETTERS, [%01000010, %01111110, %01111110,%01111110], SOURCEB
            PORTC = SOURCEB
            PORTB = %11111101
            PAUSE 1
            Lookup LETTERS, [%01000010, %01000010, %00000010,%01000010], SOURCEC
            PORTC = SOURCEC
            PORTB = %11111011
            PAUSE 1
            Lookup LETTERS, [%01111110,%01000010 , %00000010,%01000010], SOURCED
            PORTC = SOURCED
            PORTB = %11110111
            PAUSE 1
            Lookup LETTERS, [%01000010, %01000110, %00100010,%01100010], SOURCEE
            PORTC = SOURCEE
            PORTB = %11101111
            PAUSE 1                     
            Lookup LETTERS, [%00111100, %00111010, %00111100,%01011100], SOURCEF
            PORTC = SOURCEF
            PORTB = %11011111
            PAUSE 1
            Lookup LETTERS, [$0, %00000010, $0,%01000000], SOURCEG
            PORTC = SOURCEG
            PORTB = %10111111
            PAUSE 1
            Lookup LETTERS, [$0, %00000010, $0,%01000000], SOURCEH
            PORTC = SOURCEH
            PORTB = %01111111 
            PAUSE 1
            
    FOR STP = 0 TO 7           'SCROLL MR. SMILEY OFF SCREEN
        FOR S = 0 TO 15        'SCAN SCREEN 21 TIMES (FAST) BETWEEN SCROLLING
            PAUSE 1
            PORTB = %11111110
            PORTC = SOURCEA >>STP
            PAUSE 1
            PORTB = %11111101
            PORTC = SOURCEB >>STP
            PAUSE 1
            PORTB = %11111011
            PORTC = SOURCEC >>STP
            PAUSE 1
            PORTB = %11110111
            PORTC = SOURCED >>STP
            PAUSE 1
            PORTB = %11101111
            PORTC = SOURCEE >>STP
            PAUSE 1
            PORTB = %11011111
            PORTC = SOURCEF >>STP
            PAUSE 1
            PORTB = %10111111
            PORTC = SOURCEG >>STP
            PAUSE 1
            PORTB = %01111111
            PORTC = SOURCEH >>STP
        NEXT S
    NEXT STP
    'GOTO MAIN
            
    RETURN
    Padawan-78

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Instead of this:

    Code:
    '* * * * * * LOAD ARRAY WITH STRING VALUE * * * * * * * * * * *
    CHAR[0]= "A"
    CHAR[1]= "B"
    CHAR[2]= "C"
    CHAR[3]= "D"
    CHAR[4]= "E"
    CHAR[5]= "F"
    CHAR[6]= "G"
    CHAR[7]= "H"
    CHAR[8]= "I"
    CHAR[9]= "J"
    CHAR[10]="K"
    CHAR[11]="L"
    CHAR[12]="M"
    CHAR[13]="N"
    CHAR[14]="O"
    CHAR[15]="P"
    CHAR[16]="Q"
    CHAR[17]="R"
    CHAR[18]="S"
    CHAR[19]="T"
    CHAR[20]="U"
    CHAR[21]="V"
    CHAR[22]="W"
    CHAR[23]="X"
    CHAR[24]="Y"
    CHAR[25]="Z"
    Try this:
    Code:
    For temp = "A" to "Z" : CHAR[ temp - "A" ] = temp : Next temp
    Easier to type, uses less memory, and so on...

    Another idea for you...

    Put the complete message into an array of bytes, the whole message, columns and all, not just the ASCII representation of each character (i.e. each character will use up 8 bytes in the array).
    Then, when displaying the message, (is the matrix actually 8x8? or are there really more 8x8 chunks involved?), shift the array by one column, pause, redisplay it...
    Last edited by skimask; - 15th August 2008 at 17:24. Reason: screwed up the code! it's fixed now!

  3. #3
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    Instead of this:

    Code:
    '* * * * * * LOAD ARRAY WITH STRING VALUE * * * * * * * * * * *
    CHAR[0]= "A"
    CHAR[1]= "B"
    CHAR[2]= "C"
    CHAR[3]= "D"
    CHAR[4]= "E"
    CHAR[5]= "F"
    CHAR[6]= "G"
    CHAR[7]= "H"
    CHAR[8]= "I"
    CHAR[9]= "J"
    CHAR[10]="K"
    CHAR[11]="L"
    CHAR[12]="M"
    CHAR[13]="N"
    CHAR[14]="O"
    CHAR[15]="P"
    CHAR[16]="Q"
    CHAR[17]="R"
    CHAR[18]="S"
    CHAR[19]="T"
    CHAR[20]="U"
    CHAR[21]="V"
    CHAR[22]="W"
    CHAR[23]="X"
    CHAR[24]="Y"
    CHAR[25]="Z"
    Try this:
    Code:
    For temp = "A" to "Z" : CHAR[ temp ] = temp : Next temp
    Easier to type, uses less memory, and so on...

    Another idea for you...

    Put the complete message into an array of bytes, the whole message, columns and all, not just the ASCII representation of each character (i.e. each character will use up 8 bytes in the array).
    Then, when displaying the message, (is the matrix actually 8x8? or are there really more 8x8 chunks involved?), shift the array by one column, pause, redisplay it...
    Ski,


    About the array loop and indexing it;

    When Temp = "A", how will "CHAR[ temp ] = temp" work?

    Where will "A" go? CHAR[65] ?


    What about CHAR[Temp-65] = Temp ?


    ---------------------

    Note: I just realized that my edit updated after Ski posted!
    Last edited by sayzer; - 15th August 2008 at 17:26.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by sayzer View Post
    Ski,

    About the array loop and indexing it;

    When Temp = "A", how will "CHAR[ temp ] = temp" work?

    Where will "A" go?
    CHAR[65] ?

    Nothing personal, just want to know
    DOH!!!
    Char[ temp - "A" ]
    That should be a bit better, ya think?

    Note: I just saw that Sayzer had edited after I had posted
    Last edited by skimask; - 15th August 2008 at 23:45.

Similar Threads

  1. 8x8 LED Matrix - Car / Boat Game (16F872)
    By wellyboot in forum Code Examples
    Replies: 4
    Last Post: - 13th February 2014, 22:28
  2. 8x8 Scrolling LED display (Simple example)
    By wellyboot in forum Code Examples
    Replies: 68
    Last Post: - 11th July 2013, 06:03
  3. new and need help
    By smeghead in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd November 2008, 21:19
  4. 5x7 LED Matrix Scrolling Display
    By roycarlson in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 5th August 2008, 00:50
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 03:30

Members who have read this thread : 1

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