5x7 Matrix Code Problem

ChrisHue

New Member
Hallo Forum,
i have a 5x7 Led Matrix and i will scroll a Message. The Message are in a Table and the Charters are in EEProm. I write a Code, but the Message not scroll.
Why not scroll the message ? Where is the Fallacy.

Greetings Chris
Code:
'#############################################
'##          PINOUT 20X2                    ##     
'##                                         ##
'##   Pin b.0 = Sdata                       ##
'##   Pin B.1 = Sclock			    ##
'##   Pin B.2 = Strobe                      ##
'##   Pin B.3 = Column                      ##
'##   Pin B.4 = Res                         ##
'##                                         ##
'#############################################

#picaxe 20X2
setfreq m64
dirsB = %11111111
adcsetup = 0
symbol Sdata 	  = Pinb.0
symbol Sclock 	  = b.1
symbol Strobe 	  = b.2
symbol Column 	  = b.3
symbol Res 		  = b.4
symbol Value        = b0
symbol Position     = b1
symbol Char  	  = b2
symbol Crevice      = b3
symbol Loops 	  = b4
symbol Search       = b5
symbol Sign      	  = b6

eeprom  0,(248,36,34,36,248,0)	;A
eeprom  6,(130,254,146,146,124,0)	;B
eeprom  12,(124,130,130,130,68,0)	;C
eeprom  18,(130,254,130,130,124,0)	;D
eeprom  24,(254,146,146,130,130,0)	;E
eeprom  30,(254,18,18,2,2,0)		;F
eeprom  36,(124,130,146,146,116,0)	;G
eeprom  42,(254,16,16,16,254,0)	;H
eeprom  48,(0,130,254,130,0,0)	;I
eeprom  54,(64,128,130,126,2,0)	;J
eeprom  60,(254,16,40,68,130,0)	;K
eeprom  66,(254,128,128,128,128,0)	;L
eeprom  72,(254,4,24,4,254,0)		;M
eeprom  78,(254,4,8,16,254,0)		;N
eeprom  84,(124,130,130,130,124,0)	;O
eeprom  90,(254,18,18,18,12,0)	;P
eeprom  96,(124,130,130,66,188,0)	;Q
eeprom  102,(254,18,50,82,140,0)	;R
eeprom  108,(76,146,146,146,100,0)	;S
eeprom  114,(2,2,254,2,2,0)		;T
eeprom  120,(126,128,128,128,126,0)	;U
eeprom  126,(14,48,192,48,14,0)	;V
eeprom  132,(254,64,48,64,254,0)	;W
eeprom  138,(198,40,16,40,198,0)	;X
eeprom  144,(6,8,240,8,6,0)		;Y
eeprom  150,(194,162,146,138,134,0)	;Z
eeprom  156,(124,162,146,138,124,0)	;0
eeprom  162,(0,132,254,128,0,0)	;1
eeprom  168,(228,146,146,146,140,0)	;2
eeprom  174,(68,130,146,146,108,0)	;3
eeprom  180,(48,40,36,254,32,0)	;4
eeprom  186,(78,138,138,138,114,0)	;5
eeprom  192,(120,148,146,146,96,0)	;6
eeprom  198,(2,226,18,10,6,0)		;7
eeprom  204,(108,146,146,146,108,0)	;8
eeprom  210,(12,146,146,82,60,0)	;9
eeprom  216,(0,0,0,0,0,0)		;Space
eeprom  222,(16,16,16,16,16,0)	;-
eeprom  228,(16,16,124,16,16,0)	;+
eeprom  234,(84,56,254,56,84,0)	;*
eeprom  240,(0,130,68,40,16,0)	;>
eeprom  246,(16,40,68,130,0,0)	;<

table 0,("MARRY CHRISTMAS") 	;Output Message 

start:
	 for Search = 0 to 14  	;(Marry Christmas)

	 readtable Search,Sign		

	 lookdown Sign,("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -+*><"),Char 
	
	 Char = Char * 6		;(EEprom, each 6 Chars) 
main:
	 For Loops = 0 To 30
	 
	 For Crevice = 0 To 4
       
       Position=Crevice+Char 
       
       read Position,Value 	' Shift Register read
       
       Sdata = bit7 : pulsout Sclock,1
       Sdata = bit6 : pulsout Sclock,1
       Sdata = bit5 : pulsout Sclock,1
       Sdata = bit4 : pulsout Sclock,1
       Sdata = bit3 : pulsout Sclock,1
       Sdata = bit2 : pulsout Sclock,1
       Sdata = bit1 : pulsout Sclock,1
       Sdata = bit0 : pulsout Sclock,1 
       
       pulsout Strobe,1      	' Shift Register set (Strobe)
       
       Sdata = 0			' Shift Register clear
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1
       pulsout Sclock,1

       pulsout Strobe,1		' Shift Register set (Strobe)
       
       pulsout Column,1
             
       next Crevice
	 
	 inc Crevice 
       
       next Loops
       
       pulsout Res,1
       
       next Search
       
       if Search>14 then goto Start
          
goto main
 

PaulRB

Senior Member
Chris, we need more! You must post more details, not just the code. We need a schematic diagram.

Paul
 

darb1972

Senior Member
Well, ignoring the code for now (and code is not my strong point), at first glance of your schematic, the serial in configuration looks wrong. I haven't seen anyone tie serial in to Vcc. Normally it's a 10k input with a 22k to ground. Further to the Picaxe manuals for further information.

Not sure if this is how you have it configured "post" download? Otherwise I fail to see how a program download works. This might not have much/any impact but it's not correct. I haven't checked (as yet) for further hardware issues.

Also, when you say your message "doesn't scroll", what (if anything) do you get on the display?
 

ChrisHue

New Member
Hallo Darb,
yes i see , but this is a mistake in the schematik. The Hardware is ok.
I can scroll a Message and it works wonderfully when i read the Chars direct from the EEProm like EEprom 0,(254,120,124,0,12).
But i will read a Message from a Table like Table 0,("HALLO") and then decode it, and verify with the EEprom for output.

Greetings Chris
 

PaulRB

Senior Member
Ok Chris, I think I understand your schematic. I hoped it would help me understand your code, but unfortunately it does not.

I can see some obvious problems with your code, for example a "goto" command that jumps into the middle of a loop, commands to increment loop variables after the loop has finished, and a few other things that seem odd to me. But the main thing I don't understand is how the code is meant to achieve scrolling. For example, at the instant when the matrix is supposed to be displaying the right part of "M" and the left part of "A", how can your code do this?

I think you may need to re-think the structure of your loops, to achieve the example I just made. Most of the time, the matrix needs to display part of one character and part of the next character, I don't see how your code can do that right now.

I suggest the following approach. Your message has 15 characters and each character has 6 columns. That's 90 columns in total. Your outermost loop goes from 0 to 89. The next nested loop simply repeats to govern the speed of scrolling, as it does now. The third nested loop controls which column of the matrix is to be animated, also as now. Inside that innermost loop you calculate which of the 90 columns of message is to be displayed, by adding the matrix column number (0 to 4) to the message column number (0 to 89). Then use "/ 6" on the result to calculate the character position within the message and "% 6" to get the column within that character. Then calculate the position of that column in your EEPROM data using your lookdown and read commands. Am I making sense?

It will be cool when it works!

Paul
 
Last edited:

PaulRB

Senior Member
Hi again Chris.

I also have a question and some suggestions about your schematic.

First the question: what else is your 20X2 doing? You seem to have many unused pins. If those pins truly are not used, you can simplify your circuit by removing the 4094 and 4017 and driving the rows and column of the matrix directly with the picaxe. You will still need the ULN2003 because the picaxe will not be able to sink enough current directly.

A suggestion would be to put your current limiting resistors on the rows, not the columns. As is, you will not get even brightness when a single led is lit versus when all 7 are lit.

Paul
 

ChrisHue

New Member
Hi Paul,
I'm just fairly new with the PICAXE.
I saw this circuit on the Internet and wanted to rebuild it.
Is the effort does not increase if I switch column without a shift register.

Chris
 

PaulRB

Senior Member
Hi Chris,

Driving the columns will make the code a tiny but more complex, but it will be worth it to remove a chip from your circuit. Driving the rows directly will make both the code and the circuit less complicated.

I hope I am making my English easy for you to understand. I am sorry but I speak no German at all and only enough French and Spanish to order beer!
 

ChrisHue

New Member
Hallo Paul,
i have make the matrix without any chip, so the PICAXE directly to the matrix with a few resistors.
What can I say, it works. Only the message I get here not to scroll.

Chris

Code:
setfreq m64		
;       C76543210
dirsC = %00011111			;C0 - C4  
;       B01234567
dirsB = %11111110			;B0 - B6
symbol row = pinsB		
symbol Column = pinsC
symbol eeprompos = W2
symbol char = B5
symbol pos = B4
symbol delay = 15			
symbol loops = 40			

EEprom 0,(%00011110,%00011101,%00011011,%00010111,%00001111) 							;Column 1-5 
EEprom 5,(248,36,34,36,248,130,254,146,146,124,124,130,130,130,68,130,254,130,130,124)			;ABCD
EEprom 25,(254,146,146,130,130,254,18,18,2,2,124,130,146,146,116,254,16,16,16,254)				;EFGH
EEprom 45,(0,130,254,130,0,64,128,130,126,2,254,16,40,68,130,254,128,128,128,128)				;IJKL
EEprom 65,(254,4,24,4,254,254,4,8,16,254,124,130,130,130,124,254,18,18,18,12)					;MNOP
EEprom 85,(124,130,130,66,188,254,18,50,82,140,76,146,146,146,100,2,2,254,2,2)				;QRST
EEprom 105,(126,128,128,128,126,14,48,192,48,14,254,64,48,64,254,198,40,16,40,198)				;UVWX
EEprom 125,(6,8,240,8,6,194,162,146,138,134,124,162,146,138,124,0,132,254,128,0)				;YZ01
EEprom 145,(228,146,146,146,140,68,130,146,146,108,48,40,36,254,32,78,138,138,138,114)			;2345
EEprom 165,(120,148,146,146,96,2,226,18,10,6,108,146,146,146,108,12,146,146,82,60)				;6789
EEprom 185,(16,16,16,16,16,0,0,0,0,0,0,130,68,40,16,16,40,68,130,0,84,56,254,56,84,16,16,124,16,16) 	;-;Space;>;<;*;+
;----------------------------------------V--------------------------------------------------------------------
;-------->          1111111111222222222233333333334
;-------->01234567890123456789012345678901234567890-----------------------------------------------------------
table 0,("* M a r r y - C h r i s t m a s ") ;Nachricht 
;-------------------------------------------------------------------------------------------------------------
do
for b3 = 0 to 31			;Length of the message
readtable b3,char			
lookdown char,("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789- ><*+abcdefghijklmnopqrstuvwxyz"),pos ;Position of Character in Table
eeprompos = pos + 1 * 5
if eeprompos > 210 then		;small characters (not yet)
eeprompos = eeprompos - 210		
end if
for b0 = 1 to loops		;Number of passes
for b1 = 0 to 4			
read b1,Column			;read Value for Column from Table
b2 = b1 + eeprompos
read b2,row				;read Value for Rows from Table
pause delay				;small break
next b1				;next Column/Row
next b0				;next Loops
next b3				;next character
loop
 

PaulRB

Senior Member
Good work Chris and very fast! Especially for someone new-ish to picaxe.

About scrolling - go back and read my post #6 again. I think that idea will work. Ask any questions you need.

Also, are you still using ULN2003? Remember that the picaxe has a maximum current for the total chip of about 90mA and 20mA for each pin. You must set your current limiting resistors according to these, otherwise you can fry your picaxe! With the ULN2003 you can send around 12mA to each led. Without the ULN2003, you can only send about 3mA to each led.

Paul
 
Last edited:

ChrisHue

New Member
Hello again,
I have now tried it once. I can not get the chars to scroll.:confused: Does anyone have an example for me.
Hallo Paul, yes i using the ULN2003 :)
Greetings Chris

P.S. I wish all users a Happy New Year 2013
 
Last edited:

ChrisHue

New Member
Hey Paul,
this code write the letters first to the Scratchpad and then i put it to the Matrix. But i can only show 19 Charters.
But this not realy what i want.

Greetings Chris



Code:
setfreq m64		
;       C76543210
dirsC = %00011111			;C0 - C4  
;       B01234567
dirsB = %11111110			;B0 - B6
symbol row = pinsB		
symbol Column = pinsC
symbol Search = b0
symbol Character = b1
symbol Position = b2
symbol First = b3
symbol Last = b4
symbol Starts = b5
symbol Ende = b6
symbol Pauses = b7
symbol Chars = b8
symbol lenght = b20
EEprom 0,(%00011110,%00011101,%00011011,%00010111,%00001111,0) 							;Column 1-5 + dummy
eeprom  6,(248,36,34,36,248,0)	;A
eeprom  12,(130,254,146,146,124,0)	;B
eeprom  18,(124,130,130,130,68,0)	;C
eeprom  24,(130,254,130,130,124,0)	;D
eeprom  30,(254,146,146,130,130,0)	;E
eeprom  36,(254,18,18,2,2,0)		;F
eeprom  42,(124,130,146,146,116,0)	;G
eeprom  48,(254,16,16,16,254,0)	;H
eeprom  54,(0,130,254,130,0,0)	;I
eeprom  60,(64,128,130,126,2,0)	;J
eeprom  66,(254,16,40,68,130,0)	;K
eeprom  72,(254,128,128,128,128,0)	;L
eeprom  78,(254,4,24,4,254,0)		;M
eeprom  84,(254,4,8,16,254,0)		;N
eeprom  90,(124,130,130,130,124,0)	;O
eeprom  96,(254,18,18,18,12,0)	;P
eeprom  102,(124,130,130,66,188,0)	;Q
eeprom  108,(254,18,50,82,140,0)	;R
eeprom  114,(76,146,146,146,100,0)	;S
eeprom  120,(2,2,254,2,2,0)		;T
eeprom  126,(126,128,128,128,126,0)	;U
eeprom  132,(14,48,192,48,14,0)	;V
eeprom  138,(254,64,48,64,254,0)	;W
eeprom  144,(198,40,16,40,198,0)	;X
eeprom  150,(6,8,240,8,6,0)		;Y
eeprom  156,(194,162,146,138,134,0)	;Z
eeprom  162,(124,162,146,138,124,0)	;0
eeprom  168,(0,132,254,128,0,0)	;1
eeprom  174,(228,146,146,146,140,0)	;2
eeprom  180,(68,130,146,146,108,0)	;3
eeprom  186,(48,40,36,254,32,0)	;4
eeprom  192,(78,138,138,138,114,0)	;5
eeprom  198,(120,148,146,146,96,0)	;6
eeprom  204,(2,226,18,10,6,0)		;7
eeprom  210,(108,146,146,146,108,0)	;8
eeprom  216,(12,146,146,82,60,0)	;9
eeprom  222,(0,0,0,0,0,0)		;Space
eeprom  228,(16,16,16,16,16,0)	;-
eeprom  234,(16,16,124,16,16,0)	;+
eeprom  240,(84,56,254,56,84,0)	;* 245
;----------------------------V--------------------------------------------------------------------
;-------->          1111111111222222222233333333334
;-------->01234567890123456789012345678901234567890-----------------------------------------------------------
table 0,(" MARRY CHRISTMAS AND") ;Nachricht 
;-------------------------------------------------------------------------------------------------------------
Chars = 19 ;(Max 19 Buchstaben !!!!)
lenght = chars * 6
pauses = 30
b13 = 0
main:
for Search = 0 to lenght			;Search of the message
readtable Search,Character			
lookdown Character,("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -+*"),Position ;Position of Character in Table
First = Position + 1 * 6
ende = first + 5
    for b10=First to ende
        ptr= b13          'set the scratchpad pointer
        read b10,b1
        @ptr=b1		  'write to the scratchpad
	inc b13
    next b10
    if search > Chars then 
    goto start
    end if
next search
start:
for b16 = 0 to lenght
for b17 = 0 to pauses
b18 = b16 +4
for b19 = b16 to b18
get b19,row 
read b15,Column
inc b15
if b15 >4 then 
b15 =0
end if	
pause 6
next b19
next b17
next b16
goto start
 

PaulRB

Senior Member
Hi Chris,

This is what I had in mind in post #6. I cannot test it for you, I have only syntax checked it, so you may have to debug it:

Code:
EEprom 0,(%00011110,%00011101,%00011011,%00010111,%00001111,0) 							;Column 1-5 + dummy
eeprom  6,(248,36,34,36,248,0)	;A
eeprom  12,(130,254,146,146,124,0)	;B
eeprom  18,(124,130,130,130,68,0)	;C
eeprom  24,(130,254,130,130,124,0)	;D
eeprom  30,(254,146,146,130,130,0)	;E
eeprom  36,(254,18,18,2,2,0)		;F
eeprom  42,(124,130,146,146,116,0)	;G
eeprom  48,(254,16,16,16,254,0)	;H
eeprom  54,(0,130,254,130,0,0)	;I
eeprom  60,(64,128,130,126,2,0)	;J
eeprom  66,(254,16,40,68,130,0)	;K
eeprom  72,(254,128,128,128,128,0)	;L
eeprom  78,(254,4,24,4,254,0)		;M
eeprom  84,(254,4,8,16,254,0)		;N
eeprom  90,(124,130,130,130,124,0)	;O
eeprom  96,(254,18,18,18,12,0)	;P
eeprom  102,(124,130,130,66,188,0)	;Q
eeprom  108,(254,18,50,82,140,0)	;R
eeprom  114,(76,146,146,146,100,0)	;S
eeprom  120,(2,2,254,2,2,0)		;T
eeprom  126,(126,128,128,128,126,0)	;U
eeprom  132,(14,48,192,48,14,0)	;V
eeprom  138,(254,64,48,64,254,0)	;W
eeprom  144,(198,40,16,40,198,0)	;X
eeprom  150,(6,8,240,8,6,0)		;Y
eeprom  156,(194,162,146,138,134,0)	;Z
eeprom  162,(124,162,146,138,124,0)	;0
eeprom  168,(0,132,254,128,0,0)	;1
eeprom  174,(228,146,146,146,140,0)	;2
eeprom  180,(68,130,146,146,108,0)	;3
eeprom  186,(48,40,36,254,32,0)	;4
eeprom  192,(78,138,138,138,114,0)	;5
eeprom  198,(120,148,146,146,96,0)	;6
eeprom  204,(2,226,18,10,6,0)		;7
eeprom  210,(108,146,146,146,108,0)	;8
eeprom  216,(12,146,146,82,60,0)	;9
eeprom  222,(0,0,0,0,0,0)		;Space
eeprom  228,(16,16,16,16,16,0)	;-
eeprom  234,(16,16,124,16,16,0)	;+
eeprom  240,(84,56,254,56,84,0)	;* 245
;----------------------------V--------------------------------------------------------------------
;-------->          1111111111222222222233333333334
;-------->01234567890123456789012345678901234567890-----------------------------------------------------------
table 0,("MERRY CHRISTMAS AND ") ;Nachricht 
;-------------------------------------------------------------------------------------------------------------
symbol MsgCharCount = 20 ; 
symbol MaxMsgCol = 119 ; = MsgCharCount * 6 - 1
symbol pauses = 30

symbol RowPins = pinsB		
symbol ColumnPins = pinsC

symbol MsgCol = b0
symbol MsgChar = b1
symbol CharCol = b2
symbol PauseCount = b3
symbol MatCol = b4
symbol MsgMatCol = b5
symbol Character = b6
symbol Position = b7
symbol MsgCharPos = b8

setfreq m64		
;       C76543210
dirsC = %00011111			;C0 - C4  
;       B01234567
dirsB = %11111110			;B0 - B6

do
	
	for MsgCol = 0 to MaxMsgCol
		for PauseCount = 1 to pauses
			for MatCol = 0 to 4
				
				MsgMatCol = MsgCol + MatCol ;Calculate message column to display on this matrix column
				MsgCharPos = MsgMatCol / 6 ;Calculate character position in message 
				CharCol = MsgMatCol % 6 ; ...and column number within that character
				
				readtable MsgCharPos,Character ;Get the character at that position in the message
				lookdown Character,("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -+*"), Position ;Position of Character in Table
				Position = 1 + Position * 6 + CharCol ;Calculate the exact location of the pattern data for the required column of the required character
				
				read MatCol, ColumnPins ;Read the character data and the column data directly into the output ports
				read Position, RowPins
				pause 6
				
			next MatCol
		next PauseCount
	next MsgCol
	
loop
	
end
Hope my comments make sense!

Paul
 

AllyCat

Senior Member
Hi Chris,

I haven't studied your code in detail, but perhaps you didn't appreciate that you can simply use (e.g.) READ @bptr,b0 (or even @bptrinc) to directly access the EPROM data.

Beware that the processing time might be an issue even at 64MHz, if there are any deeply nested loops. So it's probably best to calculate all the bits/pixels to be displayed and then to send them to the shift registers in a separate routine. The LOOKDOWN command with 40+ parameters is quite slow.

However, it appears to me that you only need to process one column of bits/pixels for each "cycle" of the scrolling. Suppose that you have calculated the column of bits (in a variable, say colbits) which is now to enter the display matrix. Also, the display column bytes are stored in an array starting at a RAM location (e.g. 64) defined by bptr. Then the display data can be simply updated with code such as:

Code:
FOR b1 = 0 to 4
SWAP colbits,@bptr
INC bptr
NEXT b1
Note that using @bptrinc in the above code doesn't appear to simulate correctly, however I haven't tried it in a real device. But anyway, SWAP is only a pseudo instruction and it isn't very efficient (compared with b0 = @bptr : @bptr = colbits : colbits = b0), so its only real advantage is "code neatness" (and @bptrinc would be even neater if it worked).

Cheers, Alan.

EDIT: Ah, I should have read the middle part of the thread and simulated Paul's code! I thought you were still using the shift registers shown in the circuit diagram (I'm designing a similar system myself, but don't have the luxury of about 10 spare PICaxe pins).
 
Last edited:

ChrisHue

New Member
Hi Paul,
your code is absoloute peak. It works just like i had in my mind. :D
Many, many thanks for your effort and your patience. The code should be for a LED matrix pendants that my daughter would have. (my next Project)

Greeting Chris
 

PaulRB

Senior Member
You're welcome Chris. I hope you can understand how that code works now. If not, I have given you the solution but you have missed the opportunity to learn something.

I am surprised that it worked immediately. I could not test or simulate it. Were any changes needed at all?

Can you post a video on YouTube. Would like to see it working.

Paul
 

ChrisHue

New Member
Hallo Paul,
here is the Video. The Video is not so good but i think you can see that the Matrix with you Code is work fine.
I will study the code exactly. Once again many thanks Paul.

greetings Chris

[video=youtube_share;3N54Vv5crn4]http://youtu.be/3N54Vv5crn4[/video]
 

ChrisHue

New Member
Hallo,
if interested, I have the program expanded a bit. It is now possible to show small letters. The small letters are in Tables.

greetings Chris

Code:
EEprom 0,(%00011110,%00011101,%00011011,%00010111,%00001111,0) 							;Column 1-5 + dummy
EEprom 6,(252,34,34,34,252,0) 	;A
EEprom 12,(254,146,146,146,108,0) 	;B
EEprom 18,(124,130,130,130,68,0) 	;C
EEprom 24,(254,130,130,130,124,0) 	;D
EEprom 30,(254,146,146,146,130,0) 	;E
EEprom 36,(254,18,18,18,2,0) 		;F
EEprom 42,(124,130,146,146,116,0) 	;G
EEprom 48,(254,16,16,16,254,0) 	;H
EEprom 54,(0,130,254,130,0,0) 	;I
EEprom 60,(96,128,128,128,126,0) 	;J
EEprom 66,(254,16,40,68,130,0) 	;K
EEprom 72,(254,128,128,128,128,0) 	;L
EEprom 78,(254,4,8,4,254,0) 		;M
EEprom 84,(254,8,16,32,254,0) 	;N
EEprom 90,(124,130,130,130,124,0) 	;O
EEprom 96,(254,18,18,18,12,0) 	;P
EEprom 102,(124,130,162,194,252,0) 	;Q
EEprom 108,(254,18,50,82,140,0) 	;R
EEprom 114,(76,146,146,146,100,0) 	;S
EEprom 120,(2,2,254,2,2,0) 		;T
EEprom 126,(126,128,128,128,126,0) 	;U
EEprom 132,(62,64,128,64,62,0) 	;V
EEprom 138,(254,64,32,64,254,0) 	;W
EEprom 144,(198,40,16,40,198,0) 	;X
EEprom 150,(14,16,224,16,14,0) 	;Y
EEprom 156,(194,162,146,138,134,0) 	;Z
EEprom 162,(124,162,146,138,124,0)	;0
EEprom 168,(0,132,254,128,0,0)	;1
EEprom 174,(228,146,146,146,140,0)	;2
EEprom 180,(68,130,146,146,108,0)	;3
EEprom 186,(48,40,36,254,32,0)	;4
EEprom 192,(78,138,138,138,114,0)	;5
EEprom 198,(120,148,146,146,96,0)	;6
EEprom 204,(2,2,226,18,14,0)		;7
EEprom 210,(108,146,146,146,108,0)	;8
EEprom 216,(12,146,146,82,60,0)	;9
EEprom 222,(0,0,0,0,0,0)		;Space
EEprom 228,(16,16,16,16,16,0)		;-
EEprom 234,(16,16,124,16,16,0)	;+
EEprom 240,(84,56,254,56,84,0)	;* 
EEprom 246,(40,254,40,254,40,0)	;# 251

Table 100,(64,168,168,168,240,0) 	;a
Table 106,(254,144,136,136,112,0) 	;b
Table 112,(112,136,136,136,64,0) 	;c
Table 118,(112,136,136,144,254,0) 	;d
Table 124,(112,168,168,168,48,0) 	;e
Table 130,(16,254,18,2,4,0) 		;f
Table 136,(24,164,164,164,124,0) 	;g
Table 142,(254,16,8,8,240,0) 		;h
Table 148,(0,136,250,128,0,0) 	;i
Table 154,(64,128,136,122,0,0) 	;j
Table 160,(254,32,80,136,0,0) 	;k
Table 166,(0,130,254,128,0,0) 	;l
Table 172,(248,8,48,8,240,0) 		;m
Table 178,(248,16,8,8,240,0) 		;n
Table 184,(112,136,136,136,112,0) 	;o
Table 190,(248,40,40,40,16,0) 	;p
Table 196,(16,40,40,48,248,0) 	;q
Table 202,(248,16,8,8,16,0) 		;r
Table 208,(144,168,168,168,64,0) 	;s
Table 214,(8,126,136,128,64,0) 	;t
Table 220,(120,128,128,64,248,0) 	;u
Table 226,(56,64,128,64,56,0) 	;v
Table 232,(120,128,96,128,120,0) 	;w
Table 238,(136,80,32,80,136,0) 	;x
Table 244,(24,160,160,160,120,0) 	;y
Table 250,(136,200,168,152,136,0) 	;z 256
;------------------------------------------------------------V------------------------------------------------
;-------->0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
;-------->0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
table 0,(" This is a Projekt with a Picaxe 20X2 and a TC07-11 ") ;Nachricht (max.99)
;-------------------------------------------------------------------------------------------------------------
symbol MsgCharCount = 51
symbol pauses 	  = 13
symbol RowPins 	  = pinsB
symbol ColumnPins	  = pinsC
symbol MsgCol 	  = W0
symbol MsgChar 	  = W1
symbol CharCol 	  = W2
symbol PauseCount   = W3
symbol MatCol 	  = W4
symbol MsgMatCol 	  = W5
symbol Character 	  = W6
symbol Position 	  = W7
symbol MsgCharPos   = W8
symbol MaxMsgCol 	  = W9		

setfreq m64		
;       C76543210
dirsC = %00011111			;C0 - C4  
;       B01234567
dirsB = %11111110			;B0 - B6

do
	MaxMsgCol = MsgCharCount * 6 - 1
 	for MsgCol = 0 to MaxMsgCol
		for PauseCount = 1 to pauses
			for MatCol = 0 to 4
				
				MsgMatCol = MsgCol + MatCol ;Calculate message column to display on this matrix column
				MsgCharPos = MsgMatCol / 6 ;Calculate character position in message 
				CharCol = MsgMatCol % 6 ; ...and column number within that character
				
				readtable MsgCharPos,Character ;Get the character at that position in the message
				lookdown Character,("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -+*#abcdefghijklmnopqrstuvwxyz"), Position ;Position of Character in Table

				if Position > 40 then
				Position = Position - 40 
				Position = 15 + Position * 6 + CharCol + 4;position of small character in the Table
				readtable Position, RowPins ;read small character from Table
				goto Outputs
				end if

				Position = 1 + Position * 6 + CharCol ;Calculate the exact location of the pattern data for the required column of the required character
				read Position, RowPins
		 Outputs:  	read MatCol, ColumnPins ;Read the character data and the column data directly into the output ports
		    	      pause 1
			
			next MatCol
		next PauseCount
	next MsgCol
loop
	
end
 

PaulRB

Senior Member
Very resourceful Chris. It's a pity the X2 chips don't have 512 byte table space, like the m2. Then you could have put all the character data in one place (table) and the message data in EEPROM.

Paul
 

ChrisHue

New Member
Hallo Paul,
I thought at first that 32 Mhz is not enough for scroll a Message. As I have now seen, it is enough.
Here is the program for a 20m2 just as you suggested.

Greetings Chris

Code:
table 0,(%00011110,%00011101,%00011011,%00010111,%00001111,0) 							;Column 1-5 + dummy
table 6,(248,36,34,36,248,0)		;A
table 12,(64,168,168,168,240,0) 	;a
table 18,(130,254,146,146,108,0)	;B
table 24,(254,144,136,136,112,0) 	;b
table 30,(124,130,130,130,68,0)	;C
table 36,(112,136,136,136,64,0) 	;c
table 42,(130,254,130,130,124,0)	;D
table 48,(112,136,136,144,254,0) 	;d
table 54,(254,146,146,146,130,0)	;E
table 60,(112,168,168,168,48,0) 	;e
table 66,(254,18,18,18,2,0)		;F
table 72,(16,254,18,2,4,0) 		;f
table 78,(124,130,146,146,116,0)	;G
table 84,(24,164,164,164,124,0) 	;g
table 90,(254,16,16,16,254,0)		;H
table 96,(254,16,8,8,240,0) 		;h
table 102,(0,130,254,130,0,0)		;I
table 108,(0,136,250,128,0,0) 	;i
table 114,(64,128,130,126,2,0)	;J
table 120,(64,128,136,122,0,0) 	;j
table 126,(254,16,40,68,130,0)	;K
table 132,(254,32,80,136,0,0) 	;k
table 138,(254,128,128,128,128,0)	;L
table 144,(0,130,254,128,0,0) 	;l
table 150,(254,4,24,4,254,0)		;M
table 156,(248,8,48,8,240,0) 		;m
table 162,(254,4,8,16,254,0)		;N
table 168,(248,16,8,8,240,0) 		;n
table 174,(124,130,130,130,124,0)	;O
table 180,(112,136,136,136,112,0) 	;o
table 186,(254,18,18,18,12,0)		;P
table 192,(248,40,40,40,16,0) 	;p
table 198,(124,130,130,66,188,0)	;Q
table 204,(16,40,40,48,248,0) 	;q
table 210,(254,18,50,82,140,0)	;R
table 216,(248,16,8,8,16,0) 		;r
table 222,(76,146,146,146,100,0)	;S
table 228,(144,168,168,168,64,0) 	;s
table 234,(2,2,254,2,2,0)		;T
table 240,(8,126,136,128,64,0) 	;t
table 246,(126,128,128,128,126,0)	;U
table 252,(120,128,128,64,248,0) 	;u
table 258,(14,48,192,48,14,0)		;V
table 264,(56,64,128,64,56,0) 	;v
table 270,(254,64,48,64,254,0)	;W
table 276,(120,128,96,128,120,0) 	;w
table 282,(198,40,16,40,198,0)	;X
table 288,(136,80,32,80,136,0) 	;x
table 294,(6,8,240,8,6,0)		;Y
table 300,(24,160,160,160,120,0) 	;y
table 306,(194,162,146,138,134,0)	;Z
table 312,(136,200,168,152,136,0) 	;z
table 318,(124,162,146,138,124,0)	;0
table 324,(0,132,254,128,0,0)		;1
table 330,(228,146,146,146,140,0)	;2
table 336,(68,130,146,146,108,0)	;3
table 342,(48,40,36,254,32,0)		;4
table 348,(78,138,138,138,114,0)	;5
table 354,(120,148,146,146,96,0)	;6
table 360,(2,226,18,10,6,0)		;7
table 366,(108,146,146,146,108,0)	;8
table 372,(12,146,146,82,60,0)	;9
table 378,(0,0,0,0,0,0)			;Space
table 384,(84,56,254,56,84,0)		;*
table 390,(40,254,40,254,40,0)	;#
table 396,(16,16,16,16,16,0)		;-
table 402,(16,16,124,16,16,0)		;+
table 408,(8,20,34,65,0,0)		;<
table 414,(0,65,34,20,8,0)		;>
;------------------------------------------------------------V------------------------------------------------
;-------->0000000000111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999
;-------->0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
eeprom 0,(" AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz ") ;Message
;-------------------------------------------------------------------------------------------------------------
symbol MsgCharCount = 54
symbol pauses 	  = 8
symbol RowPins 	  = pinsB
symbol ColumnPins	  = pinsC
symbol MsgCol 	  = W0
symbol MsgChar 	  = W1
symbol CharCol 	  = W2
symbol PauseCount   = W3
symbol MatCol 	  = W4
symbol MsgMatCol 	  = W5
symbol Character 	  = W6
symbol Position 	  = W7
symbol MsgCharPos   = W8
symbol MaxMsgCol 	  = W9		

setfreq m32		
;       C76543210
dirsC = %00011111			;C0 - C4  
;       B01234567
dirsB = %11111111			;B0 - B6

do
	MaxMsgCol = MsgCharCount * 6 - 1
 	for MsgCol = 0 to MaxMsgCol
		for PauseCount = 1 to pauses
			for MatCol = 0 to 4
				
				MsgMatCol = MsgCol + MatCol ;Calculate message column to display on this matrix column
				MsgCharPos = MsgMatCol / 6 ;Calculate character position in message 
				CharCol = MsgMatCol % 6 ; ...and column number within that character
				
				read MsgCharPos, Character ;Get the character at that position in the message
				lookdown Character,("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz0123456789 *#-+<>"), Position ;Position of Character in Table
				Position = 1 + Position * 6 + CharCol ;Calculate the exact location of the pattern data for the required column of the required character
				readtable Position, RowPins
		 	  	readtable MatCol, ColumnPins ;Read the character data and the column data directly into the output ports
		    	      pause 1
			next MatCol
		next PauseCount
	next MsgCol
loop
	
end
 
Top