====================================

Question 1


(From data sheet PIC16F87XA).

INTCON REGITER

bit 0 RBIF: RB Port Change Interrupt Flag bit

1 = At least one of the RB7:RB4 pins changed state; a mismatch condition will continue to set
the bit. Reading PORTB will end the mismatch condition and allow the bit to be cleared
(must be cleared in software).

0 = None of the RB7:RB4 pins have changed state

* * *

Yes, you must clear RBIF in software.


======================================

Question 2

Yes, you need 'retfie' before 'endasm'.
Just do what is in the PicBasic Pro manual.

======================================

Question 3

The encoder outputs that in CW direction:

Step 1 A=0 B=0
Step 2 A=1 B=0
Step 3 A=1 B=1
Step 4 A=0 B=1

If you use the interrupt INT0, you can monitor
only one signal of the encoder. If you monitor
the encoder signal A with the PIN RB0 (INT0) the
interrupt is raised when the encoder goes from
step 1 to step 2. (0 to 1).
From step 2 to step 3 the interrupt is not raised
because the encoder signal A is '1' in step 2 and
also '1' in step 3.

======================================

Question 4

You will have to fix that. This is a ticking bomb.
I don't use PicBasic. I cannot answer this question.
Do what I told you in my last post and ask the forum
for help.

======================================

From your last post:
I need 32 bits.so back to my code.

* * *

The PicBasic Pro compiler only supports a maximum
variable size of 16 bits.

What kind of 32-bit operations do you need?

Best regards,

Luciano