REVISI
Setelah beberapa pembaca mengeluh karena ga bisa jalan itu script...dan saya juga bingung dibuatnya, akhirnya terdeteksi bahwa saya menggunakan script dengan ARRAY yang melebihi RAM seperti gambar berikut ini :
Atas permintaan seorang pembaca blog dengan id kaskus sn0bi, kali ini kita akan bahas perancangan 3 LED MATRIX yang menggunakan ATMega 8535. Sebenernya ini adalah perpanjangan dari project LOVE HURT yang hanya menggunakan 1 buat Led Matrix. Untuk mengurangi jumlah komponen yang dipakai, maka ukuran led matrix jangan melebihi dari 2" (inch) . Untuk dapat dirancang diatas breadboard / projectboard dipilihlah led matrix berukuran 1 inch.
Bahan-bahan dan skematiknya seperti berikut ini :
*) catatan : perhatikan port ISP yg digunakan 6 pin..sesuaikan dengan yg kamu gunakan
#define F_CPU 1000000UL //ubah sesuai clock micro #include <avr/io.h> #include <util/delay.h> #include <avr/eeprom.h> #include <inttypes.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <string.h> #define cepat 8 //ubah ini untuk mengatur kecepatan scroll //UPDATED JUNE 9 2014 ...www.aisi555.com .... const char textset[] PROGMEM = {0x30, 0x4a, 0x4a, 0x4a, 0x7c,//a 0x7f, 0x28, 0x44, 0x44, 0x38,//b 0x80, 0x38, 0x44, 0x44, 0x44,//c 0x38, 0x44, 0x44, 0x28, 0x7f,//d 0x38, 0x54, 0x54, 0x54, 0x18,//e 0x08, 0x7e, 0x09, 0x09, 0x02,//f 0x08, 0x54, 0x54, 0x54, 0x3c,//g 0x7f, 0x08, 0x04, 0x04, 0x78,//h 0x80, 0x44, 0x7d, 0x40, 0x80,//i 0x20, 0x40, 0x44, 0x3d, 0x80,//j 0x80, 0x7f, 0x18, 0x24, 0x42,//k 0x80, 0x41, 0x7f, 0x40, 0x80,//l 0x7c, 0x04, 0x78, 0x04, 0x78,//m 0x7c, 0x08, 0x04, 0x04, 0x78,//n 0x38, 0x44, 0x44, 0x44, 0x38,//o 0x7c, 0x14, 0x14, 0x14, 0x08,//p 0x08, 0x14, 0x14, 0x14, 0x7c,//q 0x7c, 0x08, 0x04, 0x04, 0x08,//r 0x48, 0x54, 0x54, 0x54, 0x24,//s 0x80, 0x04, 0x3f, 0x44, 0x44,//t 0x3c, 0x40, 0x40, 0x20, 0x7c,//u 0x1c, 0x20, 0x40, 0x20, 0x1c,//v 0x3c, 0x40, 0x30, 0x40, 0x3c,//w 0x44, 0x28, 0x10, 0x28, 0x44,//x 0x0c, 0x50, 0x50, 0x50, 0x3c,//y 0x44, 0x64, 0x54, 0x4c, 0x44,//z 0x3e, 0x51, 0x49, 0x45, 0x3e, //0 0x80, 0x42, 0x7f, 0x40, 0x80, //1 0x42, 0x61, 0x51, 0x49, 0x46, //2 0x41, 0x41, 0x45, 0x4b, 0x31, //3 0x18, 0x14, 0x12, 0x7f, 0x10, //4 0x27, 0x45, 0x45, 0x45, 0x39, //5 0x3c, 0x4a, 0x49, 0x49, 0x31, //6 0x01, 0x71, 0x09, 0x05, 0x03, //7 0x36, 0x49, 0x49, 0x49, 0x36, //8 0x06, 0x49, 0x49, 0x29, 0x1e, //9 0x7e, 0x11, 0x11, 0x11, 0x7e, //A 0x7f, 0x49, 0x49, 0x49, 0x36, //B 0x3e, 0x41, 0x41, 0x41, 0x22, //C 0x7f, 0x41, 0x41, 0x22, 0x1c, //D 0x7f, 0x49, 0x49, 0x49, 0x41, //E 0x7f, 0x09, 0x09, 0x09, 0x01, //F 0x3e, 0x41, 0x49, 0x49, 0x7a, //G 0x7f, 0x08, 0x08, 0x08, 0x7f, //H 0x80, 0x41, 0x7f, 0x41, 0x80,//I 0x20, 0x40, 0x41, 0x3f, 0x01, //J 0x7f, 0x08, 0x14, 0x22, 0x41, //K 0x7f, 0x40, 0x40, 0x40, 0x40, //L 0x7f, 0x02, 0x04, 0x02, 0x7f, //M 0x7f, 0x04, 0x08, 0x10, 0x7f, //N 0x3e, 0x41, 0x41, 0x41, 0x3e, //O 0x7f, 0x11, 0x11, 0x11, 0x0e, //P 0x3e, 0x41, 0x51, 0x21, 0x5e, //Q 0x7f, 0x09, 0x19, 0x29, 0x46, //R 0x46, 0x49, 0x49, 0x49, 0x31, //S 0x01, 0x01, 0x7f, 0x01, 0x01, //T 0x3f, 0x40, 0x40, 0x40, 0x3f, //U 0x1f, 0x20, 0x40, 0x20, 0x1f, //V 0x3f, 0x40, 0x38, 0x40, 0x3f, //W 0x63, 0x14, 0x08, 0x14, 0x63, //X 0x07, 0x08, 0x70, 0x08, 0x07, //Y 0x61, 0x51, 0x49, 0x45, 0x43, //Z 0x80, 0x80, 0x80};//"" const char textreal[] PROGMEM= { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' ' } ; char blk = 0x80; char fulltext[17] ; char scrolltext[500];//panjang kalimat 300 dibagi 6 (5 kolom + 1pembatas) //UBAH besar ARRAY scroltext[XXX] sesuaikan besar RAM IC yg dipakai.. char textnya[] = "3 Led Matrix ATMega8535 AHOCOOL SurabayA 2013"; void cleartext(void) // MEMBERSIHKAN datanya menjadi kosong { uint8_t i; for(i=0 ; i <20 ; i++) { fulltext[i] = 0 ; } } void convert_text(char *texte) { uint8_t a,b,max_text; int c,d; char dummy[1]; max_text=strlen(texte); for(a=0 ; a<max_text; a++) { for(b=0;b<65;b++) // maximum jumlah definisi text di database array { strncpy_P(dummy,&textreal[b],1); if ( texte[a] == dummy[0]) break; } d=b*5; if(dummy[0] != ' ') for(c=d; c<d+5; c++) strncat_P(scrolltext,&textset[c],1); //spasi else for(c=d; c<d+3; c++) strncat_P(scrolltext,&textset[c],1); strncat(scrolltext,&blk,1); } } void tulis_text(void) { uint8_t a; int b,speed; a=0; speed=5;//UBAH NILAI speed sesuai keinginan dan kedip led while(a<16) { for(b=0;b<speed;b++ ) { if(a<8 ) { PORTD = ~(1<<a) ; PORTC =0b11111111; } else { PORTC = ~(1<<(a-8)) ; PORTD =0b11111111; } PORTA=fulltext[a]; _delay_us(60); PORTA=0x80; //biar tidak berbayang } a++; } } void scrol(char *scrtxt) { uint8_t q,r,step =0; int maxstep; maxstep = (strlen(scrtxt) * 6) ; convert_text(scrtxt); while(step < ( maxstep + 30) ) { if(step < 15) { for(q=0; q <(16-step) ; q++ ) { fulltext[q]= 0x80; } for(q=(15-step); q <16 ; q++ ) { fulltext[q]=scrolltext[q - 15 + step]; } for(r=0;r<cepat;r++) tulis_text(); } else if( step > (maxstep + 15 ) ) { for(q=0; q <(maxstep + 30 - step) ; q++ ) { fulltext[q]=scrolltext[step -15 + q]; } for(q=(maxstep + 30 - step); q <16 ; q++ ) { fulltext[q]= 0x80; } for(r=0;r<cepat;r++) tulis_text(); } else { for(q=0; q <16 ; q++ ) { fulltext[q]=scrolltext[q + step -15]; } for(r=0;r<cepat;r++) tulis_text(); } step++; } } int main(void) { //bagian ini sesuaikan dengan port micro yg kamu gunakan DDRA = 0b11111111; // portA = data text dot matrix DDRC = 0b11111111; //scanning kolom DDRD = 0b11111111; //scanning kolom while(1) { scrol(textnya); cleartext(); } return 0; }
while(a<16)
seperti biasa, jika ingin membeli bahan-bahannya bisa lewat aku, atau paket belajarnya di "custom" dengan 3 led matrix ? bisa...harga nego via contact aku ya...
SELAMAT MENCOBA