PessoALL,

 

Andei estudando e fazendo umas alterações em

códigos que peguei na internet, e estou disponibilizando

para todos um código para matrix de led 8x8 ligadas diretamente

no arduino com resistores de 470 ohms para limitação da corrente.

Segue abaixo o código, e oportunamente colocarei um video no Youtube

com o protótipo pronto.

O diferencial é o armazenamento da matriz com o conjunto de caracteres

ANSI (aquele do DOS) em memoria de programação, e não na SRAM que só

tem 4Kb. Bom para estudar esse assunto.

Usei este esquema de ligação:

 

Abraços,

Ivan Souza

 

Código:

 

/*
* Code for an 8 x 8 LED Matrix
* Modified by Ivan Souza for use "program memory" of Arduino (4KB SRAM)
* with use of all charset of IBM-ANSI. This is because the SRAM is small to fit all table.
*
* to contact me: ivansouza at gmail dot com.

* Original file from http://www.facebook.com/vic.alb
*
* Scrolls a message across an 8 x 8 LED Matrix
* To adjust the speed change the variable speed.
* The message is held in requestString[]
*/

#include <avr/pgmspace.h> //Include the handles to work with the program memory

int speed = 20; //number of times to repeat each frame
int pauseDelay = 500; //microseconds to leave each row on before moving to the next

//char requestString[] = ""; //The string to display
String requestString = "IV"; //The string to display
//to change the message in code you right yourself simply
//change this data and reset index and offset to 0

//Variables used for scrolling (both start at 0)
int index = 0; //this is the current characther in the string being displayed
byte offset = 0; //this is how many columns it is offset by
byte cfirst = 0;
byte cnext = 0;
//Pin Definitions
byte rowA[] = {9,8,7,6,5,4,3,2}; //An Array defining which pin each row is attached to
//(rows are common anode (drive HIGH))
byte colA[] = {17,16,15,14,13,12,11,10}; //An Array defining which pin each column is attached to
//(columns are common cathode (drive LOW))

//The array used to hold a bitmap of the display
//(if you wish to do something other than scrolling marque change the data in this
//variable then display)
byte data[] = {0,0,0,0,0,0,0,0};

//The ANSI-PC Charset
//Each Character is an 8 x 8 bitmap where each pos is a map of bits of 1 and 0 in hex format
prog_uchar _CHARSET[256][8] PROGMEM = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x7e, 0x81, 0xa5, 0x81, 0xbd, 0x99, 0x81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, 0x7e, 0x18, 0x7e, 0x3c, 0x18, 0xff },
{ 0x18, 0x3c, 0x7e, 0x18, 0x18, 0x18, 0x18, 0x00 },
{ 0x18, 0x18, 0x18, 0x18, 0x7e, 0x3c, 0x18, 0x00 },
{ 0x00, 0x18, 0x0c, 0xfe, 0x0c, 0x18, 0x00, 0x00 },
{ 0x00, 0x30, 0x60, 0xfe, 0x60, 0x30, 0x00, 0x00 },
{ 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xfe, 0x00, 0x00 },
{ 0x00, 0x24, 0x66, 0xff, 0x66, 0x24, 0x00, 0x00 },
{ 0x00, 0x18, 0x3c, 0x7e, 0xff, 0xff, 0x00, 0x00 },
{ 0x00, 0xff, 0xff, 0x7e, 0x3c, 0x18, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x18, 0x3c, 0x3c, 0x18, 0x18, 0x00, 0x18, 0x00 },
{ 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x6c, 0x6c, 0xfe, 0x6c, 0xfe, 0x6c, 0x6c, 0x00 },
{ 0x18, 0x3e, 0x60, 0x3c, 0x06, 0x7c, 0x18, 0x00 },
{ 0x00, 0xc6, 0xcc, 0x18, 0x30, 0x66, 0xc6, 0x00 },
{ 0x38, 0x6c, 0x38, 0x76, 0xdc, 0xcc, 0x76, 0x00 },
{ 0x18, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x0c, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0c, 0x00 },
{ 0x30, 0x18, 0x0c, 0x0c, 0x0c, 0x18, 0x30, 0x00 },
{ 0x00, 0x66, 0x3c, 0xff, 0x3c, 0x66, 0x00, 0x00 },
{ 0x00, 0x18, 0x18, 0x7e, 0x18, 0x18, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30 },
{ 0x00, 0x00, 0x00, 0x7e,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6, 0x6c, 0x38, 0x6c, 0xc6, 0xc6, 0x00 },
{ 0x66, 0x66, 0x66, 0x3c, 0x18, 0x18, 0x3c, 0x00 },
{ 0xfe, 0xc6, 0x8c, 0x18, 0x32, 0x66, 0xfe, 0x00 },
{ 0x3c, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3c, 0x00 },
{ 0xc0, 0x60, 0x30, 0x18, 0x0c, 0x06, 0x02, 0x00 },
{ 0x3c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x3c, 0x00 },
{ 0x10, 0x38, 0x6c, 0xc6, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff },
{ 0x30, 0x18, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x78, 0x0c, 0x7c, 0xcc, 0x76, 0x00 },
{ 0xe0, 0x60, 0x7c, 0x66, 0x66, 0x66, 0xdc, 0x00 },
{ 0x00, 0x00, 0x7c, 0xc6, 0xc0, 0xc6, 0x7c, 0x00 },
{ 0x1c, 0x0c, 0x7c, 0xcc, 0xcc, 0xcc, 0x76, 0x00 },
{ 0x00, 0x00, 0x7c, 0xc6, 0xfe, 0xc0, 0x7c, 0x00 },
{ 0x3c, 0x66, 0x60, 0xf8, 0x60, 0x60, 0xf0, 0x00 },
{ 0x00, 0x00, 0x76, 0xcc, 0xcc, 0x7c, 0x0c, 0xf8 },
{ 0xe0, 0x60, 0x6c, 0x76, 0x66, 0x66, 0xe6, 0x00 },
{ 0x18, 0x00, 0x38, 0x18, 0x18, 0x18, 0x3c, 0x00 },
{ 0x06, 0x00, 0x06, 0x06, 0x06, 0x66, 0x66, 0x3c },
{ 0xe0, 0x60, 0x66, 0x6c, 0x78, 0x6c, 0xe6, 0x00 },
{ 0x38, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3c, 0x00 },
{ 0x00, 0x00, 0xec, 0xfe, 0xd6, 0xd6, 0xd6, 0x00 },
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 0x66, 0xcc, 0x66, 0x33, 0x00, 0x00 },
{ 0x00, 0xcc, 0x66, 0x33, 0x66, 0xcc, 0x00, 0x00 },
{ 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88 },
{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa },
{ 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd, 0x77, 0xdd },
{ 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
{ 0x36, 0x36, 0x36, 0x36, 0xf6, 0x36, 0x36, 0x36 },
{ 0x00, 0x00, 0x00, 0x00, 0xfe, 0x36, 0x36, 0x36 },
{ 0x00, 0x00, 0xf8, 0x18, 0xf8, 0x18, 0x18, 0x18 },
{ 0x36, 0x36, 0xf6, 0x06, 0xf6, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 },
{ 0x00, 0x00, 0xfe, 0x06, 0xf6, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0xf6, 0x06, 0xfe, 0x00, 0x00, 0x00 },
{ 0x36, 0x36, 0x36, 0x36, 0xfe, 0x00, 0x00, 0x00 },
{ 0x18, 0x18, 0xf8, 0x18, 0xf8, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00 },
{ 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18 },
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00 },
{ 0x18, 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
{ 0x36, 0x36, 0x36, 0x36, 0x37, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0x37, 0x30, 0x3f, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x3f, 0x30, 0x37, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0xf7, 0x00, 0xff, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0xff, 0x00, 0xf7, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0x37, 0x30, 0x37, 0x36, 0x36, 0x36 },
{ 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
{ 0x36, 0x36, 0xf7, 0x00, 0xf7, 0x36, 0x36, 0x36 },
{ 0x18, 0x18, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00 },
{ 0x36, 0x36, 0x36, 0x36, 0xff, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0xff, 0x00, 0xff, 0x18, 0x18, 0x18 },
{ 0x00, 0x00, 0x00, 0x00, 0xff, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0x36, 0x36, 0x3f, 0x00, 0x00, 0x00 },
{ 0x18, 0x18, 0x1f, 0x18, 0x1f, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x1f, 0x18, 0x1f, 0x18, 0x18, 0x18 },
{ 0x00, 0x00, 0x00, 0x00, 0x3f, 0x36, 0x36, 0x36 },
{ 0x36, 0x36, 0x36, 0x36, 0xff, 0x36, 0x36, 0x36 },
{ 0x18, 0x18, 0xff, 0x18, 0xff, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18 },
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff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0x18, 0x7e, 0x18, 0x18, 0x00, 0x7e, 0x00 },
{ 0x30, 0x18, 0x0c, 0x18, 0x30, 0x00, 0x7e, 0x00 },
{ 0x0c, 0x18, 0x30, 0x18, 0x0c, 0x00, 0x7e, 0x00 },
{ 0x0e, 0x1b, 0x1b, 0x18, 0x18, 0x18, 0x18, 0x18 },
{ 0x18, 0x18, 0x18, 0x18, 0x18, 0xd8, 0xd8, 0x70 },
{ 0x00, 0x18, 0x00, 0x7e, 0x00, 0x18, 0x00, 0x00 },
{ 0x00, 0x76, 0xdc, 0x00, 0x76, 0xdc, 0x00, 0x00 },
{ 0x38, 0x6c, 0x6c, 0x38, 0x00, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00 },
{ 0x0f, 0x0c, 0x0c, 0x0c, 0xec, 0x6c, 0x3c, 0x1c },
{ 0x6c, 0x36, 0x36, 0x36, 0x36, 0x00, 0x00, 0x00 },
{ 0x78, 0x0c, 0x18, 0x30, 0x7c, 0x00, 0x00, 0x00 },
{ 0x00, 0x00, 0x3c, 0x3c, 0x3c, 0x3c, 0x00, 0x00 },
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
}
;

//Setup runs once when power is applied
void setup()
{
for(byte i = 0; i <8; i++){ //Set the 16 pins used to control the array as OUTPUTs
pinMode(rowA[i], OUTPUT);
pinMode(colA[i], OUTPUT);
}

// For Demo purposes, this cycle all charset... if you want just show the message,
// set the variable requestString below with the message to show

requestString="Ivan";

if (requestString=="") {
requestString="";
for(byte lp = 0; lp <255; lp++) {
requestString = requestString + byte(lp);
}
}
}

//repeats
void loop()
{
updateMatrix();
}

void updateMatrix(){
loadSprite();
showSprite(speed);
}

//An array holding the powers of 2 these are used as bit masks when calculating what to display
const byte powers[] = {1,2,4,8,16,32,64,128};

//Loads the current scroll state frame into the data[] display array
void loadSprite(){
cfirst = requestString[index]; // get first character to display
cnext = requestString[index+1]; // get next character to display
if(index+1==requestString.length()) { cfirst = requestString[index]; cnext = requestString[0]; } // cycle to first character
for(byte row=0; row < 8; row++){ //iterate through each row
data[row] = 0; //reset the row we're working on
for(byte column=0; column < 8; column++){ //iterate through each column
data[row] = data[row] + ((powers[column] & (pgm_read_byte(&_CHARSET[cfirst][row]) offset))); //loads the current charachter offset by offset pixels
data[row] = data[row] + (powers[column] & (pgm_read_byte(&_CHARSET[cnext][row]) >> (8-offset) )); //loads the next charachter offset by offset pixels
}
}
offset++; //increment the offset by one row
//if(offset==8){offset = 0; index++; if(index>sizeof(requestString)){index=0;}} //if offset is 8 load the next charachter pair for the next time through
if(offset==8){offset = 0; index++; if(index==requestString.length()){index=0;}} //if offset is 8 load the next charachter pair for the next time through

//if(offset==8){offset = 0; index++; if(index==requestString.length()){index=0;}} //if offset is 8 load the next charachter pair for the next time through

}

void showSprite(int speed2){
for(int iii = 0; iii < speed2; iii++){ //show the current frame speed2 times
for(byte column = 0; column < 8; column++){ //iterate through each column
for(byte i = 0; i < 8; i++){
digitalWrite(rowA[i], LOW); //turn off all row pins
}
for(byte i = 0; i < 8; i++){ //Set only the one pin
if(i == column){ digitalWrite(colA[i], LOW);} //turns the current row on
else{ digitalWrite(colA[i], HIGH); }//turns the rest of the rows off
}

for(byte row = 0; row < 8; row++){ //iterate through each pixel in the current column
byte bit = (data[column] >> row) & 1;
if(bit == 1){
digitalWrite(rowA[row], HIGH); //if the bit in the data array is set turn the LED on
}

}
delayMicroseconds(pauseDelay); //leave the column on for pauseDelay microseconds (too high a delay causes flicker)
}
}
}

 

 

Tags: 8x8, ANSI, DOS, PROGMEM, SRAM, bicolor, charset, matrix, matriz, memória

Exibições: 590

Anexos

Responder esta

Publicidade

Convide um amigo para o Lab!

 Loja Lab de Garagem

curso gratis de arduino

Easy VR Shield 2.0
Reconhecedor de Voz

Por: R$ 264,00

Ou em até 18x de R$ 17,59

SuperKit
Arduino Mega 2560 R3

Por: R$ 319,00

Ou em até 18x de R$ 21,26

Dimmer Shield

Por: 49,00

Ou em até 11x de R$ 5,00

Sensor de fluxo de água 3/4

Por: R$ 68,00

Ou em até 16x de R$ 5,00

© 2014   Criado por Marcelo Rodrigues.

Badges  |  Relatar um incidente  |  Termos de serviço