---------- >From: Michael Rigby-Jones >To: PICLIST@MITVMA.MIT.EDU >Subject: Re: [PIC]: Branch and I/O timing questions >> 2. I'm also left confused about when different operations "hit" the >> PORTA and PORTB pins. Do MOVWF, BCF, and BSF all cause the output to >> change at pretty much the same place, or does the simpler MOVWF somehow >> "outrace" the others? The documents are fairly clear about what happens >> if you do a BCF immediately followed by a BSF (it won't work!) but I'm >> still confused as to whether a BSF PORTA,0 followed by a CLRF PORTA,F >> is a reliable way of making an output pulse on Port A's low bit that >> stays high for exactly one instruction (4 clock cycles). >> > CLRF is not a Read-Modify-Write operation, so following a BSF immediately by > a CLRF is perfectly valid. But don't forget that one of the reasons that Read-Modify-Write can lead to unintended behaviour is because of the capacitance of the pins and the external load. I don't know how precise your timing requirements are, but the length of time for which the output is at logic level 1 will be affected by this capacitance, and may not be exactly 4 clock cycles. Jonny -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu