📄 lcd106x56.src
字号:
; lcd_out_ctl(LCD_REF_VOLT_MODE); /* prime for the reference voltage */
; SOURCE LINE # 93
MOV R7,#081H
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_REF_VOLT_REG+42); /* set default reference voltage select */
; SOURCE LINE # 94
MOV R7,#02AH
LCALL _lcd_out_ctl
; for(i=0; i<1000; i++) /* delay for power stabilize */
; SOURCE LINE # 95
CLR A
MOV R6,A
MOV R7,A
?C0010:
; {
; SOURCE LINE # 96
; }
; SOURCE LINE # 97
INC R7
CJNE R7,#00H,?C0122
INC R6
?C0122:
CJNE R6,#03H,?C0010
CJNE R7,#0E8H,?C0010
?C0011:
; lcd_out_ctl(LCD_DISP_ON); /* put the display on */
; SOURCE LINE # 98
MOV R7,#0AFH
LCALL _lcd_out_ctl
;
; lcd_out_ctl(LCD_SET_LINE+56); /* set line for row 0 of display */
; SOURCE LINE # 100
MOV R7,#078H
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_SET_PAGE+0); /* set page 0 */
; SOURCE LINE # 101
MOV R7,#0B0H
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_SET_COL_HI+0); /* set column 0 */
; SOURCE LINE # 102
MOV R7,#010H
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_SET_COL_LO+0);
; SOURCE LINE # 103
CLR A
MOV R7,A
LJMP _lcd_out_ctl
; END OF lcd_init
; /*
; **
; ** program test loop to find right resistor ratio 0-8
; ** (use by break pointing at each loop step)
; **
; */
;
; #if 0
; for(p=0; p<7; p++)
; {
; lcd_out_ctl(LCD_REG_RESISTOR+p); /* set resistor ratio */
; }
; #endif
;
; /*
; **
; ** program test loop to find reference voltage setting 0-63
; ** (use by break pointing at each loop step)
; **
; */
;
; #if 0
; for(p=0; p<63; p++)
; {
; lcd_out_ctl(LCD_REF_VOLT_MODE); /* prime for the reference voltage */
; lcd_out_ctl(LCD_REF_VOLT_REG+p); /* set reference voltage select */
; }
; #endif
; }
;
; /*
; **
; ** low level routine to send a byte value out the serial bus
; ** to the LCD controller data register. entry argument
; ** is the data to output.
; **
; */
;
; void lcd_out_dat(char dat)
RSEG ?PR?_lcd_out_dat?LCD106X56
_lcd_out_dat:
USING 0
; SOURCE LINE # 142
;---- Variable 'dat?141' assigned to Register 'R7' ----
; {
; SOURCE LINE # 143
; unsigned char i=8; /* serial bit counter */
; SOURCE LINE # 144
;---- Variable 'i?142' assigned to Register 'R6' ----
MOV R6,#08H
;
; EA = 0; /* disable interrupts */
; SOURCE LINE # 146
CLR EA
;
; LCD_CD = 1; /* select register for data port */
; SOURCE LINE # 148
SETB LCD_CD
; LCD_CS = 0; /* enable interface via chip select */
; SOURCE LINE # 149
CLR LCD_CS
?C0014:
;
; while(i--)
; SOURCE LINE # 151
MOV R5,AR6
DEC R6
MOV A,R5
JZ ?C0015
; {
; SOURCE LINE # 152
; LCD_SDAT = (dat & 0x80 ? 1 : 0); /* transmit data from MSB */
; SOURCE LINE # 153
MOV A,R7
ANL A,#080H
MOV R5,A
RLC A
SUBB A,ACC
ORL A,R5
JZ ?C0016
SETB C
SJMP ?C0017
?C0016:
CLR C
?C0017:
MOV LCD_SDAT,C
; LCD_SCLK = 0; /* turn the clock on */
; SOURCE LINE # 154
CLR LCD_SCLK
; dat <<= 1; /* shift data left 1 place */
; SOURCE LINE # 155
MOV A,R7
ADD A,ACC
MOV R7,A
; LCD_SCLK = 1; /* clock back off */
; SOURCE LINE # 156
SETB LCD_SCLK
; }
; SOURCE LINE # 157
SJMP ?C0014
?C0015:
;
; LCD_CD = 1; /* force chip select back off */
; SOURCE LINE # 159
SETB LCD_CD
;
; /* re-establish the exit interrupt state */
; EA = 1;
; SOURCE LINE # 162
SETB EA
; }
; SOURCE LINE # 163
RET
; END OF _lcd_out_dat
;
; /*
; **
; ** low level routine to send a byte value out the serial bus
; ** to the LCD controller control register. entry argument is
; ** the data to output.
; **
; */
;
; void lcd_out_ctl(char dat)
RSEG ?PR?_lcd_out_ctl?LCD106X56
L?0124:
USING 0
ADD A,#0B0H
MOV R7,A
LCALL _lcd_out_ctl
MOV R7,#011H
LCALL _lcd_out_ctl
MOV R7,#0AH
_lcd_out_ctl:
USING 0
; SOURCE LINE # 173
;---- Variable 'dat?243' assigned to Register 'R7' ----
; {
; SOURCE LINE # 174
; unsigned char i=8; /* serial bit counter */
; SOURCE LINE # 175
;---- Variable 'i?244' assigned to Register 'R6' ----
MOV R6,#08H
;
; EA = 0; /* disable interrupts */
; SOURCE LINE # 177
CLR EA
;
; LCD_CD = 0; /* select register for command port */
; SOURCE LINE # 179
CLR LCD_CD
; LCD_CS = 0; /* enable interface via chip select */
; SOURCE LINE # 180
CLR LCD_CS
?C0019:
;
; while(i--)
; SOURCE LINE # 182
MOV R5,AR6
DEC R6
MOV A,R5
JZ ?C0020
; {
; SOURCE LINE # 183
; LCD_SDAT = (dat & 0x80 ? 1 : 0); /* transmit data from MSB */
; SOURCE LINE # 184
MOV A,R7
ANL A,#080H
MOV R5,A
RLC A
SUBB A,ACC
ORL A,R5
JZ ?C0021
SETB C
SJMP ?C0022
?C0021:
CLR C
?C0022:
MOV LCD_SDAT,C
; LCD_SCLK = 0; /* turn the clock on */
; SOURCE LINE # 185
CLR LCD_SCLK
; dat <<= 1; /* shift data left 1 place */
; SOURCE LINE # 186
MOV A,R7
ADD A,ACC
MOV R7,A
; LCD_SCLK = 1; /* clock back off */
; SOURCE LINE # 187
SETB LCD_SCLK
; }
; SOURCE LINE # 188
SJMP ?C0019
?C0020:
;
; LCD_CD = 1; /* force chip select back off */
; SOURCE LINE # 190
SETB LCD_CD
;
; /* re-establish the exit interrupt state */
; EA = 1;
; SOURCE LINE # 193
SETB EA
; }
; SOURCE LINE # 194
RET
; END OF _lcd_out_ctl
;
; /*
; **
; ** routine to erase the LCD screen, This erases whole
; ** display memory of the S6B0724 LCD controller.
; **
; */
;
; void lcd_erase(void)
RSEG ?PR?lcd_erase?LCD106X56
lcd_erase:
USING 0
; SOURCE LINE # 203
; {
; SOURCE LINE # 204
; unsigned char p;
; unsigned char i;
;
; for(p=0; p<9; p++)
; SOURCE LINE # 208
;---- Variable 'p?345' assigned to Register 'R4' ----
CLR A
MOV R4,A
?C0024:
; {
; SOURCE LINE # 209
; lcd_out_ctl(LCD_SET_PAGE+p); /* set page */
; SOURCE LINE # 210
MOV A,R4
ADD A,#0B0H
MOV R7,A
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_SET_COL_HI+0); /* set column 0 */
; SOURCE LINE # 211
MOV R7,#010H
LCALL _lcd_out_ctl
; lcd_out_ctl(LCD_SET_COL_LO+0);
; SOURCE LINE # 212
CLR A
MOV R7,A
LCALL _lcd_out_ctl
; for(i=0; i<132; i++)
; SOURCE LINE # 213
;---- Variable 'i?346' assigned to Register 'R3' ----
CLR A
MOV R3,A
?C0027:
; {
; SOURCE LINE # 214
; lcd_out_dat(0); /* clear the data */
; SOURCE LINE # 215
CLR A
MOV R7,A
LCALL _lcd_out_dat
; }
; SOURCE LINE # 216
INC R3
CJNE R3,#084H,?C0027
; }
; SOURCE LINE # 217
?C0026:
INC R4
CJNE R4,#09H,?C0024
; }
; SOURCE LINE # 218
?C0030:
RET
; END OF lcd_erase
;
; /*
; **
; ** routine to display a test pattern on the LCD screen,
; **
; */
;
; unsigned char code testpat[4][8]={
; {0x0F,0x0F,0x0F,0x0F,0xF0,0xF0,0xF0,0xF0},
; {0xF0,0xF0,0xF0,0xF0,0x0F,0x0F,0x0F,0x0F},
; {0xFF,0x81,0xBD,0xBD,0xBD,0xBD,0x81,0xFF},
; {0x00,0x7E,0x42,0x42,0x42,0x42,0x7E,0x00}
; };
;
; void lcd_test(unsigned char pattern)
RSEG ?PR?_lcd_test?LCD106X56
_lcd_test:
USING 0
; SOURCE LINE # 233
;---- Variable 'pattern?447' assigned to Register 'R4' ----
MOV R4,AR7
; {
; SOURCE LINE # 234
; unsigned char p;
; unsigned char i;
;
; for(p=0; p<7; p++)
; SOURCE LINE # 238
;---- Variable 'p?448' assigned to Register 'R3' ----
CLR A
MOV R3,A
?C0031:
; {
; SOURCE LINE # 239
; lcd_out_ctl(LCD_SET_PAGE+p); /* set page */
; SOURCE LINE # 240
MOV A,R3
; lcd_out_ctl(LCD_SET_COL_HI+26/16); /* set column 0 */
; SOURCE LINE # 241
; lcd_out_ctl(LCD_SET_COL_LO+26%16);
; SOURCE LINE # 242
LCALL L?0124
; for(i=0; i<106; i++)
; SOURCE LINE # 243
;---- Variable 'i?449' assigned to Register 'R2' ----
CLR A
MOV R2,A
?C0034:
; {
; SOURCE LINE # 244
; lcd_out_dat(testpat[pattern][i%8]);
; SOURCE LINE # 245
MOV A,R2
ANL A,#07H
MOV R7,A
MOV A,R4
MOV B,#08H
MUL AB
ADD A,#LOW (testpat)
MOV DPL,A
CLR A
ADDC A,#HIGH (testpat)
MOV DPH,A
MOV A,DPL
ADD A,R7
MOV DPL,A
CLR A
ADDC A,DPH
MOV DPH,A
CLR A
MOVC A,@A+DPTR
MOV R7,A
LCALL _lcd_out_dat
; }
; SOURCE LINE # 246
INC R2
CJNE R2,#06AH,?C0034
; }
; SOURCE LINE # 247
?C0033:
INC R3
CJNE R3,#07H,?C0031
; }
; SOURCE LINE # 248
?C0037:
RET
; END OF _lcd_test
;
; /*
; **
; ** Clears the display memory starting at the left/top and going to
; ** the right/bottom . No runtime error checking is performed. It is
; ** assumed that left is less than right and that top is less than
; ** bottom
; **
; */
;
; void lcd_clear_area(unsigned char left, unsigned char top,
RSEG ?PR?_lcd_clear_area?LCD106X56
_lcd_clear_area:
USING 0
; SOURCE LINE # 259
MOV top?551,R5
MOV right?552,R3
;---- Variable 'left?550' assigned to Register 'R7' ----
; unsigned char right, unsigned char bottom)
; {
; SOURCE LINE # 261
; unsigned char bit_pos;
; unsigned char x;
; unsigned char byte_offset;
; unsigned char y_bits;
; unsigned char remaining_bits;
; unsigned char mask;
;
; bit_pos = top & 0x07; /* get starting bit offset into byte */
; SOURCE LINE # 269
MOV A,top?551
ANL A,#07H
MOV bit_pos?554,A
;
; for(x = left; x <= right; x++)
; SOURCE LINE # 271
;---- Variable 'x?555' assigned to Register 'R7' ----
?C0038:
MOV A,R7
SETB C
SUBB A,right?552
JC $ + 4H
AJMP ?C0050
; {
; SOURCE LINE # 272
; byte_offset = top >> 3; /* get byte offset into y direction */
; SOURCE LINE # 273
MOV A,top?551
RRC A
RRC A
RRC A
ANL A,#01FH
;---- Variable 'byte_offset?556' assigned to Register 'R1' ----
MOV R1,A
; y_bits = (bottom - top) + 1; /* get length in the y direction to write */
; SOURCE LINE # 274
CLR C
MOV A,bottom?553
SUBB A,top?551
INC A
MOV R6,A
;---- Variable 'y_bits?557' assigned to Register 'R6' ----
; remaining_bits = 8 - bit_pos; /* number of bits left in byte */
; SOURCE LINE # 275
CLR C
MOV A,#08H
SUBB A,bit_pos?554
MOV R5,A
;---- Variable 'remaining_bits?558' assigned to Register 'R5' ----
; mask = l_mask_array[bit_pos]; /* get mask for this bit */
; SOURCE LINE # 276
MOV A,bit_pos?554
MOV DPTR,#l_mask_array
MOVC A,@A+DPTR
MOV R4,A
;---- Variable 'mask?559' assigned to Register 'R4' ----
?C0041:
;
; while(y_bits) /* while there are still bits to write */
; SOURCE LINE # 278
MOV A,R6
JZ ?C0040
; {
; SOURCE LINE # 279
; if((remaining_bits == 8) && (y_bits > 7))
; SOURCE LINE # 280
CJNE R5,#08H,?C0043
SETB C
SUBB A,#07H
JC ?C0043
; {
; SOURCE LINE # 281
?C0044:
; /* here if we are byte aligned and have at least 1 byte to write */
; /* do the entire byte at once instead of bit by bit */
; while(y_bits > 7) /* while there are at least 8 more bits to do */
; SOURCE LINE # 284
MOV A,R6
SETB C
SUBB A,#07H
JC ?C0041
; {
; SOURCE LINE # 285
; l_display_array[byte_offset][x] = 0x00;
; SOURCE LINE # 286
MOV B,#06AH
MOV A,R1
MUL AB
ADD A,#LOW (l_display_array)
MOV DPL,A
MOV A,B
ADDC A,#HIGH (l_display_array)
MOV DPH,A
MOV A,DPL
ADD A,R7
MOV DPL,A
CLR A
ADDC A,DPH
MOV DPH,A
CLR A
MOVX @DPTR,A
; byte_offset++;
; SOURCE LINE # 287
INC R1
; y_bits -= 8;
; SOURCE LINE # 288
MOV A,#0F8H
ADD A,R6
MOV R6,A
; }
; SOURCE LINE # 289
SJMP ?C0044
; }
; SOURCE LINE # 290
?C0043:
; else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -