Hi, I have a pic18F4520 in one application with the porta configured as: clrf PORTA clrf LATA movlw 0x07 movwf ADCON1 ; Disable analog inputs and movwf CMCON ; comparators movlw b'11000000' ; All outputs movwf TRISA The pic is connected to a xc95144 cpld with all inputs in high impedance. The cpld is not affecting the pic because I removed it to check. Now, when I set up porta,2 everything is OK, when I set up porta,3 the pin RA3 goes high, but for no reasons RA2 resets! bsf PORTA,2 ; set pin RA2, "this works OK" bsf PORTA,3 ; set pin RA3, "this also works OK, but RA2 gets reseted!" If I invert the order, that is RA3 and then RA2, the result is the same. If I write to both at once then everything is OK, but I don't want to do that because I would have to read the port first and save the contents. movlw b'11110100' ; set pin RA2 only movwf PORTA movlw b'11111100' ; now, set pin RA3 and keep RA2 high fro previous state movwf PORTA ; This works, most likely because I'm updating the complete contents of the port. I remember many years ago I read somewhere about inadvertently changing port contents, but I can't remember where. This most probably is some stupid mistake I'm doing, but I don't seem to catch it up. Any ideas? -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist