📄 base1.lst
字号:
Message[305]: Using default destination of 1 (file).
0062 07F9 00198 ADDWF Tens ; convert tens to ASCII
Message[305]: Using default destination of 1 (file).
0063 07FA 00199 ADDWF Ones ; convert ones to ASCII
00200
MPASM 03.70.01 Released BASE1.ASM 3-28-2006 19:32:15 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00201 ; Display voltage on line 1 --------------------------------
00202
0064 207F 00203 CALL volmes ; Display text on line 1
00204
0065 0878 00205 MOVF Huns,W ; load hundreds code
0066 20B5 00206 CALL send ; and send to display
0067 302E 00207 MOVLW '.' ; load point code
0068 20B5 00208 CALL send ; and output
0069 0879 00209 MOVF Tens,W ; load tens code
006A 20B5 00210 CALL send ; and output
006B 087A 00211 MOVF Ones,W ; load ones code
006C 20B5 00212 CALL send ; and output
006D 3020 00213 MOVLW ' ' ; load space code
006E 20B5 00214 CALL send ; and output
006F 3056 00215 MOVLW 'V' ; load volts code
0070 20B5 00216 CALL send ; and output
00217
0071 0008 00218 RETURN ; done
00219
00220 ; Store voltage in serial memory --------------------------
00221
0072 1694 00222 store BSF SSPCON,SSPEN ; Enable memory port
0073 081E 00223 MOVF ADRESH,W ; Get voltage code
0074 00E0 00224 MOVWF SenReg ; Load it to write
0075 212E 00225 CALL writmem ; Write it to memory
Message[305]: Using default destination of 1 (file).
0076 0AE2 00226 INCF LoReg ; Next location
0077 1294 00227 BCF SSPCON,SSPEN ; Disable memory port
0078 0008 00228 RETURN ; done
00229
00230
00231 ;----------------------------------------------------------
00232 ; Display key input on bottom line of LCD
00233 ;----------------------------------------------------------
00234
0079 10F4 00235 putkey BCF Select,RS ; set display command mode
007A 30C0 00236 MOVLW 0C0 ; code to home cursor
007B 20B5 00237 CALL send ; output it to display
007C 14F4 00238 BSF Select,RS ; and restore data mode
007D 2089 00239 CALL keymes
007E 0008 00240 RETURN ; done
00241
00242 ;----------------------------------------------------------
00243 ; Display fixed messages
00244 ;----------------------------------------------------------
00245
007F 01A1 00246 volmes CLRF Tabin ; Zero table pointer
0080 0821 00247 next1 MOVF Tabin,W ; Load table pointer
0081 2093 00248 CALL mess1 ; Get next character
0082 00A0 00249 MOVWF Temp ; Test data...
0083 08A0 00250 MOVF Temp,F ; ..for zero
0084 1903 00251 BTFSC STATUS,Z ; Last letter done?
0085 0008 00252 RETURN ; yes - next block
MPASM 03.70.01 Released BASE1.ASM 3-28-2006 19:32:15 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0086 20B5 00253 CALL send ; no - display it
Message[305]: Using default destination of 1 (file).
0087 0AA1 00254 INCF Tabin ; Point to next letter
0088 2880 00255 GOTO next1 ; and get it
00256
00257 ; ---------------------------------------------------------
00258
0089 01A1 00259 keymes CLRF Tabin ; Zero table pointer
008A 0821 00260 next2 MOVF Tabin,W ; Load table pointer
008B 209D 00261 CALL mess2 ; Get next character
008C 00A0 00262 MOVWF Temp ; Test data...
008D 08A0 00263 MOVF Temp,F ; ..for zero
008E 1903 00264 BTFSC STATUS,Z ; Last letter done?
008F 0008 00265 RETURN ; yes - next block
0090 20B5 00266 CALL send ; no - display it
Message[305]: Using default destination of 1 (file).
0091 0AA1 00267 INCF Tabin ; Point to next letter
0092 288A 00268 GOTO next2 ; and get it
00269
00270 ;----------------------------------------------------------
00271 ; Text strings for fixed messages
00272 ;----------------------------------------------------------
00273
Message[305]: Using default destination of 1 (file).
0093 0782 00274 mess1 ADDWF PCL ; Set table pointer
0094 3456 346F 346C 00275 DT "Volts = ",0 ; Text for display
3474 3473 3420
343D 3420 3400
00276
Message[305]: Using default destination of 1 (file).
009D 0782 00277 mess2 ADDWF PCL ; Set table pointer
009E 344B 3465 3479 00278 DT "Key = ",0 ; Text for display
3420 343D 3420
3400
00279
00280 ;-------------------------------------------------------------
00281
00282
00283 ;----------------------------------------------------------
00284 ; INCLUDED ROUTINES
00285 ;----------------------------------------------------------
00286 ; LCD DRIVER
00287 ; Contains routines:
00288 ; init: Initialises display
00289 ; onems: 1 ms delay
00290 ; xms: X ms delay
00291 ; Receives X in W
00292 ; send: sends a character to display
00293 ; Receives: Control code in W (Select,RS=0)
00294 ; ASCII character code in W (RS=1)
00295 ;
00296 INCLUDE "LCDIS.INC"
00001 ;
MPASM 03.70.01 Released BASE1.ASM 3-28-2006 19:32:15 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00002 ;------------------------------------------------------------
00003 ; LCDIS.INC MPB 19-12-05
00004 ; Include file to operate 16x2 LCD display
00005 ; Uses GPR 70 - 75
00006 ;
00007 ;------------------------------------------------------------
00008
00000070 00009 Timer1 EQU 70 ; 1ms count register
00000071 00010 TimerX EQU 71 ; Xms count register
00000072 00011 Var EQU 72 ; Output variable
00000073 00012 Point EQU 73 ; Program table pointer
00000074 00013 Select EQU 74 ; Set or clear RS bit
00000075 00014 OutCod EQU 75 ; Temp store for output code
00015
00000001 00016 RS EQU 1 ; Register select output bit
00000002 00017 E EQU 2 ; Enable clocks display
00018
00019
00020 ;------------------------------------------------------------
00021 ; 1ms delay with 1us cycle time (1000 cycles)
00022 ;------------------------------------------------------------
00A5 30F9 00023 onems MOVLW D'249' ; Count for 1ms delay
00A6 00F0 00024 MOVWF Timer1 ; Load count
00A7 0000 00025 loop1 NOP ; Pad for 4 cycle loop
Message[305]: Using default destination of 1 (file).
00A8 0BF0 00026 DECFSZ Timer1 ; Count
00A9 28A7 00027 GOTO loop1 ; until Z
00AA 0008 00028 RETURN ; and finish
00029
00030 ;------------------------------------------------------------
00031 ; Delay Xms
00032 ; Receives count in W, uses Onems
00033 ;------------------------------------------------------------
00AB 00F1 00034 xms MOVWF TimerX ; Count for X ms
00AC 20A5 00035 loopX CALL onems ; Delay 1ms
Message[305]: Using default destination of 1 (file).
00AD 0BF1 00036 DECFSZ TimerX ; Repeat X times
00AE 28AC 00037 GOTO loopX ; until Z
00AF 0008 00038 RETURN ; and finish
00039
00040 ;------------------------------------------------------------
00041 ; Generate data/command clock siganl E
00042 ;------------------------------------------------------------
00B0 1508 00043 pulseE BSF LCDport,E ; Set E high
00B1 20A5 00044 CALL onems ; Delay 1ms
00B2 1108 00045 BCF LCDport,E ; Reset E low
00B3 20A5 00046 CALL onems ; Delay 1ms
00B4 0008 00047 RETURN ; done
00048
00049 ;------------------------------------------------------------
00050 ; Send a command byte in two nibbles from RB4 - RB7
00051 ; Receives command in W, uses PulseE and Onems
00052 ;------------------------------------------------------------
MPASM 03.70.01 Released BASE1.ASM 3-28-2006 19:32:15 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00B5 00F5 00053 send MOVWF OutCod ; Store output code
00B6 39F0 00054 ANDLW 0F0 ; Clear low nybble
00B7 0088 00055 MOVWF LCDport ; Output high nybble
00B8 18F4 00056 BTFSC Select,RS ; Test RS bit
00B9 1488 00057 BSF LCDport,RS ; and set for data
00BA 20B0 00058 CALL pulseE ; and clock display
00BB 20A5 00059 CALL onems ; wait 1ms for display
00060
Message[305]: Using default destination of 1 (file).
00BC 0EF5 00061 SWAPF OutCod ; Swap low and high
00BD 0875 00062 MOVF OutCod,W ; Retrieve output code
00BE 39F0 00063 ANDLW 0F0 ; Clear low nybble
00BF 0088 00064 MOVWF LCDport ; Output low nybble
00C0 18F4 00065 BTFSC Select,RS ; Test RS bit
00C1 1488 00066 BSF LCDport,RS ; and set for data
00C2 20B0 00067 CALL pulseE ; and clock display
00C3 20A5 00068 CALL onems ; wait 1ms for display
00C4 0008 00069 RETURN ; done
00070
00071 ;------------------------------------------------------------
00072 ; Initialise the display
00073 ; Uses Send
00074 ;------------------------------------------------------------
00C5 3064 00075 inid MOVLW D'100' ; Load count for 100ms delay
00C6 20AB 00076 CALL xms ; and wait for display start
00C7 30F0 00077 MOVLW 0F0 ; Mask for select code
00C8 00F4 00078 MOVWF Select ; High nybble not masked
00079
00C9 3030 00080 MOVLW 0x30 ; Load initial nibble
00CA 0088 00081 MOVWF LCDport ; and output it to display
00CB 20B0 00082 CALL pulseE ; Latch initial code
00CC 3005 00083 MOVLW D'5' ; Set delay 5ms
00CD 20AB 00084 CALL xms ; and wait
00CE 20B0 00085 CALL pulseE ; Latch initial code again
00CF 20A5 00086 CALL onems ; Wait 1ms
00D0 20B0 00087 CALL pulseE ; Latch initial code again
00D1 1208 00088 BCF LCDport,4 ; Set 4-bit mode
00D2 20B0 00089 CALL pulseE ; Latch it
00090
00D3 3028 00091 MOVLW 0x28 ; Set 4-bit mode, 2 lines
00D4 20B5 00092 CALL send ; and send code
00D5 3008 00093 MOVLW 0x08 ; Switch off display
00D6 20B5 00094 CALL send ; and send code
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -