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.

Question regarding pagesel

Status
Not open for further replies.

gatoruss

New Member
I am hoping that someone can confirm something for me. I have a pic program (assembler) that contains the following code snippet:

DECFSZ X, 1
pagesel rept
call rept
retlw 0

If the result of line 1 is zero, the next instruction is skipped. This means that "pagesel rpt" is skipped and rpt is called, correct? This means that pagesel cannot be used following commands such as "DECFSZ" or "BTFSC"?
 
DECFSZ is a bit test on a certain register.

If the result of the test is zero, the next instruction is skipped as you have said.

If the result of the test is NOT zero, the next instruction is not skipped but executed.

You can use any instruction following a test.
 
You are correct, a better way to write it would be,
Code:
	pagesel	rept
	DECFSZ	X, 1
	call	rept
	pagesel	$
	retlw	0

Mike.
 
gatoruss said:
If the result of line 1 is zero, the next instruction is skipped. This means that "pagesel rpt" is skipped and rpt is called, correct? This means that pagesel cannot be used following commands such as "DECFSZ" or "BTFSC"?

Nothing wrong with the 'pagesel' assembler directive, you're just using it completely wrongly! - it's NOT a PIC instruction, it's an assembler directive and creates more than one line of code, which makes your misuse of it fail badly.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top