Todays Arduino Moment
posted Aug 19th 2010 9:46am by James Munnsfiled under: arduino hacks
We have gotten a number of Arduino tips in the last couple days, and we thought we would combine them for your convenience. The first tip we received was for some hints provided by [Bill] on some digitalWrite() alternatives. Similar to some previous research we covered, this tip also includes some tips on how to make the direct register writing a little easier by using #define to simplify things. Obviously this wont be as idiot-proof as digitalWrite() is, but we think you can handle it.
Our second tip is for a set of OLED displays from 4dsystems sold as Arduino Shields. They have a couple of different sizes from .96″ to 1.7″, depending on your needs and budget. There is no official display library for them yet, but 4dsystems have been kind enough to provide a few resources to work from. Hopefully we’ll see a few great applications from this, maybe a much bigger pixel Mario? A much smaller Game of Life? Feel free to send us your projects, or leave your ideas in the comments!









“Direct port access is not for the faint of heart”… lmfao
SBI/CBI instructions take 2 cycles, but the OUT instruction only takes 1. So couldn’t you do this:
register unsigned char toggleMask = _BV(bit);
PINB = toggleMask;
PINB = toggleMask;
PINB = toggleMask;
…
I haven’t tested it, but, ignoring the initial setup time (which is only 1 cycle anyway), your pin is now oscillating at 2 cycles per period instead of 4. (assuming you’ve unrolled the hell out of your loop!)