I want to let the state of an output follow the state of an input using code. I would like to do this as fast as possible.
If I use an external interrupt on pin 2 of an arduino uno or nano and I program the ISR to let pin 13 copy the state of pin 2 using direct port instructions, how long does it take for pin 13 to take over the same state.
I believe I am essentially asking how long it takes before the first line of code in an ISR is run after a rising or falling flank occurs.
Is turning on an LED on the real application for this or are you actually doing something else ? I ask because if the fact that the interrupt occurred is to be noticed by and acted upon a human then the delay between interrupt and action can afford to be much longer
If my program would not have anything else to do, I would do precisely that.
Anyways tnx for the link. I read that it takes about 1.4375 µS latency. (+ a little bit to handle the port registers)
Is turning on an LED on the real application for this or are you actually doing something else
I want to relay a DCC signal to an H bridge in order to boost it. (AC square wave with pulse durations of 58uS and 100uS). The DCC signal is connected to the arduino via an optocoupler.
I am not yet out of how I want to relay the signal electrically. I may also want to ignore the DCC signal to the H bridge and use PWM instead or control a bipolar stepper. Otherwise I would have tied the optocoupler directly to the H bridge to ensure the fastest respons. That is why I want this DCC signal to go to the arduino first before relaying it to the H bridge.