8x8 LED matrix "smooth" horizontal scrolling text - what's the math?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,158


    Did you find this post helpful? Yes | No

    Default Re: 8x8 LED matrix "smooth" horizontal scrolling text - what's the math?

    Or to have character data in eeprom, and also have a "display buffer" array which is read and refreshed consistently, but character data being written to it with changing offset.
    I did in the similar way for TM1629A, but I'm using 8 x 16 segment LED displays, so my code will have little use here.

  2. #2
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    952


    Did you find this post helpful? Yes | No

    Default I finally use the module rotated 90 degrees anti-clockwise...

    Si, here is my solution.

    To avoid any extra need of data conversion (from columns to lines...), I decided to use the MAX7219 ARDUINO module with the inter-connecting pins positionned vertically.

    Name:  7219H.png
Views: 1078
Size:  108.0 KB Name:  7219V.png
Views: 1073
Size:  107.2 KB

    Doing so, instead of displaying horizontal lines from bottom to top, it now displays vertical lines from right to left without any need of "too complicated math" for me to convert data from horizontal to vertical.

    Currently I have the need for one module. Of course, if I would need to chain several modules, I then would need 10cm 5x flat cables to connect the modules to each other.

    Thanks a lot for the help

    Code:
    '======= FUSES ====================================================================================
    ' PIC 16F690
    
    ' Internal oscillator  (activate OSCCON register)
    @ __config _FCMEN_OFF &_IESO_OFF &_CPD_OFF &_WDT_OFF &_INTRC_OSC_NOCLKOUT &_BOR_OFF &_CP_OFF &_PWRTE_OFF &_MCLRE_OFF
    
    @ ERRORLEVEL -306
    @ ERRORLEVEL -202
    
    ' ====== REGISTERS ==================================================================================
    '             76543210
    OPTION_REG = %10000000 'PORT A&B Pull-Ups disabled (look WPUA & WPUB)
    OSCCON     = %01110000 'Internal RC set to 8Mhz
    ANSEL      = %00000000 'Analog inputs Channels 0 to 7
    ANSELH     = %00000000 'Analog inputs Channels 8 to 11
    WPUA       = %00000000 'Weak pull-ups
    WPUB       = %00000000 'Weak pull-ups
    ADCON0     = %00000000 'A/D Module (OFF)
    CM1CON0    = %00000000 'Comparator1 Module (OFF)
    CM2CON0    = %00000000 'Comparator2 Module (OFF)
    INTCON     = %00000000 'INTerrupts CONtrol
    TRISA      = %00000000 'Set Input/Output (0 to 5)
    PORTA      = %00000000 'Ports High/Low (0 to 5)
    TRISB      = %00000000 'Set Input/Output (4 to 7)
    PORTB      = %00000000 'Ports High/Low (4 to 7)
    TRISC      = %00000000 'Set Input/Output (0 to 7)
    PORTC      = %00000000 'Ports High/Low (0 to 7)
                                    
    ' ====== DEFINES ==================================================================================
    DEFINE OSC 8
    DEFINE NO_CLRWDT 1
      
    ' ====== VARIABLES ================================================================================
    Addr_Reg    VAR BYTE    ' 7219's address register (1..8)
    Data_Reg    VAR BYTE    ' 7219's data register
    ScrollSpeed VAR WORD    ' pause time between frames (8 lines = 1 frame)
    Line        VAR BYTE    ' line number of a frame - from 0 (bottom line) to 7 (top line)
    Start       VAR BYTE    ' starting position in LOOKUP
    
    CLK         VAR PORTB.4 ' connected to module's CLK
    LOAD        VAR PORTB.5 ' connected to module's CS
    DAT         VAR PORTB.6 ' connected to module's DIN
    
    ' ====== INITIALIZE ===============================================================================
    LOW CLK
    LOW DAT
    LOW LOAD
    ScrollSpeed = 80
    
    ' ====== MAX7219 SETUP ============================================================================
    Addr_Reg = $09 : Data_Reg = $00 : GOSUB MaxWrite ' DECODE-MODE (= BCD), NO DECODE
    Addr_Reg = $0A : Data_Reg = $00 : GOSUB MaxWrite ' LEDS INTENSITY MIN=0, MAX=F
    Addr_Reg = $0B : Data_Reg = $07 : GOSUB MaxWrite ' NUMBER OF DISPLAYED LINES (0=bottom .. 7=top)
    Addr_Reg = $0C : Data_Reg = $01 : GOSUB MaxWrite ' SHUTDOWN=0, NORMAL OPERATION=1
    Addr_Reg = $0F : Data_Reg = $00 : GOSUB MaxWrite ' DISPLAY-TEST (0=OFF, 1=ON)
                   
    ' ====== PROGRAM ==================================================================================
    SCROLL:
        FOR Start = 0 TO 80 ' number of data in the LOOKUP - 8
            FOR Addr_Reg = 1 TO 8
                Line = (Addr_Reg - 1) + Start
                GOSUB PICBasic
                GOSUB MAXWRITE
            NEXT
            PAUSE ScrollSpeed
        NEXT
        GOTO SCROLL
    
    END
    
    ' ====== SUBROUTINES ==============================================================================
    MaxWrite:
        SHIFTOUT DAT,CLK,1,[Addr_Reg,Data_Reg] ' send the data to the MAX7219
        PULSOUT LOAD,1 ' push the data into the MAX7219
        RETURN
    
    ' ====== DISPLAY DATA =============================================================================
    ' 90 degrees anticlockwise rotated characters for use with vertically positionned MAX7219 ARDUINO module
    
    'Right_V_Line:
    'LOOKUP Line, [  0,  0,  0,  0,  0,  0,  0,255,  0,  0,  0,  0,  0,  0,  0,  0],Data_Reg
    
    PICBasic:
    LOOKUP Line, [  0,  0,  0,  0,  0,  0,  0,  0,_
                    0,254,254, 34, 34, 62, 28,  0,_          'P
                    0,  0,130,254,254,130,  0,  0,_          'I
                    0,124,254,130,130,198, 68,  0,_          'C
                    0,  0,  0,  0,  0,  0,  0,  0,_          
                    0,254,254,146,146,254,108,  0,_          'B
                    0, 64,232,168,168,248,240,  0,_          'a
                    0,144,168,168,168,168, 72,  0,_          's
                    0,  0,128,244,244,128,  0,  0,_          'i
                    0,112,248,136,136,216, 80,  0,_          'c                
                    0,  0,  0,  0,  0,  0,  0,  0],Data_Reg
        RETURN
    Roger

Similar Threads

  1. Replies: 11
    Last Post: - 7th December 2015, 04:19
  2. how to "shift" a data into led matrix display ?
    By CuriousOne in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th January 2015, 17:09
  3. 8x8 Scrolling LED display (Simple example)
    By wellyboot in forum Code Examples
    Replies: 68
    Last Post: - 11th July 2013, 06:03
  4. MY FIRST scrolling 8X8 LED
    By earltyso in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th August 2008, 17:23
  5. Smooth Scrolling Text
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 8th January 2008, 18:07

Members who have read this thread : 0

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