Continue to Site

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.

Crosing 2K Page Boundary Code Problem

Status
Not open for further replies.

Suraj143

Active Member
I cannot access the table values above 2K memory.Please help.

I have mentioned the memory address (from de-assembling list) in the comments.

Code:
		call	Cal_Offset		; get the character offset
		call	ASCII_Table		; 0x0ff line
		movwf	PORTB
		----
		----	

ASCII_Table	movlw	High Table
		addwf	Offset_H,W
		movwf	PCLATH
		movlw	Low Table
		addwf	offset_L,W
		btfsc   STATUS,C
		incf	PCLATH,F
		movwf   PCL
		;
Table		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'
		;
Char_1		retlw	b'00000001'
		retlw	b'00000001'
		retlw	b'00000001'
		retlw	b'00000001'
		retlw	b'00000001'
		retlw	b'00000001'
		;	
		retlw	b'00000000'
		;----
		;----
		;----				; 0x07ff
[COLOR="Red"]Char_8		retlw	b'00000001'		; 0x0800[/COLOR]
		retlw	b'00000010'
		retlw	b'00000100'
		retlw	b'00001000'
		retlw	b'00010000'
		retlw	b'00100000'
 
Last edited:
If ASCII_TABLE is in bank 1 (above 2k) then you need to do,
Code:
		call	Cal_Offset		; get the character offset
		[COLOR="red"]bsf	PCLATH,3[/COLOR]
		call	ASCII_Table		; 0x0ff line
		[COLOR="red"]bcf	PCLATH,3[/COLOR]
		movwf	PORTB
		----
		----	

ASCII_Table	movlw	High Table
		addwf	Offset_H,W
		movwf	PCLATH
		movlw	Low Table
		addwf	offset_L,W
		btfsc   STATUS,C
		incf	PCLATH,F
		movwf   PCL
		;
Table		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'
		retlw	b'00000000'

This will be the same for any calls to bank 1.

Mike.
 
Code:
		call	Cal_Offset		; get the character offset
		[COLOR="red"]bsf	PCLATH,3[/COLOR]
		call	ASCII_Table		; 0x0ff line
		[COLOR="red"]bcf	PCLATH,3[/COLOR]
		movwf	PORTB
		----
		----	

ASCII_Table	movlw	High Table
		addwf	Offset_H,W
		movwf	PCLATH
		movlw	Low Table
		addwf	offset_L,W
		btfsc   STATUS,C
		incf	PCLATH,F
		movwf   PCL
		;
Table		dt	.0,.0,.0,.0

using the 'dt' data approach is far more compact and legible, u can use hex,decimal (as shown) or binary without the retlw instructions.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top