Depending on the device in hand and one’s temperament, bringing up a new part can be a frolic through the verdant fields of discovery or an endless slog through the grey marshes of defeat. One of the reasons we find ourselves sticking with tried and true parts we know well is that interminable process of configuration. Once a new display controller is mostly working, writing convenience functions to make it easier to use can be very satisfying, but the very first thing is figuring out how to make it do anything at all. Friend of Hackaday [Dan Hienzsch] put together a post describing how to use a particular LED controller which serves as a nice walkthrough of figuring out the right bitmath to make things work, and includes a neat trick or two.
The bulk of the post is dedicated to describing the way [Dan] went about putting together his libraries for a 7-segment display demo board he makes. At its heart the board uses the IS31FL3728 matrix driver from ISSI. We love these ISSI LED controllers because they give you many channels of control for relatively low cost, but even with their relative simplicity you still need to do some bit twiddling to light the diodes you need. [Dan]’s post talks about some strategies for making this easier like preconfigured lookup tables with convenient offsets and masking bits to control RGB LEDs.
There’s one more trick which we think is the hidden star of the show; a spreadsheet which calculates register values based on “GUI” input! Computing the bit math required to control a display can be an exercise in frustration, especially if the logical display doesn’t fit conveniently in the physical register map of the controller. A spreadsheet like this may not be particularly sexy but it gets the job done; exactly the kind of hack we’re huge fans of here. We’ve mirrored the spreadsheet so you can peek at the formulas inside, and the original Excel document is available on his blog.
In the embedded world, twiddling a few bits is expected behavior. Firmware is far enough down the stack that the author may care about the number of bits and bytes used, or needs to work with registers directly to make the machine dance. Usually these operations are confined to the typical shifting and masking but sometimes a problem calls for more exotic solutions. If you need to descend down these dark depths you invariably come across the classic Bit Twiddling Hacks collected by [Sean Eron Anderson]. Here be dragons.
Bit Twiddling Hacks is exactly as described; a page full of snippets and suggestions for how to perform all manner of bit math in convenient or efficient ways. To our surprise upon reading the disclaimer at the top of the page, [Sean] observes that so many people have used the contents of the page that it’s effectively all been thoroughly tested. Considering how esoteric some of the snippets are we’d love to know how the darkest corners found use.
After booting up his RetroPie system, [jfrmilner] had the distinct feeling that something was off. Realizing that the modern Xbox 360 controller didn’t fit right when reliving the games of his youth, he rounded up all his old controllers to make sure he always had the right gamepad for the game.
Wanting to keep the controllers unmodified — so they could still be used on the original systems — he had to do a bit of reverse-engineering and source some controller sockets before building his controller hub. Using shift-in registers, shift-out registers, and some multiplexers, he designed a large circuit selector — which acts as a shield for an Arduino Micro — so all the controllers remain connected. A potentiometer allows him to select the desired controller and a few arcade buttons which access RetroPie shortcuts really round out the hub. Check out the demo after the break!
Hardware design enthusiasts should already be salivating just looking at this image. But [Ken Shirriff’s] write-up on how the 8085 processor’s registers were designed will put you in silicon reverse-engineering heaven. He manages to get to the bottom of the tricks the designers used to make register access as efficient as possible, like routing some through the ALU on their path elsewhere.
We’re certainly not experts in studying dies like the one seen above. Luckily [Ken] does a great job of zooming in on important parts, then dissecting how they work by representing the silicone image as a functional flow chart. One of the parts which we found most interesting is the WZ temporary registers. These are a set of internal registers that are not accessible to the programmer. They’re only used internally by the chip. They act as temporary storage for multiple operand functions, and also hold register addresses for a handful of instructions (JMP, CALL, RST, etc.).