At 13:32 3/11/99 -0800, you wrote: >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 > > Is this not a read write modify type instruction? Where to XORWF with portA it must read PORTA, in this case it is an output so portA has an "undefined" input value on 0. Dennis