Go Down

Topic: How fast and stable can arduno trigger digital IOs? (Read 1 time) previous topic - next topic

Senso

Using DDRx, to set direction and PORTx to write to the pin you want.
If the 40ms is fixed using a timer is the best way to have 0 jitter, you see jitter because the millis values are returned from an interrrupt routine and the port access's are not atomic, and they can be interrupted in the middle of a write.
To learn about direct port manipulation see this:
http://hekilledmywire.wordpress.com/2011/02/23/direct-port-manipulation-using-the-digital-ports-tutorial-part-3/

mortos360

@Senso
Thanks for the link!
I will play around with it on monday... here I have no oscilloscope to test it :/


Grumpy_Mike

The jitter on an arduino output signal is caused by the interrupts running in the rest of the system doing things like the real time clock and the handling of the serial ports.
To remove this you must disable the interrupts, then delay() will not work and you have to write your own delay loops.

mortos360

I just tried direct port manipulation and it goes down to ns range completely stable :D


AWOL

Quote
can't find the post anymore, but I am sure I have read somewhere that he has a cycle of 2ns

Memory can play funny tricks on you, can't it?

Quote
I just tried direct port manipulation and it goes down to ns range completely stable

Tens of nanoseconds, I could believe. Getting towards the hundreds.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up