-----Original Message----- From: Jason A Alexander To: PICLIST@MITVMA.MIT.EDU Date: Friday, November 21, 1997 11:53 AM Subject: Pic16c84 input problem >Hello all. I am having a problem with some code I have written. > >I am trying to read the values of portb in an interupt sequence. > >Here is the code that I have written. > >one bcf intcon,7 ;Disable All interupts to prevent disruption > bsf _porta,1 ;Test bit > btfsc bit1,0 ;Check to see if bit one if loaded > goto second > movf _portb,bit1 ;Move incoming data to W register ************************************************ this should be movf _portb,w ********************************************** >; movwf bit1 ;move data to bit 1 >; bsf bit1,0 ;Set 0 bit to 1 to show register is loaded > bcf intcon,1 ;Clear Interupt flage > movf bit1,w ;Move bit into W to test > subwf test ;substract W from test > btfsc _status,2 ;Skip next instruction if register is 1 > goto notCorrect ;Digit was reset clear micro > bsf intcon,7 ;Enable all interupts > retfie ;Return from interupt > >I use this with variation six time to catch six bits that come in with an >interupt. For some reason the correct bits are not being read from portb. > >When I simulate this I only seem to 0x00 loaded into the w register. > >I have tried moving the portb info to the w register and then two the storage >register and as you can see I have tried moving from portb to the storage >register.. > > >Can someone tell me what I am doing wrong > >Thanks > > >Jason >