📄 lm032l.lst
字号:
0038 2074 00180 CALL SEND_CMD ;
0039 3001 00181 MOVLW CLR_DISP ;
003A 2074 00182 CALL SEND_CMD ;
003B 3006 00183 MOVLW ENTRY_INC ;
003C 2074 00184 CALL SEND_CMD ;
003D 3080 00185 MOVLW DD_RAM_ADDR ;
003E 2074 00186 CALL SEND_CMD ;
00187 ;
MPASM 01.40 Released LM032L.ASM 1-22-1997 10:25:15 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00188 page
00189 ;
00190 ;Send a message the hard way
003F 304D 00191 movlw 'M'
0040 2065 00192 call SEND_CHAR
0041 3069 00193 movlw 'i'
0042 2065 00194 call SEND_CHAR
0043 3063 00195 movlw 'c'
0044 2065 00196 call SEND_CHAR
0045 3072 00197 movlw 'r'
0046 2065 00198 call SEND_CHAR
0047 306F 00199 movlw 'o'
0048 2065 00200 call SEND_CHAR
0049 3063 00201 movlw 'c'
004A 2065 00202 call SEND_CHAR
004B 3068 00203 movlw 'h'
004C 2065 00204 call SEND_CHAR
004D 3069 00205 movlw 'i'
004E 2065 00206 call SEND_CHAR
004F 3070 00207 movlw 'p'
0050 2065 00208 call SEND_CHAR
00209
0051 30C0 00210 movlw B'11000000' ;Address DDRam first character, second line
0052 2074 00211 call SEND_CMD
00212
00213 ;Demonstration of the use of a table to output a message
0053 3000 00214 movlw 0 ;Table address of start of message
0054 00215 dispmsg
0054 00B0 00216 movwf TEMP1 ;TEMP1 holds start of message address
0055 209B 00217 call Table
0056 39FF 00218 andlw 0FFh ;Check if at end of message (zero
0057 1903 00219 btfsc STATUS,Z ;returned at end)
0058 285D 00220 goto out
0059 2065 00221 call SEND_CHAR ;Display character
005A 0830 00222 movf TEMP1,w ;Point to next character
005B 3E01 00223 addlw 1
005C 2854 00224 goto dispmsg
005D 00225 out
005D 00226 loop
005D 285D 00227 goto loop ;Stay here forever
00228 ;
00229 ;
005E 00230 INIT_DISPLAY
005E 300C 00231 MOVLW DISP_ON ; Display On, Cursor On
005F 2074 00232 CALL SEND_CMD ; Send This command to the Display Module
0060 3001 00233 MOVLW CLR_DISP ; Clear the Display
0061 2074 00234 CALL SEND_CMD ; Send This command to the Display Module
0062 3006 00235 MOVLW ENTRY_INC ; Set Entry Mode Inc., No shift
0063 2074 00236 CALL SEND_CMD ; Send This command to the Display Module
0064 0008 00237 RETURN
00238 ;
MPASM 01.40 Released LM032L.ASM 1-22-1997 10:25:15 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00239 page
00240 ;
00241 ;*******************************************************************
00242 ;* The LCD Module Subroutines *
00243 ;*******************************************************************
00244 ;
00245 if ( Four_bit ) ; 4-bit Data transfers?
00246 ;
00247 if ( Data_HI ) ; 4-bit transfers on the high nibble of the PORT
00248 ;
00249 ;*******************************************************************
00250 ;*SendChar - Sends character to LCD *
00251 ;*This routine splits the character into the upper and lower *
00252 ;*nibbles and sends them to the LCD, upper nibble first. *
00253 ;*******************************************************************
00254 ;
00255 SEND_CHAR
00256 MOVWF CHAR ;Character to be sent is in W
00257 CALL BUSY_CHECK ;Wait for LCD to be ready
00258 MOVF CHAR, w
00259 ANDLW 0xF0 ;Get upper nibble
00260 MOVWF LCD_DATA ;Send data to LCD
00261 BCF LCD_CNTL, RW ;Set LCD to read
00262 BSF LCD_CNTL, RS ;Set LCD to data mode
00263 BSF LCD_CNTL, E ;toggle E for LCD
00264 BCF LCD_CNTL, E
00265 SWAPF CHAR, w
00266 ANDLW 0xF0 ;Get lower nibble
00267 MOVWF LCD_DATA ;Send data to LCD
00268 BSF LCD_CNTL, E ;toggle E for LCD
00269 BCF LCD_CNTL, E
00270 RETURN
00271 ;
00272 else ; 4-bit transfers on the low nibble of the PORT
00273 ;
00274 ;*******************************************************************
00275 ;* SEND_CHAR - Sends character to LCD *
00276 ;* This routine splits the character into the upper and lower *
00277 ;* nibbles and sends them to the LCD, upper nibble first. *
00278 ;* The data is transmitted on the PORT<3:0> pins *
00279 ;*******************************************************************
00280 ;
0065 00281 SEND_CHAR
0065 00B6 00282 MOVWF CHAR ; Character to be sent is in W
0066 2083 00283 CALL BUSY_CHECK ; Wait for LCD to be ready
0067 0E36 00284 SWAPF CHAR, W
0068 390F 00285 ANDLW 0x0F ; Get upper nibble
0069 0086 00286 MOVWF LCD_DATA ; Send data to LCD
006A 1085 00287 BCF LCD_CNTL, RW ; Set LCD to read
006B 1505 00288 BSF LCD_CNTL, RS ; Set LCD to data mode
006C 1405 00289 BSF LCD_CNTL, E ; toggle E for LCD
006D 1005 00290 BCF LCD_CNTL, E
006E 0836 00291 MOVF CHAR, W
MPASM 01.40 Released LM032L.ASM 1-22-1997 10:25:15 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
006F 390F 00292 ANDLW 0x0F ; Get lower nibble
0070 0086 00293 MOVWF LCD_DATA ; Send data to LCD
0071 1405 00294 BSF LCD_CNTL, E ; toggle E for LCD
0072 1005 00295 BCF LCD_CNTL, E
0073 0008 00296 RETURN
00297 ;
00298 endif
00299 else
00300 ;
00301 ;*****************************************************************
00302 ;* SEND_CHAR - Sends character contained in register W to LCD *
00303 ;* This routine sends the entire character to the PORT *
00304 ;* The data is transmitted on the PORT<7:0> pins *
00305 ;*****************************************************************
00306 ;
00307 SEND_CHAR
00308 MOVWF CHAR ; Character to be sent is in W
00309 CALL BUSY_CHECK ; Wait for LCD to be ready
00310 MOVF CHAR, w
00311 MOVWF LCD_DATA ; Send data to LCD
00312 BCF LCD_CNTL, RW ; Set LCD in read mode
00313 BSF LCD_CNTL, RS ; Set LCD in data mode
00314 BSF LCD_CNTL, E ; toggle E for LCD
00315 BCF LCD_CNTL, E
00316 RETURN
00317 ;
00318 endif
00319 ;
MPASM 01.40 Released LM032L.ASM 1-22-1997 10:25:15 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00320 page
00321 ;
00322 ;*******************************************************************
00323 ;* SendCmd - Sends command to LCD *
00324 ;* This routine splits the command into the upper and lower *
00325 ;* nibbles and sends them to the LCD, upper nibble first. *
00326 ;* The data is transmitted on the PORT<3:0> pins *
00327 ;*******************************************************************
00328 ;
00329 if ( Four_bit ) ; 4-bit Data transfers?
00330 ;
00331 if ( Data_HI ) ; 4-bit transfers on the high nibble of the PORT
00332 ;
00333 ;*******************************************************************
00334 ;* SEND_CMD - Sends command to LCD *
00335 ;* This routine splits the command into the upper and lower *
00336 ;* nibbles and sends them to the LCD, upper nibble first. *
00337 ;*******************************************************************
00338
00339 SEND_CMD
00340 MOVWF CHAR ; Character to be sent is in W
00341 CALL BUSY_CHECK ; Wait for LCD to be ready
00342 MOVF CHAR,w
00343 ANDLW 0xF0 ; Get upper nibble
00344 MOVWF LCD_DATA ; Send data to LCD
00345 BCF LCD_CNTL,RW ; Set LCD to read
00346 BCF LCD_CNTL,RS ; Set LCD to command mode
00347 BSF LCD_CNTL,E ; toggle E for LCD
00348 BCF LCD_CNTL,E
00349 SWAPF CHAR,w
00350 ANDLW 0xF0 ; Get lower nibble
00351 MOVWF LCD_DATA ; Send data to LCD
00352 BSF LCD_CNTL,E ; toggle E for LCD
00353 BCF LCD_CNTL,E
00354 RETURN
00355 ;
00356 else ; 4-bit transfers on the low nibble of the PORT
00357 ;
0074 00358 SEND_CMD
0074 00B6 00359 MOVWF CHAR ; Character to be sent is in W
0075 2083 00360 CALL BUSY_CHECK ; Wait for LCD to be ready
0076 0E36 00361 SWAPF CHAR, W
0077 390F 00362 ANDLW 0x0F ; Get upper nibble
0078 0086 00363 MOVWF LCD_DATA ; Send data to LCD
0079 1085 00364 BCF LCD_CNTL, RW ; Set LCD to read
007A 1105 00365 BCF LCD_CNTL, RS ; Set LCD to command mode
007B 1405 00366 BSF LCD_CNTL, E ; toggle E for LCD
007C 1005 00367 BCF LCD_CNTL, E
007D 0836 00368 MOVF CHAR, W
007E 390F 00369 ANDLW 0x0F ; Get lower nibble
007F 0086 00370 MOVWF LCD_DATA ; Send data to LCD
0080 1405 00371 BSF LCD_CNTL, E ; toggle E for LCD
0081 1005 00372 BCF LCD_CNTL, E
MPASM 01.40 Released LM032L.ASM 1-22-1997 10:25:15 PAGE 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -