Semua Tentang Belajar Teknologi Digital Dalam Kehidupan Sehari - Hari

Jumat, 05 Agustus 2011

Bermain Dengan Dot Matrix "LoveHurt"


=== REMAKE 2020 BISA DIBACA DISINI ====





  =======================================================




Siapkan bahan-bahan seperti berikut:





Attiny 2313
Led matrix 7x5
R 10K
Diode 4148
PCB lobang
Header 2x5 buat ISP programmer (optional - Bisa diprogram di Breadboard)
Socket 20 untuk ATtiny, dan soket 14 ( dibelah dua ) buat tempat Led matrix

rangkaiannya seperti ini :




Kemudian komponen dirangkai diatas PCB lobang, ato bisa juga memakai bahan lain( disesuaikan dengan tempat yg mau di pake, misale kotak hadiah , papan tripleks dan lain sebagainya)




letakkan LED MATRIX sesuai dengan SOCKET IC yg dibelah tadi



karena ga ada baterai ( punya tempatnya doang) jadi pake adaptor 3 Volt aja



Untuk kreasi text dalam Led Matrix 7 x 5 , bisa gunakan panduan excel di link ini








Script code dalam Bahasa C /WinAvr seperti berikut:


#define F_CPU 1000000UL
#include <avr/io.h>
#include <util/delay.h>
#include <avr/pgmspace.h> 
#include <string.h>
#include <avr/eeprom.h>

//Progmem simpannya di FLASH memory

const char love1[] PROGMEM =
{
0b0011110,
0b0100001,
0b1000010,
0b0100001,
0b0011110

};

const char love2[] PROGMEM =
{
0b0001100,
0b0010010,
0b0100100,
0b0010010,
0b0001100

};

const char L[] PROGMEM ={0x7f, 0x7f, 0x40, 0x40, 0x20}; 
const char O[] PROGMEM ={0x3e, 0x7f, 0x41, 0x41, 0x3e};
const char V[] PROGMEM ={0x3f, 0x7e, 0x40, 0x20, 0x1f};
const char E[] PROGMEM ={0x7f, 0x7f, 0x49, 0x49, 0x41};
const char H[] PROGMEM ={0x7f, 0x7f, 0x08, 0x08, 0x7f};
const char U[] PROGMEM ={0x3f, 0x7f, 0x40, 0x40, 0x3f};
const char R[] PROGMEM ={0x7f, 0x7f, 0x11, 0x29, 0x46};
const char T[] PROGMEM ={0x03, 0x03, 0x7f, 0x03, 0x02};

const char creature[]={0x4e, 0x31, 0x35, 0x31, 0x4e}; //simpan di memory/RAM aja

uint8_t EEMEM tengkorak[5]= {0x1e, 0x75, 0x61, 0x75, 0x1e}; //simpan di EEPROM

uint8_t EEMEM pacman[5]= {0x26, 0x67, 0x67, 0x7f, 0x3e}; //simpan di EEPROM


char dotnya[5],scrolnya[7];



void tulis(uint8_t lama)
{
  uint8_t a,b;

for(a=0 ; a<lama ; a++)
{
 for(b=0 ; b<5 ; b++)   
  
{

PORTB = ~(1<<b) ;
PORTD = dotnya[b];
            _delay_ms(2);

     
}

}



}


void geser(uint8_t lama)
{
  uint8_t a,b;

 for(a=0 ; a<11 ; a++)   
  
{

  if( a<6) 
   { 
 for(b=0 ; b<(5-a) ; b++)  dotnya[b]=0x80;
              for(b=(5-a); b<5 ;b++) dotnya[b]=scrolnya[b-5+a];
 
 tulis(10);
             
             }
  else if (a==6) tulis(lama);

  else 
             {  for(b=0 ; b<11-a ; b++) dotnya[b]=scrolnya[a-5+b];
   for(b=(11-a); b<11 ;b++) dotnya[b]=0x80;  
 
                tulis(10);
              }

          }
 
   
                
     

 
}

void naik (uint8_t lama)

{
{  uint8_t q,step=0;
  
  
  while(step!=16)
   {
if( step <8)
  {   
for(q=0 ; q < 5 ; q++) dotnya[q] = scrolnya[q] << (7 - step) ; 

           tulis(10);
        } 
   
    else if (step == 8)
  {    
        tulis(lama); 

       }      
else 
  {   
         for(q=0 ; q < 5 ; q++)  dotnya[q] = scrolnya[q] >> (step - 7) ;  
          
  tulis(10);

     step++; 

}    

}




}


int main(void)
{
DDRD = 0b1111111; // untuk baris
DDRB = 0b11111;  // untuk kolom

PORTD =0; // Set all pins low
PORTB =0b11111; //matikan layar
    
    


while(1)
{
// yang ini nulis langsung 
  
     strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);
strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);
     strncpy_P(dotnya,love2,5);
     tulis(20);
     strncpy_P(dotnya,love1,5);
     tulis(40);     

//yang ini pake function geser 

strncpy_P(scrolnya,L,5);
     geser(50);
strncpy_P(scrolnya,O,5);
     geser(50);
strncpy_P(scrolnya,V,5);
     geser(50);
strncpy_P(scrolnya,E,5);
     geser(50);
strncpy_P(scrolnya,H,5);
     geser(50);
strncpy_P(scrolnya,U,5);
     geser(50);
strncpy_P(scrolnya,R,5);
     geser(50);
strncpy_P(scrolnya,T,5);
     geser(50);

//geser ambil dari RAM

strncpy(scrolnya,creature,5);  //tanpa _P karena ambil di RAM
     naik(50);

//ambil dari eeprom ..mengirit..

     eeprom_read_block((void*)&scrolnya,(const void*)&tengkorak, 5); 
naik(50);

     eeprom_read_block((void*)&scrolnya,(const void*)&pacman, 5); 
geser(50);

}

return 0;
}


Script code diatas dibuat dalam mode FLASH, RAM, dan EEPROM, jadi ketika download program ke IC harus memprogram FLASH dulu kemudian dilanjutkan dengan EEPROM.
FLASH extensinya .hex sedangkan isi EEPROM extensinya .eep




hasil akhirnya seperti di video berikut :





SELAMAT MENCOBA
Share:

17 komentar:

  1. Assalammmualaikum,..
    mau tanya nih, sy udah coba build source diatas, tp koq error ya, error nya kek gini:

    ../dotMatrix.c: In function 'tulis':
    ../dotMatrix.c:54: error: 'step' undeclared (first use in this function)
    ../dotMatrix.c:54: error: (Each undeclared identifier is reported only once
    ../dotMatrix.c:54: error: for each function it appears in.)
    ../dotMatrix.c:56: error: expected ')' before ';' token
    ../dotMatrix.c:57: error: expected expression before '}' token
    ../dotMatrix.c:52: warning: unused variable 'b'
    ../dotMatrix.c: At top level:
    ../dotMatrix.c:58: error: expected '=', ',', ';', 'asm' or '__attribute__' before '++' token
    ../dotMatrix.c:60: error: expected identifier or '(' before '}' token
    ../dotMatrix.c:62: error: expected identifier or '(' before '}' token
    ../dotMatrix.c:67: error: expected identifier or '(' before '}' token
    ../dotMatrix.c: In function 'main':
    ../dotMatrix.c:101: warning: implicit declaration of function 'geser'
    ../dotMatrix.c:120: warning: implicit declaration of function 'naik'

    tapi kadang error nya gini:
    make: *** No rule to make target `c:/winavr-20100110/lib/gcc/../../avr/include/avr/io.h c:/winavr-20100110/lib/gcc/../../avr/include/avr/sfr_defs.h', needed by `dotMatrix.o'. Stop.


    terimakasih atas bantuannya,

    BalasHapus
  2. sepertinya skrip nya ada yg kepotong akibat copas di blogger yg memotong beberapa karakter...

    untuk variable step, silahkan di deklarasikan diatas sebagau int step;

    untuk eror ( atau } coba di perbaiki sedikit2

    BalasHapus
  3. mas kalau untuk bahasa assembling nya gmn ya karna aku pake mikro yang AT89s51

    BalasHapus
  4. klo dipake di codevision avr yg dirubah yg mana?

    BalasHapus
  5. menarik sekali .... silahkan berkunjung ke f4ture.blogspot.com

    BalasHapus
  6. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  7. saya tertarik dengan kreasinya dan saya coba ikutin sourcenya,tapi pada saat di compile,erornya pada pgmspace.h.
    mohon bantuannya
    terimakasih

    BalasHapus
  8. buat sicangklong

    saya pake winavr + avrstudio....harap disesuaikan ...

    BalasHapus
  9. saya coba build di avrgcc,hasilnya
    make : [myprojec.elf] error 127 (ignored)
    avr-objcopy: 'myprojec.elf': No such file
    kesalahannya dibagian mana
    mohon penjelasannya

    BalasHapus
  10. apes bener sicangklong...coba pake AVRSTUDIO jadul versi 4.13 kebawah , googling aja di 4shared ...trus jangan lupa install winavr

    BalasHapus
  11. build sudah sukses tapi hasilnya belum memuaskan seperti di videonya,
    pada saat build hasilnya
    Data: 18 bytes (14.1% Full)
    (.data + .bss + .noinit)
    EEPROM: 10 bytes (7.8% Full)
    (.eeprom)
    Build succeeded with 0 Warnings.
    yang saya tanyakan maksud..(.data + .bss + .noinit)
    atas bantuannya saya ucapkan terimakasih

    BalasHapus
  12. THX THX THX from europe!!!
    Do u have full Char list in hex ???
    i would like to write my Name !!
    It works very well ! i have it run at 8MHz int Osc.

    BalasHapus
  13. hi ethno..glad to hear sound from europe
    for custom text i've already create a text to bit converter
    you can try it here http://www.flexievdo.net/texttobit_lawas.swf

    caooo

    BalasHapus
  14. nyasar ke sini pak.. mau belajar coding atmega.. (y)

    BalasHapus
  15. 2020 pak aho... klo coding buat arduino gmn pak.. thanks

    BalasHapus
    Balasan
    1. Komentar ini telah dihapus oleh pengarang.

      Hapus
    2. saya bikin remakenya pake arduino : http://www.aisi555.com/2020/05/praktek-love-hurt-2020-remake-pake.html

      Hapus

Kontak Penulis



12179018.png (60×60)
+628155737755

Mail : ahocool@gmail.com

Site View

Categories

555 (8) 7 segmen (3) adc (4) amplifier (2) analog (19) android (12) antares (8) arduino (25) artikel (11) attiny (3) attiny2313 (19) audio (5) baterai (5) blog (1) bluetooth (1) chatgpt (2) cmos (2) crypto (2) dasar (46) digital (11) dimmer (5) display (3) esp8266 (25) euro2020 (13) gcc (1) iklan (1) infrared (2) Input Output (3) iot (58) jam (7) jualan (12) kereta api (1) keyboard (1) keypad (3) kios pulsa (2) kit (6) komponen (17) komputer (3) komunikasi (1) kontrol (8) lain-lain (8) lcd (2) led (14) led matrix (6) line tracer (1) lm35 (1) lora (5) MATV (1) memory (1) metal detector (4) microcontroller (70) micropython (6) mikrokontroler (1) mikrokontroller (14) mikrotik (5) modbus (9) mqtt (3) ninmedia (5) ntp (1) paket belajar (19) palang pintu otomatis (1) parabola (88) pcb (2) power (1) praktek (2) project (33) proyek (1) python (7) radio (15) raspberry pi (4) remote (1) revisi (1) rfid (1) robot (1) rpm (2) rs232 (1) script break down (3) sdcard (3) sensor (2) sharing (3) signage (1) sinyal (1) sms (6) software (18) solar (1) solusi (1) tachometer (2) technology (1) teknologi (2) telegram (2) telepon (9) televisi (167) television (28) transistor (2) troubleshoot (3) tulisan (92) tutorial (108) tv digital (6) tvri (2) vu meter (2) vumeter (2) wav player (3) wayang (1) wifi (3)

Arsip Blog

Diskusi


kaskus
Forum Hobby Elektronika