📄 lm032l8.lst
字号:
LOC OBJECT CODE LINE SOURCE TEXT
0181 ;
0182 ;Send a message the hard way
003B 304D 0183 movlw 'M'
003C 2061 0184 call SEND_CHAR
003D 3069 0185 movlw 'i'
003E 2061 0186 call SEND_CHAR
003F 3063 0187 movlw 'c'
0040 2061 0188 call SEND_CHAR
0041 3072 0189 movlw 'r'
0042 2061 0190 call SEND_CHAR
0043 306F 0191 movlw 'o'
0044 2061 0192 call SEND_CHAR
0045 3063 0193 movlw 'c'
0046 2061 0194 call SEND_CHAR
0047 3068 0195 movlw 'h'
0048 2061 0196 call SEND_CHAR
0049 3069 0197 movlw 'i'
004A 2061 0198 call SEND_CHAR
004B 3070 0199 movlw 'p'
004C 2061 0200 call SEND_CHAR
0201
004D 30C0 0202 movlw B'11000000' ;Address DDRam first character, second line
004E 206A 0203 call SEND_CMD
0204
0205 ;Demonstration of the use of a table to output a message
004F 3000 0206 movlw 0 ;Table address of start of message
0207 dispmsg
0050 00B0 0208 movwf TEMP1 ;TEMP1 holds start of message address
0051 2085 0209 call Table
0052 39FF 0210 andlw 0FFh ;Check if at end of message (zero
0053 1903 0211 btfsc STATUS,Z ;returned at end)
0054 2859 0212 goto out
0055 2061 0213 call SEND_CHAR ;Display character
0056 0830 0214 movf TEMP1,w ;Point to next character
0057 3E01 0215 addlw 1
0058 2850 0216 goto dispmsg
0217 out
0218 loop
0059 2859 0219 goto loop ;Stay here forever
0220 ;
0221 ;
0222 INIT_DISPLAY
005A 300C 0223 MOVLW DISP_ON ; Display On, Cursor On
005B 206A 0224 CALL SEND_CMD ; Send This command to the Display Module
005C 3001 0225 MOVLW CLR_DISP ; Clear the Display
005D 206A 0226 CALL SEND_CMD ; Send This command to the Display Module
005E 3006 0227 MOVLW ENTRY_INC ; Set Entry Mode Inc., No shift
005F 206A 0228 CALL SEND_CMD ; Send This command to the Display Module
0060 0008 0229 RETURN
0230 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
0232 ;
0233 ;*******************************************************************
0234 ;* The LCD Module Subroutines *
0235 ;*******************************************************************
0236 ;
0237 if ( Four_bit ) ; 4-bit Data transfers?
0238 ;
0239 if ( Data_HI ) ; 4-bit transfers on the high nibble of the PORT
0240 ;
0241 ;*******************************************************************
0242 ;*SendChar - Sends character to LCD *
0243 ;*This routine splits the character into the upper and lower *
0244 ;*nibbles and sends them to the LCD, upper nibble first. *
0245 ;*******************************************************************
0246 ;
0247 SEND_CHAR
0248 MOVWF CHAR ;Character to be sent is in W
0249 CALL BUSY_CHECK ;Wait for LCD to be ready
0250 MOVF CHAR, w
0251 ANDLW 0xF0 ;Get upper nibble
0252 MOVWF LCD_DATA ;Send data to LCD
0253 BCF LCD_CNTL, R_W ;Set LCD to read
0254 BSF LCD_CNTL, RS ;Set LCD to data mode
0255 BSF LCD_CNTL, E ;toggle E for LCD
0256 BCF LCD_CNTL, E
0257 SWAPF CHAR, w
0258 ANDLW 0xF0 ;Get lower nibble
0259 MOVWF LCD_DATA ;Send data to LCD
0260 BSF LCD_CNTL, E ;toggle E for LCD
0261 BCF LCD_CNTL, E
0262 RETURN
0263 ;
0264 else ; 4-bit transfers on the low nibble of the PORT
0265 ;
0266 ;*******************************************************************
0267 ;* SEND_CHAR - Sends character to LCD *
0268 ;* This routine splits the character into the upper and lower *
0269 ;* nibbles and sends them to the LCD, upper nibble first. *
0270 ;* The data is transmitted on the PORT<3:0> pins *
0271 ;*******************************************************************
0272 ;
0273 SEND_CHAR
0274 MOVWF CHAR ; Character to be sent is in W
0275 CALL BUSY_CHECK ; Wait for LCD to be ready
0276 SWAPF CHAR, W
0277 ANDLW 0x0F ; Get upper nibble
0278 MOVWF LCD_DATA ; Send data to LCD
0279 BCF LCD_CNTL, R_W ; Set LCD to read
0280 BSF LCD_CNTL, RS ; Set LCD to data mode
0281 BSF LCD_CNTL, E ; toggle E for LCD
0282 BCF LCD_CNTL, E
0283 MOVF CHAR, W
0284 ANDLW 0x0F ; Get lower nibble
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
0285 MOVWF LCD_DATA ; Send data to LCD
0286 BSF LCD_CNTL, E ; toggle E for LCD
0287 BCF LCD_CNTL, E
0288 RETURN
0289 ;
0290 endif
0291 else
0292 ;
0293 ;*****************************************************************
0294 ;* SEND_CHAR - Sends character contained in register W to LCD *
0295 ;* This routine sends the entire character to the PORT *
0296 ;* The data is transmitted on the PORT<7:0> pins *
0297 ;*****************************************************************
0298 ;
0299 SEND_CHAR
0061 00B6 0300 MOVWF CHAR ; Character to be sent is in W
0062 2073 0301 CALL BUSY_CHECK ; Wait for LCD to be ready
0063 0836 0302 MOVF CHAR, w
0064 0088 0303 MOVWF LCD_DATA ; Send data to LCD
0065 1105 0304 BCF LCD_CNTL, R_W ; Set LCD in read mode
0066 1485 0305 BSF LCD_CNTL, RS ; Set LCD in data mode
0067 1585 0306 BSF LCD_CNTL, E ; toggle E for LCD
0068 1185 0307 BCF LCD_CNTL, E
0069 0008 0308 RETURN
0309 ;
0310 endif
0311 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
0313 ;
0314 ;*******************************************************************
0315 ;* SendCmd - Sends command to LCD *
0316 ;* This routine splits the command into the upper and lower *
0317 ;* nibbles and sends them to the LCD, upper nibble first. *
0318 ;* The data is transmitted on the PORT<3:0> pins *
0319 ;*******************************************************************
0320 ;
0321 if ( Four_bit ) ; 4-bit Data transfers?
0322 ;
0323 if ( Data_HI ) ; 4-bit transfers on the high nibble of the PORT
0324 ;
0325 ;*******************************************************************
0326 ;* SEND_CMD - Sends command to LCD *
0327 ;* This routine splits the command into the upper and lower *
0328 ;* nibbles and sends them to the LCD, upper nibble first. *
0329 ;*******************************************************************
0330
0331 SEND_CMD
0332 MOVWF CHAR ; Character to be sent is in W
0333 CALL BUSY_CHECK ; Wait for LCD to be ready
0334 MOVF CHAR,w
0335 ANDLW 0xF0 ; Get upper nibble
0336 MOVWF LCD_DATA ; Send data to LCD
0337 BCF LCD_CNTL,R_W ; Set LCD to read
0338 BCF LCD_CNTL,RS ; Set LCD to command mode
0339 BSF LCD_CNTL,E ; toggle E for LCD
0340 BCF LCD_CNTL,E
0341 SWAPF CHAR,w
0342 ANDLW 0xF0 ; Get lower nibble
0343 MOVWF LCD_DATA ; Send data to LCD
0344 BSF LCD_CNTL,E ; toggle E for LCD
0345 BCF LCD_CNTL,E
0346 RETURN
0347 ;
0348 else ; 4-bit transfers on the low nibble of the PORT
0349 ;
0350 SEND_CMD
0351 MOVWF CHAR ; Character to be sent is in W
0352 CALL BUSY_CHECK ; Wait for LCD to be ready
0353 SWAPF CHAR, W
0354 ANDLW 0x0F ; Get upper nibble
0355 MOVWF LCD_DATA ; Send data to LCD
0356 BCF LCD_CNTL, R_W ; Set LCD to read
0357 BCF LCD_CNTL, RS ; Set LCD to command mode
0358 BSF LCD_CNTL, E ; toggle E for LCD
0359 BCF LCD_CNTL, E
0360 MOVF CHAR, W
0361 ANDLW 0x0F ; Get lower nibble
0362 MOVWF LCD_DATA ; Send data to LCD
0363 BSF LCD_CNTL, E ; toggle E for LCD
0364 BCF LCD_CNTL, E
0365 RETURN
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 10
LOC OBJECT CODE LINE SOURCE TEXT
0366 ;
0367 endif
0368 else
0369 ;
0370 ;**************************************************************
0371 ;* SEND_CND - Sends command contained in register W to LCD *
0372 ;* This routine sends the entire character to the PORT *
0373 ;* The data is transmitted on the PORT<7:0> pins *
0374 ;**************************************************************
0375
0376 SEND_CMD
006A 00B6 0377 MOVWF CHAR ; Command to be sent is in W
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -