4 - Antarmuka Mikrokontroler Dengan 7segmen
4 - Antarmuka Mikrokontroler Dengan 7segmen
DENGAN 7SEGMEN
7SEGMEN
RANGKAIAN ANTARMUKA
DENGAN 7SEGMEN
..\..\Datasheet\TrainerS.pdf
KODE HEKSADESIMAL
UNTUK ANGKA 0-9
Digit
0
1
2
3
4
5
6
7
8
9
gfedcb
a
0x3F
0x06
0x5B
0x4F
0x66
0x6D
0x7D
0x07
0x7F
0x6F
g f
e d c b a
of on on on on on on
of of of of on on of
on of on on of on on
on of of on on on on
on on of of on on of
on on of on on of on
on on on on on of on
of of of of on on on
on on on on on on on
on on of on on on on
SETTING PORT
PORTB=0x00;
DDRB=0xf;
PORTC=0xc0;
DDRC=0xc0; // portc sebagai input dan output, 0b11000000
//kontrol DO2, DO1
PROGRAM MENAMPILKAN
ANGKA 5 (KANAN)
PROGRAM SEGMEN1
//Menampilkan angka 5 pada seven segmen sebelah
kanan.
while (1)
{
// Place your code here
PORTC.7=1;
//KIRI DINONAKTIFKAN
PORTC.6=0;
PORTB=0x6d;
// DATA ANGKA 5
delay_ms(10);
}
PROGRAM MENAMPILKAN
ANGKA 2 (KIRI)
PROGRAM SEGMEN2
//Menampilkan angka 2 pada seven segmen sebelah kiri.
while (1)
{
// Place your code here
PORTC.7=0;
KIRI
PORTC.6=1;
PORTB=0x5b // DATA ANGKA 2
delay_ms(10);
}