Thanks for the compliment. I spent a long time making the code as easy to use as possible. Most of the example code I see on the Arduino is written by non-programmers, so I thought I'd make a full sized, well documented piece of microcontroller code for a change.
Your questions:
Q: Where are the input/output pins specified? (Im sure its been starring me in the face this whole time)
A: The addresses of the IO pins are specified in the WinAVR headers, specifically the headers:
Code:
avr/include/avr/iousb162.h
avr/include/avr/iousbxx2.h
It's useful to generate "TAGS" for a project you're not familiar with, so for Emacs (which I use) I run something like:
Code:
find . -name "*.[c|h] -exec etags -a {} \;
find ../WinAVR -name "*.[c|h] -exec etags -a {} \;
find ../LUFA -name "*.[c|h] -exec etags -a {} \;
to let the "etags" program visit every .c and .h file in my project and libraries and build a database of where these things are first defined. Then I can do a "M-." search for the definition of the value or function under the cursor and the editor jumps me there.
Q: How does the TLC5924 work?
A: The datasheet will tell you everything you need to know.
http://focus.ti.com/docs/prod/folder...t/tlc5924.html
There's an LED BLANK pin that can be used to turn off all LEDS at once but we never use that feature, so we set it LOW during setup and keep it there. After setup the chip works using SPI - we shift in two bytes, 16 bits, where each bit represents one of the LEDs and it turns on or off the LED assocuated with those bits. That's pretty much it. The chip has other features for coping with different LED voltages that we never use. Check out the datasheet.
Q: What does the ADC file do?
A: It controls the ADC chip we added to the board that allows us to read the four analog inputs on the expansion bus. The chips that the Arduino uses have ADC built in, but our chip doesn't (it has USB hardware instead). So to read analog signals we added a MCP3004 chip to the SPI bus. It's data sheet is here:
http://ww1.microchip.com/downloads/e...Doc/21295C.pdf
It's got a fairly straightforward protocol for reading an Analog channel and returning 10 bits of binary data - essentially you shift out 3 specifically formatted bytes over SPI and shifts back in three bytes, the bottom two bytes being the 10-bit ADC value. First byte sent tells it which channel to read and the unused bits in the bytes introduce exactly the right amount of delay for the read and conversion to happen. Nifty.
Bookmarks