Remark: In this post we use the frequency timer library, which was only working for the ATmega168. Better use the "real AVR" interrupt immediately...
Some time ago we bought the LED DISPL. GR 2 3" 8X8 MATRI
Bestnr.: 156380 - 8A at conrad.nl.
Very important you can download the datasheet at conrad service.
First we thought it would be easy to connect the 16 pins, steering 64 LED's. But it proved to be a bit more complicated than we thought. (As usual.)
Looking at the connections you see that you can light one LED, but how to get a pattern running across the matrix of 8 x 8 LED's.
Some tricks are needed!
We have to use a fast timer, from a CPP lib to fool the eye of the beholder, working with the slow response time of the eye. Indeed a camera sees more, which can be seen in the pictures.
here we found the necessary info: http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix
but the FrequencyTimer2.h did not compile right away, we had to modify some lines using advice from here:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1239820770
then we still had a problem, we dived into the CPP file, we encountered some things we didn't really understand.....we tried several changes....
...
...***
...
then as a final try we changed the HIGH in the LOW everywhere in the ARDUINO script, and it worked, why?
comparing the datasheets we noticed that ...indeed...the LED's were turned around, in our device they were in the other way around, compared to the LED matrix used in the script of the link.....
:-(, always the same.....look closer, expect changes everywhere, details details....
but ok, in the end....it worked within a day, and the script is great!
(In this last image the camera sees what the eye cannot see: the LED steered on and off faster than we can see.) Our plan is to built this LED matrix into clothing behind a half transparent outer layer. Use a distance sensor, and change the running text according to distance of others from ourselves...
*** Peter van Vliet explained the (for me) incomprehensible part in the C++ file of the FrequencyTimer2 lib.
What was the problem? We noticed this part at the top of the source file:
{
static uint8_t inHandler = 0; // protect us from recursion if our handler enables interrupts
if ( !inHandler && FrequencyTimer2::onOverflow) {
inHandler = 1;
(*FrequencyTimer2::onOverflow)();
inHandler = 0;
}
}
without a function name....
The explanation is that this part will be flashed in the first part of the program section on top op everything else. It will be called every cycle, which makes sense seeing the purpose of the FrequencyTimer2 lib. So this is special chip (embedded) programming.
Tuesday, July 7, 2009
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment