All, My thanks to Andrew Warren for a sanity check on my comments below. Andy's thoughts are indented. mjps_ >PIC 16c84 4Mhz [snip] monitor a pulse which only lasts 5 us. >loop > btfss port_b, 00h ; check rbo status > goto loop ; rbo is low so loop again > ............ ; rbo is high, take further actions >So my question is, is this possible? I'm not an engineer, but I'll take a stab at this one. The loop takes up 3 processor cycles which at 4Mhz (internally divided by 4) is 3us. this doesn't give you any time to do anything meaningful in "further actions". If he JUST misses the rising edge with his BTFSS, he'll be four cycles into the 5-microsecond pulse before the instruction after the GOTO is executed (two cycles for the GOTO, then two more for the BTFSS when the branch is taken). THAAT instruction will take at least one cycle, so the falling edge of the pulse will have happened before he gets around to checking for it. >Should I use interrupt? Interrupts have a 4 clock cycle overhead just to start, then you need to save W and status registers, "take further actions", clear the inturrupt, restore W and status registers and return. Too much overhead for a 5us pulse. Not too much overhead to see the rising edge, but definitely too much to also see the falling edge. Go with the faster clock. >Let's say I have an instruction which sets an ouptut high. >How long does this take in us/ns terms? Electricity and Light travel at about 1 foot in 1 nanosecond. At 4Mhz it seems to me that the rise time is insignificant. If the pin is connected to a very long wire, the capacitance of the transmission line and the rise times can be a problem. >What is the minimal input pulse duration I can monitor on a 20 mhz >version? So that when the input is high an action is taken and when >it becomes low again some other action is taken. (my answer missed the mark, so I omitted it. Here's Andy's) I may be misunderstanding the guy's question, but it sounds to me as though he wants to do one thing on the leading edge, then another on the falling edge. You may want to suggest something like this: wait4hi btfss portb,0 ;wait for rising edge. goto wait4hi ; ; signal is high. .... ;do something. this code must .... ;execute in fewer than 21 cycles. wait4lo btfsc portb,0 ;wait for falling edge. goto wait4lo ; ;signal is low. .... ;do something else. because of the .... ;GOTO, below, THIS code must execute .... ;in fewer than 19 cycles (if the pulse .... ;will only be low for 5 us -- if it'll .... ;be low longer, this code can take longe r). goto wait4hi ;loop back and do the whole silly thing again. mjps_