If i'm not wrong, that code should/could be written like this on the enhanced PIC16 models : clrf PORTB ; Clear the PORT movlb TRISB clrf TRISB movlb RCSTA bsf RCSTA,7 movlb ANSELB bcf ANSELB,7 ; Should probably be a clrf... movlb SSP1CON1 clrf SSP1CON1 clrf SSP2CON1 movlb ADCON0 clrf ADCON0 movlb CPSCON0 clrf CPSCON0 movlb MDCON clrf MDCON movlb DACCON0 clrf DACCON0 movlb CM1CON0 clrf CM1CON0 And *never* write out the actual address to registers (such as 0x08), always use symbols (BSR in this case). Oli Glaser wrote 2011-06-21 02:13: > On 20/06/2011 23:18, jim@jpes.com wrote: >> Let me try this again without all the typos and spelling mistakes. >> That's what I get for going too fast. >> >> All, >> >> I am trying to get familiar with the PIC16F1827 part that has the >> Capacitive Sensing Module on it. >> As a start, I am setting each bit on PORTB sequentially. This is ju= st >> a familiarization exercise. >> However, I can't get bits 1,2 and 5 to toggle. I have tried turning >> off any module associated with >> PORTB, but I still cannot get it to work. Bits 0, 3, 4, 6, and 7 wor= k >> fine. >> I am probably missing turning off something, but I just don't see wh= at >> it is. >> >> Below is listed what I have tried turning off so far. >> >> clrf PORTB ; Clear the PORT >> >> movlw 0x01 ; Make pins OUTPUTS >> movwf 0x08 >> clrf TRISB >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x03 ; Disable Serial Port (UART) >> movwf 0x08 >> bsf RCSTA,7 >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x03 ; Make Pins Digital, Not Analog >> movwf 0x08 >> bcf ANSELB,7 >> movlw 0x00 >> movwf 0x08 >> =09 >> movlw 0x04 ; Turn Off Synchronous Serial Ports (SPI& I2C) >> movwf 0x08 >> clrf SSP1CON1 >> clrf SSP2CON1 >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x01 ; Turn Off A/D Converter >> movwf 0x08 >> clrf ADCON0 >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x00 ; Turn Off Capacitive Sense Module >> movwf 0x08 >> clrf CPSCON0 >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x07 ; Turn Off Digital Signal Modulator >> movwf 0x08 >> clrf MDCON >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x02 ; Turn Off D/A Converter Module >> movwf 0x08 >> clrf DACCON0 >> movlw 0x00 >> movwf 0x08 >> >> movlw 0x02 ; Turn Off Comparator Module >> movwf 0x08 >> clrf CM1CON0 >> movlw 0x00 >> movwf 0x08 >> >> If anyone sees anything that I am doing wrong, or sees something tha= t >> I am missing turning off >> (or on if it should be on) to make PORTB work, please let me know. = I >> appreciate it. >> >> Thanks and Regards, >> >> Jim >> >> >> >> > > Shouldn't that be clrf ANSELB if you want make all the pins digital? > Although it shouldn't affect the output.. > Couple of guesses: > Just checked my datasheet and it says it has more than one I2C/SPI > peripheral - check page 126, section 12.3.4 for the pin priorities and > see if you can see anything there. I would turn SSPCON2 off to start > with, and the CCP peripheral. > Check you are not having a rmw issue when you toggle the pins too. > > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .