Andreas Magnusson wrote: > > Hello! > > I have a problem.... I have programmed a "test program" for a robot I have > built (PIC16F84 used). The program controlls a stepmotorcard. Everything > seems to work exept one thing RB3 pin is allways high... The pin should > pulse like the other ones. I have checed the circuitboard and also tested > with two different MCU:s. I programmed a small program to only clear portb > it worked. I cant really understund why the pin allways is high.... Hi, It is caused by the infamous read-modify-write problem. See code modifications below: > M3A > CLRF PORTA > BSF PORTB,6 > BCF PORTB,7 Change the last 2 lines by: movlw B'01000000' movwf PORTB > M3TABLE > MOVF M3,W > CALL FTABLE > MOVWF PORTB > NOP > BCF PORTB,6 ;clocking in the value from > NOP > BSF PORTB,6 change the last 4 lines by: andlw B'10111111' movwf PORTB iorlw B'01000000' movwf PORTB regards, Reggie -- e-mail: rberdin@bigfoot.com ICQ#: 31651436 URL: http://www.bigfoot.com/~rberdin