Writing an 8-bit value to 8 individual output lines
Quote:
Originally Posted by
PaulStoffregen
Yes, digitalWriteFast() can easily toggle pins that fast.
But you will probably need to disable interrupts and maybe write some tricky code to get the timing right.
Thanks to all contributors for their valuable input.
I would like to extend the scope of my project to include writing an 8-bit value (which can be a constant to compile time) to 8 individual digitial output lines. I can arrange the outputs lines in any order including next to each other or whatever arrangement that may be necessary. I am looking for the fastest way to set those 8 output lines. Ideally, I would like an API that sets all 8 lines at the same time.
Any suggestions?
Thanks again,
Mo
Writing an 8-bit value to 8 digital output lines
Quote:
Originally Posted by
easone
Yeah, FlexIO can do this with zero processor overhead... Although it may be tricky to set up. I posted some example code doing 4bit parallel output from a buffer at 40MHz with FlexIO:
https://forum.pjrc.com/threads/59504...l=1#post230008
(Ignore the comment about a missing ampersand in the library, Kurt fixed that)
Doing 8 pins will be more of a hassle, but you can do it if you increase the shift width to either 16 or 32 and include padding bits in your buffer as necessary. I would expect it to run more slowly however.
(I am currently working on a project using FlexIO to drive 6 pins in parallel on an LED panel which I hope to post soon...)
Given that with my application I need 8 digital lines, is there any guidance on the selection of the pins/outputs. In other words, which 8 outputs provide the easiest proramming experience?
Thanks,
Mo