Hi, look at my comment in the program text. I hope this helps. Imre On Mon, 7 Jun 1999, 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.... > > > /Andreas Magnusson > > > LIST P=16F84 > INCLUDE "P16C84.INC" > ;************************* > RAM ORG 0x0C > CNT RES 1 > CN1 RES 1 > CN2 RES 1 > TEMP RES 1 > M3 RES 1 > > ORG 0 > GOTO START > ORG 0X30 > ;************************* > START > BSF STATUS,RP0 > CLRF TRISA > CLRF TRISB > > BCF STATUS,RP0 > CLRF PORTA > CLRF PORTB > > > M3A > CLRF PORTA > BSF PORTB,6 > BCF PORTB,7 > CALL KORTM3 ;porta works as a adressbuss and > select Motorcard 3 > CLRF M3 > M3TABLE > MOVF M3,W > CALL FTABLE > MOVWF PORTB > NOP > BCF PORTB,6 ;clocking in the value from > ftable into a data latch on the stepmotorcard > NOP > BSF PORTB,6 > MOVLW .130 > CALL DELAY > INCF M3 > MOVLW .7 > XORWF M3 !!! If you want to compare M3 with 7 here, the please do not forget: XORWF M3, W otherwise M3 contains BULLSHIT !!! > BTFSC STATUS,Z > CLRF M3 > GOTO M3TABLE > > ;***************************** > FTABLE ADDWF PCL > RETLW B'01001111' > RETLW B'01001001' > RETLW B'01110001' > RETLW B'01000001' > RETLW B'01000110' > RETLW B'01000000' > RETLW B'01111000' > RETLW B'01001100' > > ;***************************** > KORTM3 BSF STATUS,RP0 > CLRF TRISA > CLRF TRISB > > BCF STATUS,RP0 > MOVLW 06h > MOVWF PORTA > RETURN > > ;***************************** > DELAY MOVWF CN2 > LOOP MOVWF CN1 > AGAIN NOP > NOP > NOP > NOP > DECFSZ CN1,F > GOTO AGAIN > DECFSZ CN2,F > GOTO LOOP > RETURN > ;******************************************************** > end > >