I need to be able to cause a small delay while in an interrupt because the IC I am trying to clock cannot detect the 0.1uS wide clock pulse.
I am not sute what the best practice is.
void DataRead()
{
PORTB |= (1 << In_Load); // Sets Pin High (1) to Load the Data into the Register
PORTB &= ~(1 << In_Load); // Sets Pin Low (0) again
This is my code which toggles the pin High and Low again. Works fine to generate the 0.1uS wide pulse, but it is just too fast for the IC, which requires a 0.8uS wide pulse.
Obviously I cannot use delay() because this is within an ISR.
I could possibly split the PORT code between other code, making it to run the other in between, thus making a wider pulse, but I would rather not.
Is there a way to tell the processor to wait for 10 clock cycles before continuing? I know that the PDP8e's could but this is slightly different.
You can use delayMicroseconds() in an ISR but you should not delay more than a few microseconds. In your case it appears that 1 microsecond will be more than enough.
Point taken, I have amended the post. I think they built a macro around that function. I can't find the reference right now, but it probably avoided typing those leading underscore. And did a couple of other things, like checking the number was in range or something.