Sabtu, 11 Januari 2014

Tugas Responsi Praktikum Mikroprosesor



RESPONSI PRAKTIKUM MIKROPROSESOR


NAMA : YONATHAN PRIAMBUDI
NIM : 11.11.2349
KELAS : TI 2011 A
 
$MOD51
GESERL EQU 00011011B ; 0 0 0 1 S/C R/L X X untuk geser ke kiri
GESERR EQU 00011111B ; 0 0 0 1 S/C R/L X X untuk geser ke kanan
ORG 000H
CLR P3.5
CALL INIT_LCD
START: CALL WRITE_CHAR;CALL INIT_LCD
CALL WRITE_CHAR2
CALL GESER
SJMP START
;
GESER:

MOV R6,#40 ;R7 = 40; GESER SEBANYAK 40 KARAKTER
LAGI: MOV R1,#GESERR ;R1 PERINTAH UNTUK GESER DARI KIRI KE KANAN
CALL WRITE_INST
CALL LDELAY
DJNZ R6,LAGI ;R7=R7-1, JIKA R7 ? 0 MAKA LOMPAT KE LAGI
WRITE_CHAR:
MOV DPTR,#WORD1 ;DPTR = [ ADDRESS WORD1 ]
MOV R3,#25 ;R3=25 pemesanan karakter
MOV R1,#80H ;R1=80H,ADDRESS DDRAM START POSITION
CALL WRITE_INST
;

WRITE1:CLR A ; A = 0

MOVC A,@A+DPTR ; A = [A+ DPTR]
MOV R1,A ; R1 = A
INC DPTR ; DPTR = DPTR +1
CALL WRITE_DATA;
DJNZ R3,WRITE1 ; R3 = R3-1,
RET

WRITE_CHAR2:
MOV DPTR,#WORD2 ;DPTR = [ ADDRESS WORD1 ]
MOV R3,#25 ;R3=16,NUMBER CHARACTER TO BE DISPLAY
MOV R1,#0C0H ;R1=80H,ADDRESS DDRAM START POSITION
CALL WRITE_INST
;
WRITE2:CLR A ; A = 0

MOVC A,@A+DPTR ; A = [A+ DPTR]
MOV R1,A ; R1 = A
INC DPTR ; DPTR = DPTR +1
CALL WRITE_DATA;
DJNZ R3,WRITE2 ; R3 = R3-1,
RET

;
INIT_LCD:
MOV R1,#00000001B ;CLEAR LCD / MEMBUAT LCD JADI KOSONG
CALL WRITE_INST ;
MOV R1,#00111000B ;Fungsi SET,
;DATA 8 BIT,2 LINE FONT 5X7
CALL WRITE_INST ;
MOV R1,#00001100B ;DISPLAY ON,
;CURSOR OFF,CURSOR BLINK OFF
CALL WRITE_INST
MOV R1,#00000110B ;ENTRY MODE, SET INCREMENT
CALL WRITE_INST
RET
;
WRITE_INST:
CLR P3.6 ; RS = P2.0 = 0, WRITE MODE INSTRUCTION
MOV P0,R1 ; D7 S/D D0 = P0 = R1
SETB P3.7 ; EN = 1 = P2.1
CALL DELAY ; CALL DELAY TIME
CLR P3.7 ; EN = 0 = P2.1
RET
;
WRITE_DATA:
SETB P3.6 ; RS = P2.0 = 1, WRITE MODE DATA
MOV P0,R1 ; D7 S/D D0 = P0 = R1
SETB P3.7 ; EN = 1 = P2.1
CALL DELAY ; CALL DELAY TIME
CLR P3.7 ; EN = 0 = P2.1
RET
;
LDELAY: MOV R2,#087H ; UNTUK MENGATUR KECEPATAN GESER
LD1: ACALL DELAY
DJNZ R2,LD1
RET
DELAY: MOV R0,#0
DELAY1: MOV R7,#0FH
DJNZ R7,$
DJNZ R0,DELAY1
RET
;
WORD1: DB '               YONATHAN P'; UNTUK MENGISI PADA LCD BARIS PERTAMA (80H)
WORD2: DB '               11.11.2349'; UNTUK MENGISI LCD PADA BARIS KE 2 (0C0H)

;
END



Print Screen hasilnya


Tidak ada komentar:

Posting Komentar