Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

led matrix string problem

Status
Not open for further replies.

auri_z

New Member
dear all..

i try build led matrix project with colum scan with HEF4017 as colum driver. this project build from



i expand my project became 7x72 led matrix..( in this example just 7x24)

i also see tutorial nigel is very nice, and i try combine two of them for my project.




i use nigel tutorial 13.3 because it use string charakter dan solve problem cross boundry memory.

my problem is while use string charakter. without string charakter my project just fine although i just use proteus.

i can fetch string from string table but fetch it from font charakter for 7x5 led matrix (table) problem occur.
the problem is stack overflow. can anyone give me advice where my code wrong.

in sub rutin Load_Char i use hitung as counter data table use for 7x5 ascii chracter. in this sub rutin problem occur.

below is my code..

Code:
	#include		"p16f877a.inc"
		
		
		__CONFIG _CP_OFF & _WDT_OFF & _BODEN_OFF & _PWRTE_ON & _HS_OSC & _WRT_OFF & _LVP_OFF & _CPD_OFF
	
		cacah1 		equ 0x20
		cacah2		equ	0x40
		offsetL1		equ  0x41
		offsetH1		equ	0x42
		offsetL		equ	0x43
		offsetH		equ	0x44
		tmp1			equ	0x45
		tmp2			equ	0x46
		hitung		equ	0x47
		
	start	org		0x00
			bsf		STATUS,RP0
			movlw	0x00
			movwf	PORTD
			movwf	PORTC
			bcf		STATUS,RP0
			movlw	0x05
			movwf	hitung		;value for table ascii
			
			goto 	run1
			

				
     run1		clrf		23h
     		clrf		24h
     		clrf		25h
     		clrf		26h
     		clrf		27h
     		clrf		28h
     		clrf		29h
     		clrf		2Ah
     		clrf		2Bh
     		clrf		2Ch
     		clrf		2Dh
     		clrf		2Eh
     		clrf		2Fh
     		clrf		30h
     		clrf		31h
     		clrf		32h
     		clrf		33h
     		clrf		34h
     		clrf		35h
     		clrf		36h
     		clrf		37h
     		clrf		38h
     		clrf		39h
     		clrf		3Ah
     		clrf		offsetL
			clrf		offsetH
     		movlw	0x20
     		movwf	22h
     		
    
    	Message		
			;movlw	0x20
			;movwf	22h
			;call		shift
			;incf		21h,1
			;movf		21h,0
			
			call		String_Table	;get a character from the string table
			;movwf		3Ah
			xorlw	0x00			;is it a zero? - if so end of string
			btfsc	STATUS, Z
			goto		run1
			movwf	tmp2
			movlw	0x20			;subtract to get character index value
			subwf	tmp2, w
			call		Load_Char
			;call	ScrollL8
			incf	offsetL1, f		;increment 16 bit pointer to string
			btfsc   STATUS    , Z
			incf	offsetH1, f
			goto Message
			
	Load_Char
			movwf	offsetL
			clrf		offsetH
			bcf		STATUS,C
			call		ASCII_Table
			call		shift
			incf	offsetL, f		;increment 16 bit pointer to string
			btfsc   STATUS    , Z
			incf	offsetH, f
			decfsz	hitung,1		
			goto		run3
			return
			     		
     run3		decfsz	22h,1
     		goto		run4
     		goto		Message
     	
     run4		call		scan
     		goto		run3
     		
     scan		bsf		PORTC,1
     		nop
     		bcf		PORTC,1
     		
     		movf		23h,0
     		movwf	PORTD
     		call		tunda
     		movf		24h,0
     		movwf	PORTD
     		call		tunda
     		movf		25h,0
     		movwf	PORTD
     		call		tunda
     		movf		26h,0
     		movwf	PORTD
     		call		tunda
     		movf		27h,0
     		movwf	PORTD
     		call		tunda
     		movf		28h,0
     		movwf	PORTD
     		call		tunda
     		movf		29h,0
     		movwf	PORTD
     		call		tunda
     		movf		2Ah,0
     		movwf	PORTD
     		call		tunda
     		movf		2Bh,0
     		movwf	PORTD
     		call		tunda
     		movf		2Ch,0
     		movwf	PORTD
     		call		tunda
     		movf		2Dh,0
     		movwf	PORTD
     		call		tunda
     		movf		2Eh,0
     		movwf	PORTD
     		call		tunda
     		movf		2Fh,0
     		movwf	PORTD
     		call		tunda
     		movf		30h,0
     		movwf	PORTD
     		call		tunda
     		movf		31h,0
     		movwf	PORTD
     		call		tunda
     		movf		32h,0
     		movwf	PORTD
     		call		tunda
     		movf		33h,0
     		movwf	PORTD
     		call		tunda
     		movf		34h,0
     		movwf	PORTD
     		call		tunda
     		movf		35h,0
     		movwf	PORTD
     		call		tunda
     		movf		36h,0
     		movwf	PORTD
     		call		tunda
     		movf		37h,0
     		movwf	PORTD
     		call		tunda
     		movf		38h,0
     		movwf	PORTD
     		call		tunda
     		movf		39h,0
     		movwf	PORTD
     		call		tunda
     		movf		3Ah,0
     		movwf	PORTD
     		call		tunda
     		return
     		
     shift	movf		24h,0
     		movwf	23h
     		movf		25h,0
     		movwf	24h
     		movf		26h,0
     		movwf	25h
     		movf		27h,0
     		movwf	26h
     		movf		28h,0
     		movwf	27h
     		movf		29h,0
     		movwf	28h
     		movf		2Ah,0
     		movwf	29h
     		movf		2Bh,0
     		movwf	2Ah
     		movf		2Ch,0
     		movwf	2Bh 
     		movf		2Dh,0
     		movwf	2Ch
     		movf		2Eh,0
     		movwf	2Dh
     		movf		2Fh,0
     		movwf	2Eh
     		movf		30h,0
     		movwf	2Fh
     		movf		31h,0
     		movwf	30h
     		movf		32h,0
     		movwf	31h
     		movf		33h,0
     		movwf	32h
     		movf		34h,0
     		movwf	33h
     		movf		35h,0
     		movwf	34h 
     		movf		36h,0
     		movwf	35h 
     		movf		37h,0
     		movwf	36h
     		movf		38h,0
     		movwf	37h
     		movf		39h,0
     		movwf	38h
     		movf		3Ah,0
     		movwf	39h   		
     		return

			

		
	ASCII_Table  					;perform read from long table
		movlw	High(Table)
		addwf	offsetH, W
		movwf	PCLATH
		movlw	Low(Table)
		addwf	offsetL, w
		btfsc   STATUS    , C
		incf	PCLATH, f
		MOVWF   PCL
		
	String_Table  					;perform read from long table
		movlw	High(String)
		addwf	offsetH1, W
		movwf	PCLATH
		movlw	Low(String)
		addwf	offsetL1, w
		btfsc   STATUS    , C
		incf	PCLATH, f
		MOVWF   PCL		
						
	tunda
			movlw	D'100'
			movwf 	cacah1
		
	delay1
			decfsz	cacah1,1
			goto		delay1
			movlw	0x00
			movwf	PORTD
				
	clock	bsf		PORTC,0
			nop		
			bcf		PORTC,0
			return
	Table	
			dt	0x00, 0x00, 0x00, 0x00, 0x00,   ;space
			dt	0x00, 0x00, 0xF2, 0x00, 0x00,   ;!
			dt	0x00, 0xE0, 0x00, 0xE0, 0x00,   ;"
			dt	0x28, 0xFE, 0x28, 0xFE, 0x28,   ;#
			dt	0x24, 0x54, 0xFE, 0x54, 0x48,   ;$
			dt	0xC4, 0xC8, 0x10, 0x26, 0x46,   ;%
			dt	0x6C, 0x92, 0xAA, 0x44, 0x04,   ;&
			dt	0x00, 0xA0, 0xC0, 0x00, 0x00,   ;'
			dt	0x00, 0x38, 0x44, 0x82, 0x00,	  ;(
			dt	0x00, 0x82, 0x44, 0x38, 0x00,   ;)
			dt	0x28, 0x10, 0x7C, 0x10, 0x28,   ; *
			dt	0x10, 0x10, 0x7C, 0x10, 0x10,   ;+
			dt	0x0A, 0x0C, 0x00, 0x00, 0x00,   ;,
			dt	0x10, 0x10, 0x10, 0x10, 0x10,   ;-
			dt	0x00, 0x06, 0x06, 0x00, 0x00,   ;`
			dt	0x04, 0x08, 0x10, 0x20, 0x40,   ; /
			dt	0x7C, 0x8A, 0x92, 0xA2, 0x7C,   ;0
			dt	0x00, 0x42, 0xFE, 0x02, 0x00,   ;1
			dt	0x42, 0x86, 0x8A, 0x92, 0x62,   ;2
			dt	0x84, 0x82, 0xA2, 0xD2, 0x8C,   ;3
			dt	0x18, 0x28, 0x48, 0xFE, 0x08,   ;4
			dt	0xE4, 0xA2, 0xA2, 0xA2, 0x9C,   ;5
			dt	0x3C, 0x52, 0x92, 0x92, 0x0C,   ;6
			dt	0x80, 0x8E, 0x90, 0xA0, 0xC0,   ;7
			dt	0x6C, 0x92, 0x92, 0x92, 0x6C,   ;8
			dt	0x60, 0x92, 0x92, 0x94, 0x78,   ;9
			dt	0x00, 0x6C, 0x6C, 0x00, 0x00,   ;:
			dt	0x00, 0x6A, 0x6C, 0x00, 0x00,   ;;
			dt	0x10, 0x28, 0x44, 0x82, 0x00,   ;<
			dt	0x28, 0x28, 0x28, 0x28, 0x28,   ;=
			dt	0x00, 0x82, 0x44, 0x28, 0x10,   ;>
			dt	0x40, 0x80, 0x8A, 0x90, 0x60,   ;?
			dt	0x7C, 0x82, 0xBA, 0xAA, 0x78,   ;@
			dt	0x3f, 0x48, 0x48, 0x48, 0x3f,   ;A
			dt	0xFE, 0x92, 0x92, 0x92, 0x6C,   ;B
			dt	0x7C, 0x82, 0x82, 0x82, 0x44,   ;C
			dt	0xFE, 0x82, 0x82, 0x44, 0x38,   ;D
			dt	0xFE, 0x92, 0x92, 0x92, 0x82,   ;E
			dt	0xFE, 0x90, 0x90, 0x90, 0x80,   ;F
			dt	0x7C, 0x82, 0x92, 0x92, 0x5E,   ;G
			dt	0xFE, 0x10, 0x10, 0x10, 0xFE,   ;H
			dt	0x00, 0x82, 0xFE, 0x82, 0x00,   ;I
			dt	0x04, 0x02, 0x82, 0xFC, 0x80,   ;J
			dt	0xFE, 0x10, 0x28, 0x44, 0x82,   ;K
			dt	0xFE, 0x02, 0x02, 0x02, 0x02,   ;L
			dt	0xFE, 0x40, 0x30, 0x40, 0xFE,   ;M
			dt	0xFE, 0x20, 0x10, 0x08, 0xFE,   ;N
			dt	0x7C, 0x82, 0x82, 0x82, 0x7C,   ;O
			dt	0xFE, 0x90, 0x90, 0x90, 0x60,   ;P
			dt	0x7C, 0x82, 0x8A, 0x84, 0x7A,   ;Q
			dt	0xFE, 0x90, 0x98, 0x94, 0x62,   ;R
			dt	0x64, 0x92, 0x92, 0x92, 0x4C,   ;S
			dt	0x80, 0x80, 0xFE, 0x80, 0x80,   ;T
			dt	0xFC, 0x02, 0x02, 0x02, 0xFC,   ;U
			dt	0xF8, 0x04, 0x02, 0x04, 0xF8,   ;V
			dt	0xFC, 0x02, 0x1C, 0x02, 0xFC,   ;W
			dt	0xC6, 0x28, 0x10, 0x28, 0xC6,   ;X
			dt	0xE0, 0x10, 0x0E, 0x10, 0xE0,   ;Y
			dt	0x86, 0x8A, 0x92, 0xA2, 0xC2,   ;Z
			dt	0x00, 0xFE, 0x82, 0x82, 0x00,   ;[
			dt	0x40, 0x20, 0x10, 0x08, 0x04,   ;\
			dt	0x00, 0x82, 0x82, 0xFE, 0x00,   ;]
			dt	0x20, 0x40, 0x80, 0x40, 0x20,   ;^
			dt	0x02, 0x02, 0x02, 0x02, 0x02,   ;_
			dt	0x00, 0x00, 0xC0, 0xA0, 0x00,   ;/`
			dt	0x04, 0x2A, 0x2A, 0x2A, 0x1E,   ;a
			dt	0xFE, 0x22, 0x22, 0x22, 0x1C,   ;b
			dt	0x1C, 0x22, 0x22, 0x22, 0x22,   ;c
			dt	0x1C, 0x22, 0x22, 0x22, 0xFE,   ;d
			dt	0x1C, 0x2A, 0x2A, 0x2A, 0x18,   ;e
			dt	0x20, 0x20, 0x7E, 0xA0, 0xA0,   ;f
			dt	0x10, 0x2A, 0x2A, 0x2A, 0x3C,   ;g
			dt	0xFE, 0x10, 0x20, 0x20, 0x1E,   ;h
			dt	0x00, 0x22, 0xBE, 0x02, 0x00,   ;i
			dt	0x04, 0x02, 0x22, 0xBC, 0x00,   ;j
			dt	0xFE, 0x08, 0x14, 0x22, 0x00,   ;k
			dt	0x00, 0x82, 0xFE, 0x02, 0x00,   ;l
			dt	0x3E, 0x20, 0x3E, 0x20, 0x1E,   ;m
			dt	0x3E, 0x10, 0x20, 0x20, 0x1E,   ;n
			dt	0x1C, 0x22, 0x22, 0x22, 0x1C,   ;o
			dt	0x3E, 0x28, 0x28, 0x28, 0x10,   ;p
			dt	0x10, 0x28, 0x28, 0x28, 0x3E,   ;q
			dt	0x3E, 0x10, 0x20, 0x20, 0x00,   ;r
			dt	0x12, 0x2A, 0x2A, 0x2A, 0x24,   ;s
			dt	0x20, 0x20, 0xFC, 0x22, 0x22,   ;t
			dt	0x3C, 0x02, 0x02, 0x04, 0x3E,   ;u
			dt	0x38, 0x04, 0x02, 0x04, 0x38,   ;v
			dt	0x3C, 0x02, 0x0C, 0x02, 0x3C,   ;w
			dt	0x22, 0x14, 0x08, 0x14, 0x22,   ;x
			dt	0x30, 0x0A, 0x0A, 0x0A, 0x3C,   ;y
			dt	0x22, 0x26, 0x2A, 0x32, 0x22,   ;z
			dt	0x10, 0x6C, 0x82, 0x82, 0x00,   ;
			dt	0x00, 0x00, 0xEE, 0x00, 0x00,   ;|
			dt	0x00, 0x82, 0x82, 0x6C, 0x10,   ;
			dt	0x10, 0x10, 0x54, 0x38, 0x10,   ;<
			dt	0x10, 0x38, 0x54, 0x10, 0x10	  ;~ 
			dt	0xff
				
				
	String	
			dt	"ARIS",0	
			end

sorry my english is bad and my code bad to.
 
Status
Not open for further replies.

Latest threads

Top