Log in

View Full Version : Please help, any ideas to improve Scrolling Text MAX7219



PBPBeginner
- 10th November 2011, 04:13
Hi, I just a few weeks ago try to figure out who to work with MAX7219 and the following example is a little program that I need to improve for scrolling messages, this example scroll JESUS in led Matrix 7x5, if you have any suggestions will be welcome at all

@ __CONFIG _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _PWRTE_ON
include "modedefs.bas"
ANSEL=0: ANSELH=0: TRISB=0
'-----VARIABLES-----
ADDRESS var word 'variable address for display
DATAREG var word 'variable data register for display
Y VAR BYTE 'contador para cargar address y datareg
X var BYTE
DES VAR BYTE


'----- symbolos ------
SYMBOL CLK = PORTB.4
SYMBOL DAT = PORTB.5
SYMBOL LOAD = PORTB.6

'-----PIN SETUPS-----
low dat 'data pin for MAX7219 (1)
low clk 'clock pin for MAX7219 (13)
low load 'load pin for MAX7219 (12)




'-----MAX7219 SETUP-----
ADDRESS = $0C : DATAREG = $01 : gosub MaxWrite ' NO SHUT, NORMAL OPERATION
ADDRESS = $09 : DATAREG = $00 : gosub MaxWrite ' COMBINACION BINARIA, NO DECODE
ADDRESS = $0A : DATAREG = $09 : gosub MaxWrite ' INTENSIDAD DE LEDS 1(MIN) A F(MAX)
ADDRESS = $0B : DATAREG = $06 : gosub MaxWrite ' SCAN LIMIT NUMERO DE DIGITOS
ADDRESS = $0F : DATAREG = $00 : gosub MaxWrite
GOSUB LIMPIAR


INICIO:
DES = 0
FOR X = 1 TO 4
FOR Y = 0 TO 6
LOOKUP Y,[56,016,016,016,016,144,096],DATAREG ' LETTER "J"
ADDRESS = Y+1 : DATAREG = DATAREG << DES
GOSUB MAXWRITE
PAUSE 10
NEXT Y
PAUSE 300
DES = DES + 1
NEXT X ' FINISH TO SCROLL


des = 0
for x = 1 to 4
for y = 0 to 6
lookup y,[248,128,128,240,128,128,248],datareg ' LETTER "E"
address = y+1 : datareg = datareg << des
gosub maxwrite
pause 10
next y
pause 300
des = des + 1
next x ' FINISH TO SCROLL SECOND


des = 0
for x = 1 to 4
for y = 0 to 6
lookup y,[120,128,128,112,008,008,240],datareg ' LETTER "S"
address = y+1 : datareg = datareg << des
gosub maxwrite
pause 10
next y
pause 300
des = des + 1
next x




des = 0
for x = 1 to 4
for y = 0 to 6
lookup y,[136,136,136,136,136,136,112],datareg ' LETTER "U"
address = y+1 : datareg = datareg << des
gosub maxwrite
pause 10
next y
pause 300
des = des + 1
next x


des = 0
for x = 1 to 4
for y = 0 to 6
lookup y,[120,128,128,112,008,008,240],datareg ' LETTER "S"
address = y+1 : datareg = datareg << des
gosub maxwrite
pause 10
next y
pause 300
des = des + 1
next x


GOSUB LIMPIAR
GOTO INICIO

MaxWrite:
shiftout DAT,CLK,MSBFIRST,[ADDRESS,DATAREG] 'Shift out the data to the 'MAX7219 'first the address, then data.
pulsout LOAD,1 'load the data into the MAX7219
return


LIMPIAR:
for Y = 1 to 7 'write $0F (blank) to all digits
ADDRESS = Y : DATAREG = $00 : gosub MaxWrite
next Y
return

visnja30
- 14th October 2014, 21:52
Hi,
I buy three 8x8 modules from E-bay with MAX7219 chip.
I try this example code on one 8x8 module and it works perfect.
Is it possible to use this code for scroll whole word "JESUS" on all three 8x8 modules and what modification are needed to make this possible
Best regards

PBPBeginner
- 22nd October 2014, 23:40
Hi, actually i was my idea on how programming to get the result, but i tested some changes with no success