📄 lm032l4l.lst
字号:
LOC OBJECT CODE LINE SOURCE TEXT
0181 ;
0182 ;Send a message the hard way
003F 304D 0183 movlw 'M'
0040 2065 0184 call SEND_CHAR
0041 3069 0185 movlw 'i'
0042 2065 0186 call SEND_CHAR
0043 3063 0187 movlw 'c'
0044 2065 0188 call SEND_CHAR
0045 3072 0189 movlw 'r'
0046 2065 0190 call SEND_CHAR
0047 306F 0191 movlw 'o'
0048 2065 0192 call SEND_CHAR
0049 3063 0193 movlw 'c'
004A 2065 0194 call SEND_CHAR
004B 3068 0195 movlw 'h'
004C 2065 0196 call SEND_CHAR
004D 3069 0197 movlw 'i'
004E 2065 0198 call SEND_CHAR
004F 3070 0199 movlw 'p'
0050 2065 0200 call SEND_CHAR
0201
0051 30C0 0202 movlw B'11000000' ;Address DDRam first character, second line
0052 2074 0203 call SEND_CMD
0204
0205 ;Demonstration of the use of a table to output a message
0053 3000 0206 movlw 0 ;Table address of start of message
0207 dispmsg
0054 00B0 0208 movwf TEMP1 ;TEMP1 holds start of message address
0055 209B 0209 call Table
0056 39FF 0210 andlw 0FFh ;Check if at end of message (zero
0057 1903 0211 btfsc STATUS,Z ;returned at end)
0058 285D 0212 goto out
0059 2065 0213 call SEND_CHAR ;Display character
005A 0830 0214 movf TEMP1,w ;Point to next character
005B 3E01 0215 addlw 1
005C 2854 0216 goto dispmsg
0217 out
0218 loop
005D 285D 0219 goto loop ;Stay here forever
0220 ;
0221 ;
0222 INIT_DISPLAY
005E 300C 0223 MOVLW DISP_ON ; Display On, Cursor On
005F 2074 0224 CALL SEND_CMD ; Send This command to the Display Module
0060 3001 0225 MOVLW CLR_DISP ; Clear the Display
0061 2074 0226 CALL SEND_CMD ; Send This command to the Display Module
0062 3006 0227 MOVLW ENTRY_INC ; Set Entry Mode Inc., No shift
0063 2074 0228 CALL SEND_CMD ; Send This command to the Display Module
0064 0008 0229 RETURN
0230 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 5:29:26 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
0065 00B6 0274 MOVWF CHAR ; Character to be sent is in W
0066 2083 0275 CALL BUSY_CHECK ; Wait for LCD to be ready
0067 0E36 0276 SWAPF CHAR, W
0068 390F 0277 ANDLW 0x0F ; Get upper nibble
0069 0086 0278 MOVWF LCD_DATA ; Send data to LCD
006A 1085 0279 BCF LCD_CNTL, R_W ; Set LCD to read
006B 1505 0280 BSF LCD_CNTL, RS ; Set LCD to data mode
006C 1405 0281 BSF LCD_CNTL, E ; toggle E for LCD
006D 1005 0282 BCF LCD_CNTL, E
006E 0836 0283 MOVF CHAR, W
006F 390F 0284 ANDLW 0x0F ; Get lower nibble
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 5:29:26 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
0070 0086 0285 MOVWF LCD_DATA ; Send data to LCD
0071 1405 0286 BSF LCD_CNTL, E ; toggle E for LCD
0072 1005 0287 BCF LCD_CNTL, E
0073 0008 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
0300 MOVWF CHAR ; Character to be sent is in W
0301 CALL BUSY_CHECK ; Wait for LCD to be ready
0302 MOVF CHAR, w
0303 MOVWF LCD_DATA ; Send data to LCD
0304 BCF LCD_CNTL, R_W ; Set LCD in read mode
0305 BSF LCD_CNTL, RS ; Set LCD in data mode
0306 BSF LCD_CNTL, E ; toggle E for LCD
0307 BCF LCD_CNTL, E
0308 RETURN
0309 ;
0310 endif
0311 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 5:29:26 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
0074 00B6 0351 MOVWF CHAR ; Character to be sent is in W
0075 2083 0352 CALL BUSY_CHECK ; Wait for LCD to be ready
0076 0E36 0353 SWAPF CHAR, W
0077 390F 0354 ANDLW 0x0F ; Get upper nibble
0078 0086 0355 MOVWF LCD_DATA ; Send data to LCD
0079 1085 0356 BCF LCD_CNTL, R_W ; Set LCD to read
007A 1105 0357 BCF LCD_CNTL, RS ; Set LCD to command mode
007B 1405 0358 BSF LCD_CNTL, E ; toggle E for LCD
007C 1005 0359 BCF LCD_CNTL, E
007D 0836 0360 MOVF CHAR, W
007E 390F 0361 ANDLW 0x0F ; Get lower nibble
007F 0086 0362 MOVWF LCD_DATA ; Send data to LCD
0080 1405 0363 BSF LCD_CNTL, E ; toggle E for LCD
0081 1005 0364 BCF LCD_CNTL, E
0082 0008 0365 RETURN
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 5:29:26 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
0377 MOVWF CHAR ; Command to be sent is in W
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -