Berikut caranya :
- · Buka topview simulator
- · Select device 89C52
- · Frequency 12 MHZ
- · File-External Module Setting-LED
- · No seven segment (nonaktifkan)
- · Non multiflexed(aktifkan)
- · Warna pilih salah satu
- · Common Kathode(aktifkan)
- · 7 segmen(aktifkan)
- · click selection of port lines and number of digit
No Of Digit
|
Control Line
|
Port Line
|
1
|
Digit 1 Segment a
Digit 1 Segment b
Digit 1 Segment c
Digit 1 Segment d
Digit 1 Segment e
Digit 1 Segment f
Digit 1 Segment g
Digit 1 Segment dp
|
0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
|
2
|
Digit 2 Segment a
Digit 2 Segment b
Digit 2 Segment c
dst
|
1.0
1.1
1.2
dst
|
3
|
Digit 3 Segment a
Digit 3 Segment b
dst
|
2.0
2.1
dst
|
4
|
Digit 4 Segment a
Digit 4 Segment b
dst
|
3.0
3.1
dst
|
- · Click OK
- · Ketik Script Code berikut di notepad
Listing Program
|
$Mod51
Org
0H
Start:mov
P0,#0000110b
mov
P1,#0111111b
mov
P2,#1101101b
mov
P3,#1101101b
SJmp
start;start jump
End
|
- · Simpan file dengan nama misalnya “nama.asm”
- · Pada topview simulator pilih file, load text file lalu pilih sesuai nama file yang tersimpan
- · Pilih run asm untuk memeriksa ada tidaknya script yang error,bila tidak ada pilih go to ketik “00”
- · Selanjutnya click view, external modules, LED
Jika ingin membuat tampilan angka
berkedip-kedip, berikut script codenya
Listing Program
|
$mod51
org
0H
start:mov
p0,#0000110b
mov
p1,#00000000b
mov
p2,#00000000b
mov
p3,#00000000b
call
delay
mov
p0,#0000110b
mov
p1,#0111111b
mov
p2,#00000000b
mov
p3,#00000000b
call
delay
mov
p0,#0000110b
mov
p1,#0111111b
mov
p2,#1101101b
mov
p3,#00000000b
call
delay
mov
p0,#0000110b
mov
p1,#0111111b
mov
p2,#1101101b
mov
p3,#1101101b
call
delay
mov
p0,#0000000b
mov
p1,#0000000b
mov
p2,#0000000b
mov
p3,#0000000b
call
delay
Sjmp
start
delay:mov
R1,#255
delay1:mov
R2,#255
delay2:mov
R3,#253
delay3:djnz
R3,delay3
djnz R2,delay2
djnz R1,delay1
Ret
End
|
Semoga Bermanfaat.
Tidak ada komentar:
Posting Komentar