jlach9
August 1, 2015, 2:52am
1
This lights up almost all of the lights. I'm trying to figure out how to light a full row at a time.
#include <avr/io.h>
#include <util/delay.h>
#define BLINK_DELAY_MS 1000
int main (void)
{
//rows
//DDRB |= _BV(DDB5); /* set pin 5 of PORTB for output*/
//DDRB |= _BV(DDB3); /* set pin 3 of PORTB for output arduino pin 11*/
//DDRD |= _BV(DDD6); /* set pin 6 of PORTD for output arduino pin 6*/
//DDRB |= _BV(DDB2); /* set pin 2 of PORTB for output arduino pin 10*/
//DDRD |= _BV(DDD3); /* set pin 3 of PORTD for output arduino pin 3*/
//DDRC |= _BV(DDC3); /* set pin 3 of portC for output arduino pin A3*/
//DDRD |= _BV(DDD4); /* set pin 4 of PORTD for output arduino pin 4*/
//DDRB |= _BV(DDB0); /* set pin 0 of PORTB for output arduino pin 8*/
//DDRB |= _BV(DDB1); /* set pin 1 of PORTB for output arduino pin 9*/
//columns
//DDRD |= _BV(DDD2); /* set pin 2 of PORT2 for output arduino pin 11*/
//DDRD |= _BV(DDD7);
//DDRC |= _BV(DDC5);
//DDRD |= _BV(DDD5);
//DDRB |= _BV(DDB5);
//DDRC |= _BV(DDC4);
//DDRB |= _BV(DDB4);
//DDRC |= _BV(DDC2);
/*
DDRD = B11111100;
DDRB = B11111111;
DDRC = B11111111;
*/
DDRB |= 0xFF; // everbody output!
DDRD |= 0xFF;
DDRC |= 0xFF;
//PORTD = 0x00;
while(1) {
/* set pin 5 high to turn led on */
//PORTB |= _BV(PORTB5);
//PORTB |= _BV(PORTB3);
//PORTD |= _BV(PORTD6);
//PORTB |= _BV(PORTB2);
//PORTD |= _BV(PORTD3);
//PORTC |= _BV(PORTC3); /* set pin 3 of portC for output arduino pin A3*/
//PORTD |= _BV(PORTD4); /* set pin 4 of PORTD for output arduino pin 4*/
// PORTB |= _BV(PORTB0); /* set pin 0 of PORTB for output arduino pin 8*/
// PORTB |= _BV(PORTB1);
//column
PORTD |= _BV(PORTD2);
PORTD |= _BV(PORTD7);
PORTC |= _BV(PORTC5);
PORTD |= _BV(PORTD5);
PORTB |= _BV(PORTB5);
PORTC |= _BV(PORTC4);
PORTB |= _BV(PORTB4);
PORTC |= _BV(PORTC2);
/* set pin 5 low to turn led off */
//PORTB &= ~_BV(PORTB5);
//PORTB &= ~_BV(PORTB3);
//PORTD &= ~_BV(PORTD6);
//PORTB &= ~_BV(PORTB2);
//PORTD &= ~_BV(PORTD3);
//_delay_ms(BLINK_DELAY_MS);
}
}
Specifications of the display would seem to be critical here.
Weedpharma
jlach9
August 1, 2015, 3:01am
3
It's set up exactly like this.
jlach9
August 1, 2015, 4:46am
4
I've managed to get the following code to light up the board. I also have the hex values to draw a heart on the board. I can't figure out how to put those hex values into those pins(ports?) to get the picture to display correctly. What I have below didn't work. The commented out section above where I write the hex values and below "column" lit up almost the entire board when not commented.
#include <avr/io.h>
#include <util/delay.h>
#define BLINK_DELAY_MS 1000
int main (void)
{
DDRB |= 0xFF; // everbody output!
DDRD |= 0xFF;
DDRC |= 0xff;
while(1) {
/* set pin 5 high to turn led on */
PORTB |= _BV(PORTB5);
//PORTB |= _BV(PORTB3);
//PORTD |= _BV(PORTD6);
//PORTB |= _BV(PORTB2);
//PORTD |= _BV(PORTD3);
//PORTC |= _BV(PORTC3); /* set pin 3 of portC for output arduino pin A3*/
//PORTD |= _BV(PORTD4); /* set pin 4 of PORTD for output arduino pin 4*/
//PORTB |= _BV(PORTB0); /* set pin 0 of PORTB for output arduino pin 8*/
//PORTB |= _BV(PORTB1);
//column
/* PORTD |= _BV(PORTD2); //col8
PORTD |= _BV(PORTD7); //col7
PORTC |= _BV(PORTC5); //col6
PORTD |= _BV(PORTD5); //col5
PORTB |= _BV(PORTB5); //col4
PORTC |= _BV(PORTC4); //col3
PORTB |= _BV(PORTB4); //col2
PORTC |= _BV(PORTC2); //col1
*/
PORTD |= _BV(0x00); //col8
PORTD |= _BV(0x18); //col7
PORTC |= _BV(0x3C); //col6
PORTD |= _BV(0x7E); //col5
PORTB |= _BV(0xFF); //col4
PORTC |= _BV(0xFF); //col3
PORTB |= _BV(0x66); //col2
PORTC |= _BV(0x00); //col1
//unsigned char row_val[8]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};
//unsigned char col_val[8]={0x00,0x66,0xff,0xff,0x7e,0x3c,0x18,0x00};
}
}
Paul_B
August 1, 2015, 6:00am
5
That is the craziest piece of code I have seen for some time!
You have all sorts of things commented out, and what is left simply turns everything on.
While my usual advice is to buy a MAX7219 module on eBay, the current idea can almost work, if no-one else answers in the next 2 hours I will look into it!

Robin2
August 1, 2015, 7:08am
6
Don't split your project across several Threads. Keep it all togther so people can see all the info.
...R
First, you should have a function that can turn on/off a pixel at the given coordinates (of the 8x8 matrix).
The implementation of this function depends on your hardware.
Once you have this function, read this post to understand how to draw a bitmap.
Paul_B
August 1, 2015, 2:05pm
8
'Fraid I am going to pass on this one for the present.
That board diagram is wrong - the resistors are wrong and there are no buffer transistors.
Suggest you look for the module I cited.
PaulRB
August 1, 2015, 2:40pm
9
jlach9:
It's set up exactly like this.
http://1.bp.blogspot.com/-GF-kLf0a-Fo/VNO7RUHQPLI/AAAAAAAAMM0/l9i3TvW2kWc/s1600/Uno_8x8_LedMatrix.png
That's wrong and will damage the Arduino.
What other components have you got, like chips or transistors? Have you got 8 identical transistors, or perhaps a uln2803?
If not, go for Paul__B's suggestion.
Paul (RB)