User Tools

Site Tools


pic_asm:pic_far_call_and_jump_for_non_contiguous_memory_pics

PIC FAR CALL and FAR JUMP macros for non-contiguous memory PICS

Nice neat FAR CALL / JUMP for 16F877 (easy to tweak). Sets the correct page in flash before jumping so as not to cause crashes through misdirection.

The 16F87x series has 8K of flash but it is divided into 4 pages of 2K. If you want to CALL or JUMP to somewhere out of the page where your code is currently executing, you need to use these otherwise you'll just end up somewhere in the same page as you are now - you'll get really weird crashes.

This is not a problem if your assembled code is less than 2K so you don't need FAR jumps.

	NOLIST

; FAR CALL, & JUMP routines for cross 2k page
FAR_JUMP MACRO LBL
			PAGESEL		LBL
			GOTO    	LBL
	ENDM

FAR_CALL MACRO LBL
			PAGESEL		LBL
			CALL    	LBL
			PAGESEL	$
	ENDM
pic_asm/pic_far_call_and_jump_for_non_contiguous_memory_pics.txt · Last modified: 2024/01/19 09:40 by 127.0.0.1