0% found this document useful (0 votes)
38 views6 pages

Tutorial Dot Matrix Dengan Bascom AVR

The document describes a CodeVision AVR tutorial for displaying numbers on a 5x7 dot matrix display. It includes the circuit diagram and an AVR program that counts down from 9 to 0 by turning on the appropriate rows and columns to display each number. The program uses functions to light up the LEDs and loops through the rows and columns, decrementing the number after displaying it for one second each time.

Uploaded by

rizky nurmansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views6 pages

Tutorial Dot Matrix Dengan Bascom AVR

The document describes a CodeVision AVR tutorial for displaying numbers on a 5x7 dot matrix display. It includes the circuit diagram and an AVR program that counts down from 9 to 0 by turning on the appropriate rows and columns to display each number. The program uses functions to light up the LEDs and loops through the rows and columns, decrementing the number after displaying it for one second each time.

Uploaded by

rizky nurmansyah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Tutorial Dot Matrix Display dengan CodeVision AVR

Sebelumnya saya sudah pernah membuat posting Tutorial Dot Matrix dengan
Bascom AVR, jika ingin mengetahui lebih lanjut tentang dot matrix itu sendiri bisa
dipelajari di posting sebelumnya tersebut.

Pada posting kali ini saya hanya akan menampilkan karakter dalam bentuk angka 0-
9 dalam satu buah dot matrix 5x7.

Rangkaian skematiknya sebagai berikut:


Listing Program dengan CodeVision AVR sbb:
/*****************************************************
Program Display DOTMATRIX dengan CodeVision AVR
Programmer : Wahyu Rahmaniar
Company : Technologination
*****************************************************/

#include <mega32.h>
#include <delay.h>
#include <string.h>

unsigned int i,j,x,y,z;


unsigned int angka;
char urut;
char kolom[7];

//Baris = PORTB
//KOLOM = PORTC

void nyala_led()//fungsi untuk menyalakan baris


{
if (angka==0)
{
if (urut==0){urut=~(0x3E);}
if (urut==1){urut=~(0x51);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x45);}
if (urut==4){urut=~(0x3E);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==1)
{
if (urut==0){urut=~(0x00);}
if (urut==1){urut=~(0x21);}
if (urut==2){urut=~(0x7F);}
if (urut==3){urut=~(0x01);}
if (urut==4){urut=~(0x00);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}
else if (angka==2)
{
if (urut==0){urut=~(0x27);}
if (urut==1){urut=~(0x49);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x49);}
if (urut==4){urut=~(0x31);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==3)
{
if (urut==0){urut=~(0x22);}
if (urut==1){urut=~(0x41);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x49);}
if (urut==4){urut=~(0x36);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==4)
{
if (urut==0){urut=~(0x0C);}
if (urut==1){urut=~(0x14);}
if (urut==2){urut=~(0x24);}
if (urut==3){urut=~(0x7F);}
if (urut==4){urut=~(0x04);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==5)
{
if (urut==0){urut=~(0x72);}
if (urut==1){urut=~(0x51);}
if (urut==2){urut=~(0x51);}
if (urut==3){urut=~(0x51);}
if (urut==4){urut=~(0x4E);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==6)
{
if (urut==0){urut=~(0x1E);}
if (urut==1){urut=~(0x29);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x49);}
if (urut==4){urut=~(0x46);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==7)
{
if (urut==0){urut=~(0x41);}
if (urut==1){urut=~(0x42);}
if (urut==2){urut=~(0x44);}
if (urut==3){urut=~(0x48);}
if (urut==4){urut=~(0x70);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==8)
{
if (urut==0){urut=~(0x36);}
if (urut==1){urut=~(0x49);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x49);}
if (urut==4){urut=~(0x36);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

else if (angka==9)
{
if (urut==0){urut=~(0x30);}
if (urut==1){urut=~(0x49);}
if (urut==2){urut=~(0x49);}
if (urut==3){urut=~(0x4A);}
if (urut==4){urut=~(0x3C);}
if (urut==5){urut=~(0x00);}
if (urut==6){urut=~(0x00);}
if (urut==7){urut=~(0x00);}
}

void main(void)
{
PORTA=0x00;
DDRA=0x00;

PORTB=0x00;
DDRB=0xFF;

PORTC=0x00;
DDRC=0xFF;

PORTD=0x00;
DDRD=0x00;

y=0;
PORTC=~(0xFE);

while (1)

{
angka=9;
kolom[0]=~(0xFE);
kolom[1]=~(0xFD);
kolom[2]=~(0xFB);
kolom[3]=~(0xF7);
kolom[4]=~(0xEF);
kolom[5]=~(0xDF);
kolom[6]=~(0xBF);
kolom[7]=~(0x7F);

for (z=0;z<10;++z)
{
//for (x=0;x<10;++x) //untuk menggeser (non aktif)
//{
for (i=0;i<100;++i)
{
y=x;
for (j=0;j<8;++j)
{
//angka=0;
PORTC=kolom[j];
urut=y;
nyala_led();
PORTB=urut;
delay_ms(1);
y=y+1;
//PORTC=kolom[j+1];
if (y==8)
{
y=0;
}
}
PORTC=~(0xFE);
}
//}
//PORTB=0xFF;
angka=angka-1;
delay_ms(1000);
};
}
}

Program diatas berfungsi untuk menghitung mundur dari angka 9 sampai dengan 0
pada dot matrix display 5x7. Pada simulasi bagian kolom aktif low dan bagian baris
aktif high, sedangkan pada dot matrix asli yang biasa dibeli kebalikannya, yaitu
bagian kolom aktif high dan baris aktif low, maka tinggal menghapus tanda ~ atau
not pada program

You might also like