On Sat, 14 Jan 2012, Bob Blick wrote: > I have an existing small PIC project that produces an output on one pin > based on the high bit of a register. In order to save an external > inverter, I'd like to also output the complement on another pin. For the > sake of argument let's say it is an oscillator that blinks an LED or > drives a transducer. > > The target is a 16F627A and any pins are fair game, but glitches are not > OK to the two pins, so no math or rotates directly on the ports. > > It is OK to do anything to any of the other pins. > > It is OK for there to be a little latency, and either port A or port B > is OK. Or even both ports, though I don't see how that could get any > faster. > > Here's the fastest thing I could come up with: > > movlw 0x55 > btfss bigreg,7 > movlw 0xAA > movwf PORTA > > This is almost fast enough, if I could shave an instruction off one of > the two conditions it would be enough for me. > > Any suggestions? > > Thanks, Bob bcf STATUS,C rrf bigreg,w addlw 0x40 movwf PORTA if you can ensure that the carry flag is in a known state as a side effect= =20 of previous instructions then you could eliminate the "clear carry". NOTE: if carry is set use "addlw 0xC0" instead Regards Sergio Masci --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .