I know its basic, but have your CORRECTLY set the ADCON register? Last month I was developing code for '877 and I reached your same problem. It was solved changing the ADCON register. Another thing: When you execute an toggle routine or command, the pic reads the pin contents, then togle a bit and shifts out it again to the pin, so, depending on your hardware (an led drawing a lot of current for example), when the pic reads the pin, the "hi" (an 1) voltage on it is below, let's say 2.5v; so the read is interpreted as a low rather then a high. If it happens, the real behavior is that the pin don't toggle. It also happened to me last month. If it helps, reply so I may track this "interesting" behavior. see you, Beto. ______________ I believe I've just found a really nasty hardware bug in the 16F876. I figure I would tell you guys first then figure out who at MChip to give a piece of my mind. Here's the scenario : I'm using pin 0 of port A to wakeup an external device. This involves toggling the pin. If only pin 0 is written to, a 0 never comes out on the port. To get it to write something another pin on port A must also be written to. My bare bones software test cases are : 1: xor pin 0 with 1 2: delay In this case pin 0 stays a 1, constantly. If I change it to : 1: xor pin 0 with 1 2: delay 3: write a 1 to pin 1,2,3 or 5; 4: write a 0 to pin 1,2,3, or 5; Then it works. Otherwise nix. It operates in exactly the same manner with bsf and bcf on that particular pin. I didn't see anything in the errata on this. I'm more than a bit irritated. If someone can show me how this is a bug on my part I'd be grateful (as well as surprised). Here's the source for working : m015 MOVLW .1 00F0 1283 0529 BCF 0x03,RP0 00F1 1303 0530 BCF 0x03,RP1 00F2 0685 0531 XORWF PORTA,1 00F3 0000 0533 NOP 00F4 0000 0535 NOP 00F5 0000 0537 NOP 00F6 0000 0539 NOP 00F7 0000 0541 NOP 00F8 1685 0544 BSF PORTA,5 00F9 1285 0546 BCF PORTA,5 00FA 28EF 0549 GOTO m015 And for not working : m015 MOVLW .1 00F0 1283 0529 BCF 0x03,RP0 00F1 1303 0530 BCF 0x03,RP1 00F2 0685 0531 XORWF PORTA,1 00F3 0000 0533 NOP 00F4 0000 0535 NOP 00F5 0000 0537 NOP 00F6 0000 0539 NOP 00F7 0000 0541 NOP 00F8 28EF 0547 GOTO m015 _________________________________________________________________________ MailBR - O e-mail do Brasil -- http://www.mailbr.com.br Estamos concorrendo ao IBEST - Servigos On-Line Acesse http://ibest.mailbr.com.br e Vote!