Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« on: January 24, 2013, 05:53:45 pm » |
been looking for tutorials on this - (i just finished soldering it altogether and i want to use it),but none really to be found..  thanks in advance
|
|
|
|
« Last Edit: January 24, 2013, 05:56:49 pm by Ruffsta »
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25497
Solder is electric glue
|
 |
« Reply #1 on: January 24, 2013, 06:00:33 pm » |
|
|
|
|
|
Logged
|
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #2 on: January 24, 2013, 06:11:14 pm » |
k,, ty.. but also looking how to hook up the outer pins to the arduino..
|
|
|
|
|
Logged
|
|
|
|
|
North Queensland, Australia
Online
Edison Member
Karma: 31
Posts: 1180
|
 |
« Reply #3 on: January 24, 2013, 06:16:45 pm » |
Never used one but from the code, I saw this: int dataIn = 2; int load = 3; int clock = 4; and on the left of your picture are the connections: DIN CS CLK so I think they match up like this: int dataIn = 2; //DIN int load = 3; //CS int clock = 4; //CLK
|
|
|
|
|
Logged
|
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #4 on: January 24, 2013, 06:23:12 pm » |
but there are 10 pins.. only 3 to make this work?
|
|
|
|
|
Logged
|
|
|
|
|
New Jersey
Offline
Edison Member
Karma: 24
Posts: 2350
|
 |
« Reply #5 on: January 24, 2013, 07:27:58 pm » |
but there are 10 pins.. only 3 to make this work?
Looks that way. Check out the link to the tutorial in the code that pyro_65 linked to. It'll be 5 of course though since you'll need vcc and ground.
|
|
|
|
|
Logged
|
|
|
|
|
Sydney
Offline
God Member
Karma: 14
Posts: 717
Big things come in large packages
|
 |
« Reply #6 on: January 24, 2013, 07:28:53 pm » |
3 are already mentioned. The other 2 are Gnd and Vcc, not much imagination required here.
The other 5 pins are the same and they are the output side (DOUT is the opposite of DIN). These modules can be daisy chained. If you wanted to add the second or more modules you connect the 'output' of one board to the 'input' of another.
|
|
|
|
« Last Edit: January 24, 2013, 07:31:01 pm by marco_c »
|
Logged
|
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #7 on: January 25, 2013, 07:12:13 am » |
k, ty code doesn't work.. int dataIn = 2; int load = 3; int clock = 4; int maxInUse = 1; //change this variable to set how many MAX7219's you'll use int e = 0; // just a varialble // define max7219 registers byte max7219_reg_noop = 0x00; byte max7219_reg_digit0 = 0x01; byte max7219_reg_digit1 = 0x02; byte max7219_reg_digit2 = 0x03; byte max7219_reg_digit3 = 0x04; byte max7219_reg_digit4 = 0x05; byte max7219_reg_digit5 = 0x06; byte max7219_reg_digit6 = 0x07; byte max7219_reg_digit7 = 0x08; byte max7219_reg_decodeMode = 0x09; byte max7219_reg_intensity = 0x0a; byte max7219_reg_scanLimit = 0x0b; byte max7219_reg_shutdown = 0x0c; byte max7219_reg_displayTest = 0x0f; void putByte(byte data) { byte i = 8; byte mask; while(i > 0) { mask = 0x01 << (i - 1); // get bitmask digitalWrite( clock, LOW); // tick if (data & mask){ // choose bit digitalWrite(dataIn, HIGH);// send 1 }else{ digitalWrite(dataIn, LOW); // send 0 } digitalWrite(clock, HIGH); // tock --i; // move to lesser bit } } void maxSingle( byte reg, byte col) { //maxSingle is the "easy" function to use for a //single max7219 digitalWrite(load, LOW); // begin putByte(reg); // specify register putByte(col);//((data & 0x01) * 256) + data >> 1); // put data digitalWrite(load, LOW); // and load da shit digitalWrite(load,HIGH); } void maxAll (byte reg, byte col) { // initialize all MAX7219's in the system int c = 0; digitalWrite(load, LOW); // begin for ( c =1; c<= maxInUse; c++) { putByte(reg); // specify register putByte(col);//((data & 0x01) * 256) + data >> 1); // put data } digitalWrite(load, LOW); digitalWrite(load,HIGH); } void maxOne(byte maxNr, byte reg, byte col) { //maxOne is for adressing different MAX7219's, //whilele having a couple of them cascaded int c = 0; digitalWrite(load, LOW); // begin for ( c = maxInUse; c > maxNr; c--) { putByte(0); // means no operation putByte(0); // means no operation } putByte(reg); // specify register putByte(col);//((data & 0x01) * 256) + data >> 1); // put data for ( c =maxNr-1; c >= 1; c--) { putByte(0); // means no operation putByte(0); // means no operation } digitalWrite(load, LOW); // and load da shit digitalWrite(load,HIGH); } void setup () { pinMode(dataIn, OUTPUT); pinMode(clock, OUTPUT); pinMode(load, OUTPUT); beginSerial(9600); //------------------------------------first error, this is not defined digitalWrite(13, HIGH); //initiation of the max 7219 maxAll(max7219_reg_scanLimit, 0x07); maxAll(max7219_reg_decodeMode, 0x00); // using an led matrix (not digits) maxAll(max7219_reg_shutdown, 0x01); // not in shutdown mode maxAll(max7219_reg_displayTest, 0x00); // no display test for (e=1; e<=8; e++) { // empty registers, turn all LEDs off maxAll(e,0); } maxAll(max7219_reg_intensity, 0x0f & 0x0f); // the first 0x0f is the value you can set // range: 0x00 to 0x0f } void loop () { //if you use just one MAX7219 it should look like this maxSingle(1,1); // + - - - - - - - maxSingle(2,2); // - + - - - - - - maxSingle(3,4); // - - + - - - - - maxSingle(4,8); // - - - + - - - - maxSingle(5,16); // - - - - + - - - maxSingle(6,32); // - - - - - + - - maxSingle(7,64); // - - - - - - + - maxSingle(8,128); // - - - - - - - + delay(2000); }
|
|
|
|
« Last Edit: January 25, 2013, 08:07:55 am by Ruffsta »
|
Logged
|
|
|
|
|
Global Moderator
UK
Online
Brattain Member
Karma: 137
Posts: 19047
I don't think you connected the grounds, Dave.
|
 |
« Reply #8 on: January 25, 2013, 08:04:09 am » |
Time to get your scope out.
|
|
|
|
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #9 on: January 25, 2013, 08:12:03 am » |
let me use yours so i can see what you see..
|
|
|
|
|
Logged
|
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #10 on: January 25, 2013, 08:32:15 am » |
this code works.. just need to switch pins on the arduino to 8,9 and 10 unsigned char i; unsigned char j; /*port definition*/ int Max7219_pinCLK = 10; int Max7219_pinCS = 9; int Max7219_pinDIN = 8;
unsigned char disp1[38][8]={ {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0 {0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1 {0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2 {0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3 {0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4 {0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5 {0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6 {0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7 {0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8 {0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9 {0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A {0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B {0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C {0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F {0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G {0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H {0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I {0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J {0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L {0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M {0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O {0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P {0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q {0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R {0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S {0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T {0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U {0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V {0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W {0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X {0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y {0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z {0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese character {0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese character };
void Write_Max7219_byte(unsigned char DATA) { unsigned char i; digitalWrite(Max7219_pinCS,LOW); for(i=8;i>=1;i--) { digitalWrite(Max7219_pinCLK,LOW); digitalWrite(Max7219_pinDIN,DATA&0x80);//Obtain the MSB of the data DATA = DATA<<1; digitalWrite(Max7219_pinCLK,HIGH); } }
void Write_Max7219(unsigned char address,unsigned char dat) { digitalWrite(Max7219_pinCS,LOW); Write_Max7219_byte(address); // Write_Max7219_byte(dat); // digitalWrite(Max7219_pinCS,HIGH); }
void Init_MAX7219(void) { Write_Max7219(0x09, 0x00); //decode: BCD Write_Max7219(0x0a, 0x03); //Brightness Write_Max7219(0x0b, 0x07); // Write_Max7219(0x0c, 0x01); // Write_Max7219(0x0f, 0x00); // }
void setup() { pinMode(Max7219_pinCLK,OUTPUT); pinMode(Max7219_pinCS,OUTPUT); pinMode(Max7219_pinDIN,OUTPUT); delay(50); Init_MAX7219(); }
void loop() { for(j=0;j<38;j++) { for(i=1;i<9;i++) Write_Max7219(i,disp1[j][i-1]); delay(500); } }
|
|
|
|
|
Logged
|
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #11 on: January 25, 2013, 08:46:29 am » |
k, what i don't get in this code.. is: {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//0 {0x10,0x18,0x14,0x10,0x10,0x10,0x10,0x10},//1 {0x7E,0x2,0x2,0x7E,0x40,0x40,0x40,0x7E},//2 {0x3E,0x2,0x2,0x3E,0x2,0x2,0x3E,0x0},//3 {0x8,0x18,0x28,0x48,0xFE,0x8,0x8,0x8},//4 {0x3C,0x20,0x20,0x3C,0x4,0x4,0x3C,0x0},//5 {0x3C,0x20,0x20,0x3C,0x24,0x24,0x3C,0x0},//6 {0x3E,0x22,0x4,0x8,0x8,0x8,0x8,0x8},//7 {0x0,0x3E,0x22,0x22,0x3E,0x22,0x22,0x3E},//8 {0x3E,0x22,0x22,0x3E,0x2,0x2,0x2,0x3E},//9 {0x8,0x14,0x22,0x3E,0x22,0x22,0x22,0x22},//A {0x3C,0x22,0x22,0x3E,0x22,0x22,0x3C,0x0},//B {0x3C,0x40,0x40,0x40,0x40,0x40,0x3C,0x0},//C {0x7C,0x42,0x42,0x42,0x42,0x42,0x7C,0x0},//D {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x7C},//E {0x7C,0x40,0x40,0x7C,0x40,0x40,0x40,0x40},//F {0x3C,0x40,0x40,0x40,0x40,0x44,0x44,0x3C},//G {0x44,0x44,0x44,0x7C,0x44,0x44,0x44,0x44},//H {0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x7C},//I {0x3C,0x8,0x8,0x8,0x8,0x8,0x48,0x30},//J {0x0,0x24,0x28,0x30,0x20,0x30,0x28,0x24},//K {0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x7C},//L {0x81,0xC3,0xA5,0x99,0x81,0x81,0x81,0x81},//M {0x0,0x42,0x62,0x52,0x4A,0x46,0x42,0x0},//N {0x3C,0x42,0x42,0x42,0x42,0x42,0x42,0x3C},//O {0x3C,0x22,0x22,0x22,0x3C,0x20,0x20,0x20},//P {0x1C,0x22,0x22,0x22,0x22,0x26,0x22,0x1D},//Q {0x3C,0x22,0x22,0x22,0x3C,0x24,0x22,0x21},//R {0x0,0x1E,0x20,0x20,0x3E,0x2,0x2,0x3C},//S {0x0,0x3E,0x8,0x8,0x8,0x8,0x8,0x8},//T {0x42,0x42,0x42,0x42,0x42,0x42,0x22,0x1C},//U {0x42,0x42,0x42,0x42,0x42,0x42,0x24,0x18},//V {0x0,0x49,0x49,0x49,0x49,0x2A,0x1C,0x0},//W {0x0,0x41,0x22,0x14,0x8,0x14,0x22,0x41},//X {0x41,0x22,0x14,0x8,0x8,0x8,0x8,0x8},//Y {0x0,0x7F,0x2,0x4,0x8,0x10,0x20,0x7F},//Z {0x8,0x7F,0x49,0x49,0x7F,0x8,0x8,0x8},//Chinese character {0xFE,0xBA,0x92,0xBA,0x92,0x9A,0xBA,0xFE},//Chinese character trying to make sense of it.. you can the code here: http://www.linksprite.com/download/showdownload.php?lang=en&id=223or here (takes you to the same exact same place): http://www.linksprite.com/upload/file/1347631413.txtModerator edit: Tags corrected
|
|
|
|
« Last Edit: January 25, 2013, 08:47:44 am by AWOL »
|
Logged
|
|
|
|
|
Global Moderator
UK
Online
Brattain Member
Karma: 137
Posts: 19047
I don't think you connected the grounds, Dave.
|
 |
« Reply #12 on: January 25, 2013, 08:49:19 am » |
trying to make sense of it.. They're bit patterns, for your dot-matrix display. Eight bytes per character, each byte with eight bits. At the moment, they're consuming precious RAM - they might be better placed in PROGMEM.
|
|
|
|
« Last Edit: January 25, 2013, 08:52:47 am by AWOL »
|
Logged
|
Pete, it's a fool looks for logic in the chambers of the human heart.
|
|
|
|
Rhode Island - USA
Offline
Full Member
Karma: 0
Posts: 132
|
 |
« Reply #13 on: January 25, 2013, 09:01:33 am » |
again, i'm new.. so.. i'm at a loss here.. they might be better placed in PROGMEM sorry, but i don't know how to do that yet or how to modify the code to do such.. i just got this for him and he soldered it all up - (since i have soldered for years, i taught him how to and he does exceptionally well).. so the coding is not what we are used to. i thought getting this thing - (the arduino and such), for my son was going to be fun.. something we could do together as a father/son time thing, but in the end - it's more confusing than anything. starting to wonder why i even bothered getting him this even tho he's into building and coding stuff, but i think this may be just too much for him at 13 - i know it is for me at 39...
|
|
|
|
« Last Edit: January 25, 2013, 09:03:48 am by Ruffsta »
|
Logged
|
|
|
|
|
Sydney
Offline
God Member
Karma: 14
Posts: 717
Big things come in large packages
|
 |
« Reply #14 on: January 25, 2013, 09:11:35 am » |
Never underestimate a 13 year old when it comes to computer technology ...
Did you start wih easier stuff like the LED blinker and reading an analog input? I find it is good to get the basics right and build on that.
|
|
|
|
|
Logged
|
|
|
|
|
|