Everyone loves multiplexing. You know, turn on one digit for a little bit, turn on the next one, and so forth. It save power compared to having everything on all the time, and it allows you to use one pin for each segment and one pin for each digit instead of (num of digits)*(num of segments) pins on your microcontroller.
But… as with almost anything, there are a couple different ways to do it. The standard would be to illuminate one digit at a time, and the hardware, if you do it the “right way”, is one current limiting resistor per segment, plus one transistor per digit to turn it on or off.
But what if you don’t want to use all that jazz? What about just hooking all the pins straight to the microcontroller? Read the rest of this entry »
I’ve been trying to come up with a cheap and fast way to add a CPLD to projects, and saw a very neat thing on Hack a Day: how-to: programmable logic devices (cpld).
Many people take the seemingly lowly op-amp for granted. Most people won’t think twice about throwing one in to a circuit to boost a signal or buffer some sensor, preparing one signal to be fed somewhere else in a circuit to become something more exciting or useful.
While stumbling about the interwebs, I found a pretty nice project for a 0-1750 MHz spectrum analyzer that you could, theoretically, make yourself. Read the rest of this entry »
No microcontroller experience is worse than crafting some code, getting it running in debug mode, only to have it be completely non-functional when you program the “release” version. It sucks being stuck with few options to see what is going on.
A potentially big source of such issues on dsPIC 30f/33f devices are the ADPCFG (30f) and the AD1PCFG and AD2PCFG (33f) registers. These cryptic acro-breviations are the locations at which you tell your chip whether an analog pin is to be used for analog input or digital I/O. They are set to 0×0000 on reset, meaning all analog pins are set to analog. Therefore, if you have a digital thingy attached, and you try to use it, it probably won’t work. I say probably because sometimes the debugger can set the analog pins to digital I/O. So if you forget to set all your digital I/O pins to 1’s in the appropriate ADxPCFG register, your program may function perfectly while using the debugger, but fail completely when you try to run it stand-alone.To avoid this hard to debug bug, give this crazy register what it wants. I’d initialize it right after you set up the stack, so when you refer back to that file to see how to initialize the stack you’ll see the weird
mov 0×00fa, w0 mov w0, ADPCFG
and think, “hey, I almost forgot about that stupid thing, good thing I put it way up here. Thanks me.” And your past self will feel a sense of accomplishment in saving future you from hours of fruitless debugging.