Quote Originally Posted by mat janssen View Post
Hallo,
I completed the programm for testing and it works ok.
With the & ~ look in the manual it takes the not value of the bit.

here is the complete source and also the hex file

'PIC 16F628A test


@ DEVICE PIC16F628A,INTRC_OSC
@ DEVICE PIC16F628A,MCLR_OFF
@ DEVICE PIC16F628A,BOD_OFF
@ DEVICE PIC16F628A,LVP_OFF
@ DEVICE PIC16F628A,CPD_OFF
@ DEVICE PIC16F628A,PROTECT_OFF


DEFINE OSC 4




CMCON = 7
VRCON = 0
OPTION_REG.7 = 0

TRISA = %11111111
TRISB = %00000000


A_INPUT VAR PORTA.0
B_INPUT VAR PORTA.1

HULP1 VAR BIT
HULP2 VAR BIT

COUNTER VAR WORD

Clear

COUNTER = 128

START:


HULP2 = A_INPUT & ~ HULP1 'EVERY POSITIVE GOWING EDGE OF A_INPUT
HULP1 = A_INPUT 'GIVES A PULSE OF ONE PROGRAMM CYCLE

IF HULP2 = 1 AND B_INPUT = 1 Then 'MOTOR TURNS RIGHT
COUNTER = COUNTER + 1
EndIF

IF HULP2 = 1 AND B_INPUT = 0 Then 'MOTOR TURNS LEFT
COUNTER = COUNTER - 1
EndIF

PORTB = COUNTER
GoTo START
I'm trying to do the example with PIC16f877a but i have problems for example the VRCON = 0 my compiler says it's a bad instruction how can i probe with this pic

thanks