I am brand new to this so please be gentle. I am looking at generating positive narrow pulses. I started with the blink program and did a little reading and playing around. I have am using a 5 usec pulse every 100 usec. It looks beautiful with my scope on pin 13 (Nanao LED pin). If I move to any other pin I see a negative going sawtooth waveform at the pulse rate. It looks like an impedence mismatch to me. I have a cheap scope that has no 50 ohm input selection so I played a little with a 1k resistor in series and parallel to see what the effects were and it never got much better. I saw a schematic for how the LED is driven but it seems inefficient to burn current driving an op amp and LED just for impedence matching.
I would like to understand what the difference is between pin 11, 12 and 13.
pinMode (pin, OUTPUT) ? That would cause the output to be pulled up only by
the 30k internal pullup and droop down under the load. All the output pins on the ATmega Arduinos
(Uno, Nano, Pro Mini, Mega, ...) are the same 40mA absolute max and can drive a load as low as
Thanks. That worked great.
I don't seem to be able to get a pulse width less than about 3 Usec. Even when I tell it
I would really like to get a .5 usec width. Is this just not possible? I didn't see a "delayNanaseconds"
The microsecond timer only has resolution of 4uS so you can’t use that to get your 5uS pulse. You will have to use other techniques, like disabling the interrupts and writing your own delay in machine code. Also at these sorts of speeds you can’t use digitalWrite you have to use direct port manipulation.
If you want a really quick pulse, on D13 for example, try this:
PORTB = PORTB & 0b11011111; // clear D13
PORTB = PORTB | 0b00100000; // set D13
That will create a pulse that is a multiple of 62.5nS wide. 125nS, maybe 187.5nS or 250nS.