Seven Segmen By Kustanto
Gambar
Numbers to 7-segment-code A single byte can encode the full state of a 7- segment-display. The most popular bit encodings are abcdefg - both usually assume 0 is off and 1 is on. This table gives the hexadecimal encodings for displaying the digits 0 to 9:
Tabel Angka /Huruf Data (Heksa) 3f 1 0_6 2 5b 3 4f 4 66 5 6d 6 7d 7 Tabel: Seven segmen Angka /Huruf Data (Heksa) 3f 1 0_6 2 5b 3 4f 4 66 5 6d 6 7d 7 0_7 8 7f 9 6f A 77 B 7c C 39 D 5e E 79 F 71
Fungsi pin ATMEL AT89S52 (40 Pin DIP)
Aplikasi AT89S52 P20 C AT89S52 Mikrokontroler Common Catode (0) ULN2003A P0.0 . P0.7 A . G DP
Software angka Nol $mod51 org 00h mulai: mov p2,#0feh ;P2.0 dibuat low (0) mov p0,#3fh ;membentuk angka 0 sjmp mulai ;lompat ke mulai end ;fe=1111 1110
Rangkaian Seven Segmen
$mod51 org 00h loop: mov r0,#0ah mov dptr,#tabel_led loop1: clr a Program assemblernya: $mod51 org 00h loop: mov r0,#0ah mov dptr,#tabel_led loop1: clr a movc a,@a+dptr mov p0,a inc dptr call tunda djnz r0,loop1 sjmp loop tunda: mov r7,#0ffh lupa: mov r6,#33h lupb: mov r5,#22h djnz r5,$ djnz r6,lupb djnz r7,lupa ret tabel_led: db 00111111b db 00000110b db 01011011b db 01001111b db 01100110b db 01101101b db 01111101b db 00000111b db 01111111b db 01101111b end
Aplikasi AT89S52 P20 C P21 AT89S52 Pin Digit 1 Digit 2 Mikrokontroler Common Catode Mikrokontroler AT89S52 Pin ULN2003A P0.0 1 . . P0.7 8 A . G DP 18 . 11 Digit 1 Digit 2
Instruksinya $mod51 org 00h mulai: mov p2,#0feh ;digit 1 (fe=1111 1110) mov p0,#3fh ;angka 0 call tunda mov p2,#0fdh ;digit 2 (fd=1111 1101) mov p0,4fh ;angka 3 sjmp mulai tunda: mov r7,#02h lupa: mov r6,#33h lupb: mov r5,#22h djnz r5,$ djnz r6, lupb djnz r7,lupa ret end
Selesai