I've not had an issue with performance of the I/O but here's a technique for squeezing a little more speed out of the ports without having significant code changes.
http://www.codeproject.com/Articles/732646/Fast-digital-I-O-for-Arduino
I've not had an issue with performance of the I/O but here's a technique for squeezing a little more speed out of the ports without having significant code changes.
http://www.codeproject.com/Articles/732646/Fast-digital-I-O-for-Arduino
This looks nice until you see things like recent changing from Raspberry Pi to a Pi 2 and the library breaks! Too many folks here would not know what to do, except for some of the hard core type. I have not checked, but would guess the Arduino has ports mapped differently depending on the chips also.
Pass,
Clem
It does, and the ports also have different functionality (Much of which is not exposed through "Wiring") but in order to protect the user from this there is a rather large and relatively slow abstraction layer allowing the use of commands like DigitalWrite() etc. to still output that logic level to the same pin on the "Arduino Header Connectors"
The reason the MEGA is way slower than the UNO for the exact same program is entirely down to the abstraction layer being more involved for the MEGA. The Mega IO is more complex and requires more checks before outputting your logic level to the port (I tested this a long time ago and this is true even though the MEGA and UNO where both running at 16Mhz)
It is when I reduced the code to use direct IO that the two code applications started to run at the same speed and that was also a significant increase in speed too (Maybe 10* or more)
I will perform some tests over the weekend if I get a chance and publish the results
It does, and the ports also have different functionality (Much of which is not exposed through "Wiring") but in order to protect the user from this there is a rather large and relatively slow abstraction layer allowing the use of commands like DigitalWrite() etc. to still output that logic level to the same pin on the "Arduino Header Connectors"
The reason the MEGA is way slower than the UNO for the exact same program is entirely down to the abstraction layer being more involved for the MEGA. The Mega IO is more complex and requires more checks before outputting your logic level to the port (I tested this a long time ago and this is true even though the MEGA and UNO where both running at 16Mhz)
It is when I reduced the code to use direct IO that the two code applications started to run at the same speed and that was also a significant increase in speed too (Maybe 10* or more)
I will perform some tests over the weekend if I get a chance and publish the results