1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
$ DEBUG
$ ERRORPRINT
PROG SEGMENT CODE
OP_DATA SEGMENT DATA
STACK SEGMENT IDATA
BIT_V SEGMENT BIT
;
NAME PRIMUL
USING 0 ; Register-Bank 0
;
;*****************************************
;* *
;* DEFINITIONS. Data used inside the program *
;* *
;*****************************************
;
DEBUG EQU 0FFFFh
;
;*****************************************
;* *
;* Data segment *
;* *
;*****************************************
;
RSEG OP_DATA
VAR: DS 1 ; VAR = variables from intern RAM
;
RSEG BIT_V
;
FL_1: DBIT 1 ; binary variable
;
;
RSEG STACK
STK: DS 1
;
;*****************************************
;* *
;* Code segment *
;* *
;*****************************************
;
RSEG PROG
RESET:
LJMP INIT ; Jump to the initialization sequence
;
LJMP DUMMY ; Extern interruption 0
DS 5
LJMP DUMMY ; Timer interruption 0
DS 5
LJMP DUMMY ; Extern interruption 1
DS 5
LJMP DUMMY ; Timer interruption 1
DS 5
LJMP DUMMY ; Serial channel interruption
DS 5
;
DUMMY: RETI
;
;*************************************
;* *
;* INIT. Initialization sequence *
;* *
;*************************************
;
;
INIT: SETB TI
MOV A,SBUF ; False reading at the start
;
;*********************************************
;* *
;* Main program *
;* *
;*********************************************
;
MAIN: ACALL INILCD
MOV DPTR,#TXL
ACALL TRX
MOV R2,#0C0H
ACALL WRCMD
INC DPTR
ACALL TRX
Ljmp 0
TXL:
DB ' A.T.M. $'
DB ' LCD DISPLAY $'
TRX:
CLR A
MOVC A,@A+DPTR
CJNE A,#24H,TRCAR
RET
TRCAR: MOV R2,A
ACALL WRDAT
INC DPTR
SJMP TRX
INILCD:
MOV R2,#38H
ACALL WRCMD
MOV R4,#50
DEL4MS:
ACALL DELAY
DJNZ R4,DEL4MS
MOV R4,#4
LINI:
ACALL WRCMD
ACALL DELAY
DJNZ R4,LINI
ACALL WLCD
MOV R2,#6 ;entry mode set
ACALL WRCMD
ACALL WLCD
MOV R2,#0EH ;display on
ACALL WRCMD
ACALL WLCD
MOV R2,#1 ;clear disp.
ACALL WRCMD
RET
WLCD:
ACALL RDCMD
JB ACC.7,WLCD
RET
RDCMD:
MOV P2,#1
MOV R0,#2
MOVX A,@R0
RET
WRCMD:
ACALL WLCD
MOV A,R2
MOV P2,#1
MOV R0,#0
MOVX @R0,A
RET
WRDAT:
ACALL WLCD
MOV P2,#1
MOV R0,#1
MOV A,R2
MOVX @R0,A
RET
;
DELAY:
MOV R3,#17 ;80 us DELAY
LL1:
NOP
NOP
DJNZ R3,LL1
RET
END
|