'MAX7219'에 해당되는 글 2건

  1. 2016.10.05 8-Digit 7 Segment Module (MAX7219) [D066]
  2. 2016.09.21 MAX7219 Dot Matrix Module (MAX7219) [D057]

8-Digit 7 Segment Module (MAX7219) [D066]




https://www.youtube.com/watch?v=m5Ej3hZ2OkI


* GitHub : https://github.com/rdiot/rdiot-d066.git


* Specs

Features:

100% Brand new and high quality

MAX7219 digital display control module

This module is compatible with 5V and 3.3V microcontrollers.

You you can use it for Arduino

MAX7219 is an integrated serial input / output common-cathode display driver, which connects your microprocessor to a 7-segment digital LED display with 8 digits.

Only three IO ports are used to drive the eight digit display. MAX7219 supports flicker free displays as well as cascading displays.


Specifications:

Material: PCB + Electronic Components

Power: 5V

Size: 82*15*12mm(L*W*H)

Shell Color: Blue & black

Net Weight:13g


Package includes:

1* MAX7219 digital display module

1* Straight 5 pin header

1* 90 degree 5 pin header


Wiring instructions(for example, it can connect any IO port, modified the Port Definition in the program):

VCC: 5V

GND: GND

DIN: P00

CS: P01

CLK: P02



* Contents

- Connect

DIN........D11

CS (LOAD)..D10

CLK........D13


- Library : https://github.com/HobbyComponents/HCMAX7219


- Key Code (Tested Example)

/* FILE:    HCMODU0082_Serial_7_Segment_Module_Example1

   DATE:    19/03/15

   VERSION: 0.2

  

REVISIONS:

12/03/15 Created version 0.1

19/03/15 Updated to work with V0.2 of the HCMAX7219 library

This is an example of how to use the Hobby Components serial 8 digit seven 7 

segment display module (HCMODU0082). To use this example sketch you will 

need to download and install the HCMAX7921 library available from the software

section of our support forum (forum.hobbycomponents.com) or on github:

(https://github.com/HobbyComponents)


The library assumes you are using one module. If you have more than one module

connected together then you will need to change the following line in the 

libraries HCMAX7219.h header file to the number of drivers you have connected:


#define NUMBEROFDRIVERS 1 <- Change this number


PINOUT:

MODULE.....UNO/NANO.....MEGA

VCC........+5V..........+5V

GND........GND..........GND

DIN........11...........51

CS (LOAD)..10...........10

CLK........13...........52


You may copy, alter and reuse this code in any way you like, but please leave

reference to HobbyComponents.com in your comments if you redistribute this code.

This software may not be used directly for the purpose of promoting products that

directly compete with Hobby Components Ltd's own range of products.


THIS SOFTWARE IS PROVIDED "AS IS". HOBBY COMPONENTS MAKES NO WARRANTIES, 

WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED 

WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ACCURACY OR

LACK OF NEGLIGENCE. HOBBY COMPONENTS SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE

FOR ANY DAMAGES INCLUDING, BUT NOT LIMITED TO, SPECIAL, INCIDENTAL OR 

CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER. */


/* Include the HCMAX7219 and SPI library */

#include <HCMAX7219.h>

#include "SPI.h"


/* Set the LOAD (CS) digital pin number*/

#define LOAD 10


/* Create an instance of the library */

HCMAX7219 HCMAX7219(LOAD);


/* Main program */

void loop() 

{

  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("HELLO !!",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("D066",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("8-Digit",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("MAX7219",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  HCMAX7219.Clear();

  for (int Position = 1; Position <= 7; Position++)

  { 

    HCMAX7219.print7Seg(-1234567,Position,8);

    HCMAX7219.Refresh();

    delay(1000);

  }



  /* Clear the output buffer */

  HCMAX7219.Clear();


  /* Write some text to the output buffer */

  HCMAX7219.print7Seg("BYE",8);


  /* Send the output buffer to the display */

  HCMAX7219.Refresh();  


  delay(2000);


  while(1);

}

Posted by RDIoT
|

MAX7219 Dot Matrix Module (MAX7219) [D057]




https://www.youtube.com/watch?v=cnNFbljvSt0


* Specs

MAX7219 Dot matrix module display module DIY kit SCM control module


* Contents

- Key Code (Ref : https://brainy-bits.com/tutorials/how-to-control-max7219-led-matrix/)

nt dataIn = 12;

int load = 10;

int clock = 11;

 

int maxInUse = 4;    //change this variable to set how many MAX7219's you'll use

 

int e = 0;           // just a variable

 

// 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 stuff

  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 addressing different MAX7219's,

//while 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 stuff

  digitalWrite(load,HIGH);

}

 

 

void setup () {

 

  pinMode(dataIn, OUTPUT);

  pinMode(clock,  OUTPUT);

  pinMode(load,   OUTPUT);

 

  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);

 

 //if you use more than one MAX7219, it should look like this

  

  maxAll(1,1);                       //  + - - - - - - -

  maxAll(2,3);                       //  + + - - - - - -

  maxAll(3,7);                       //  + + + - - - - -

  maxAll(4,15);                      //  + + + + - - - -

  maxAll(5,31);                      //  + + + + + - - -

  maxAll(6,63);                      //  + + + + + + - -

  maxAll(7,127);                     //  + + + + + + + -

  maxAll(8,255);                     //  + + + + + + + +

  

 delay(2000);

 

  //if you use more than one max7219 the second one should look like this

  /*

  maxOne(2,1,1);                       //  + - - - - - - -

  maxOne(2,2,2);                       //  - + - - - - - -

  maxOne(2,3,4);                       //  - - + - - - - -

  maxOne(2,4,8);                       //  - - - + - - - -

  maxOne(2,5,16);                      //  - - - - + - - -

  maxOne(2,6,32);                      //  - - - - - + - -

  maxOne(2,7,64);                      //  - - - - - - + -

  maxOne(2,8,128);                     //  - - - - - - - +

  */

 

  delay(2000);

 

}

Posted by RDIoT
|