I have managed to get the waveform onto the Hitachi LCD, but the problem is it only display 1 pixel at a time so the waveform is pretty faint. Can it display all the points plotted instead of displaying only 1 point at a time.
$include (c8051f200.inc)
RST EQU P3.1
CD EQU P3.0
CE EQU P2.7
RD EQU P2.5
WR EQU P2.6
IN EQU P3.3
COM EQU 32H
DAT1 EQU 30H
DAT2 EQU 31H
O_Y EQU 35H
O_X EQU 36H
ORG 00H
START:
NOP
NOP
NOP
MOV OSCXCN,#0E7H
NOP
NOP
NOP
ORL OSCXCN,#00H
NOP
NOP
MOV OSCICN,#08H
NOP
NOP
MOV PRT0MX,#01H
MOV PRT1MX,#00H
MOV PRT2MX,#00H
MOV P0,#0FDH
MOV PRT0CF,#00H
MOV P0MODE,#02H
MOV P1,#0FFH
MOV PRT1CF,#0FFH
MOV P1MODE,#0FFH
MOV P2,#0ffH
MOV PRT2CF,#0ffH
MOV P2MODE,#000H
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV WDTCN,#0DEH
MOV WDTCN,#0ADH
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
MOV TMOD,#20H ; T1 IN MODE 2
MOV TH1,#-3
MOV SCON,#50H
SETB TR1
CLR RI
CLR IN
SETB RST ;
CLR CE ; CHIP ENABLE
LCALL INIT ; CONTROLLER INITIALIZATION
LCALL ALL_ON ; ALL PIXEL ON
LCALL ALL_OFF ; ALL PIXEL OFF
MAIN:
MOV O_X,#00H ; X COOR = 0
MOV O_Y,#00H ; Y COOR = 0
GO:
JNB RI,GO
MOV R7,SBUF
CLR RI
CJNE R7,#1,GO
MOV R5,#0
SCAN:
JNB RI,SCAN
INC R5
CLR RI
CHECK2:
CJNE R5,#2,SCAN ; CHECK IF BYTE3 IS IDENTIFIED
MOV @R0,SBUF
MOV A,@R0
MOV B,#11
DIV AB
SUBB A,#2
MOV O_Y,A
INC O_X
MOV R3,O_X
CJNE R3,#50,GRAPH
JMP MAIN
GRAPH: ; ( PROCEDRUE FOR DISPLAY IMAGE )
MOV COM,#9EH ; CURSOR ON
LCALL C_DW2
MOV DAT1,O_X
MOV DAT2,O_Y
; MOV COM,#021H
LCALL C_DW
JMP GO
C_DW: ; 2 DATA AND 1 COMMAND WRITE
LCALL CS
MOV A,DAT1
LCALL C_DW3
C_DW1: ; 1 DATA AND 1 COMMAND WRITE
LCALL CS
MOV A,DAT2
LCALL C_DW3
C_DW2: ; 1 COMMNAD WRITE ONLY
LCALL CS
MOV A,COM
LJMP C_DW4
C_DW3:
CLR CD ; COMMAND OR DATA SELECTION
C_DW4:
MOV P1,A
CLR WR
SETB WR
RET
CS: ; CHECK STATUS
LCALL R_STATUS
JNB ACC.0,CS ; CHECK COMMAND EXECUTION CAPABILITY
JNB ACC.1,CS ; CHECK DATA READ / WRITE CAPABILITY
RET
CS_2:
LCALL R_STATUS
JNB ACC.2,CS_2 ; CHECK AUTO MODE DATA READ CAPABILITY
RET
CS_3:
LCALL R_STATUS
JNB ACC.3,CS_3 ; CHECK AUTO MODE DATA WRITE CAPABILITY
RET
R_STATUS:
MOV P1,#0FFH ; READ THE STATUS
SETB CD
CLR RD
MOV A,P1
SETB RD
RET
INIT: ; ( PROCEDRUE FOR INITIALIZATION )
MOV DAT1,#00H
MOV DAT2,#00H
MOV COM,#40H ; SET TEXT HOME ADDRESS TO 0000H
LCALL C_DW
MOV DAT1,#20H
MOV DAT2,#00H
MOV COM,#41H ; SET TEXT AREA TO 32 COLUMNS
LCALL C_DW
MOV DAT1,#00H
MOV DAT2,#08H
MOV COM,#42H ; SET GRAPHIC HOME ADDRESS TO 0800H
LCALL C_DW
MOV DAT1,#20H
MOV DAT2,#00H
MOV COM,#43H ; SET GRAPHIC AREA TO 32 COLUMNS
LCALL C_DW
MOV COM,#0C0H ; SET CURSOR TO 8-LINE CURSOR
LCALL C_DW2
MOV COM,#0A5H ; SET CURSOR TO 8-LINE CURSOR
LCALL C_DW2
MOV COM,#80H ; DISPLAY MODE AS "OR" MODE
LCALL C_DW2
MOV COM,#9EH ; TEXT ON, GRAPHIC ON, CURSOR DISPLAY ON, CURSOR BLINK OFF
LCALL C_DW2
RET
ALL_OFF: ; ( PROCEDRUE FOR PIXEL OFF )
MOV DAT1,#00H
MOV DAT2,#00H
MOV COM,#24H ; SET ADDRESS POINTER TO 0000H
LCALL C_DW
MOV R3,#00H ; SET Y COUNTER = 256
MOV R4,#20H ; SET X COUNTER = 32
MOV COM,#0B0H ; SET DATA AUTO WRITE
LCALL C_DW2
ALL_OFF1:
LCALL CS_3
MOV A,#00H ; PUT 00000000 TO DATA BYTE
LCALL C_DW3
DJNZ R3,ALL_OFF1
DJNZ R4,ALL_OFF1
MOV COM,#0B2H ; RESET AUTO
LCALL C_DW2
RET
ALL_ON: ; ( PROCEDRUE FOR PIXEL ON )
MOV DAT1,#00H
MOV DAT2,#00H
MOV COM,#24H ; SET ADDRESS POINTER TO 0000H
LCALL C_DW
MOV R3,#00H ; SET Y COUNTER = 256
MOV R4,#20H ; SET X COUNTER = 32
MOV COM,#0B0H ; SET DATA AUTO WRITE
LCALL C_DW2
ALL_ON1:
LCALL CS_3
MOV A,#0FFH ; PUT 11111111 TO DATA BYTE
LCALL C_DW3
DJNZ R3,ALL_ON1
DJNZ R4,ALL_ON1
MOV COM,#0B2H ; RESET AUTO
LCALL C_DW2
RET
END
|