📄 tenbit.lst
字号:
Message[305]: Using default destination of 1 (file).
0065 07B5 00214 ADDWF tens ; convert tens to ASCII
Message[305]: Using default destination of 1 (file).
0066 07B6 00215 ADDWF ones ; convert ones to ASCII
00216
0067 0833 00217 MOVF thos,W ; load thousands code
0068 208E 00218 CALL send ; and send to display
0069 302E 00219 MOVLW '.' ; load point code
006A 208E 00220 CALL send ; and output
006B 0834 00221 MOVF huns,W ; load hundreds code
006C 208E 00222 CALL send ; and send to display
006D 0835 00223 MOVF tens,W ; load tens code
006E 208E 00224 CALL send ; and output
006F 0836 00225 MOVF ones,W ; load ones code
0070 208E 00226 CALL send ; and output
0071 3020 00227 MOVLW ' ' ; load space code
0072 208E 00228 CALL send ; and output
0073 3056 00229 MOVLW 'V' ; load volts code
0074 208E 00230 CALL send ; and output
0075 306F 00231 MOVLW 'o' ; load volts code
0076 208E 00232 CALL send ; and output
0077 306C 00233 MOVLW 'l' ; load volts code
0078 208E 00234 CALL send ; and output
0079 3074 00235 MOVLW 't' ; load volts code
MPASM 03.70.01 Released TENBIT.ASM 3-28-2006 22:41:23 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
007A 208E 00236 CALL send ; and output
007B 3073 00237 MOVLW 's' ; load volts code
007C 208E 00238 CALL send ; and output
00239
007D 0008 00240 RETURN ; done
00241
00242 ;----------------------------------------------------------
00243 ; INCLUDED ROUTINES
00244 ;----------------------------------------------------------
00245 ; Include LCD driver routine
00246 ;
00247 INCLUDE "LCDIS.INC"
00001 ; LCDIS.INC MPB 19-12-05
00002 ;
00003 ; Include file to operate 16x2 LCD display
00004 ; Uses GPR 70 - 75
00005 ;
00006 ; Final version
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 ; Used to 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 output clocks display input
00018
00019
00020 ;--------------------------------------------------------------------------------------------
00021 ; 1ms delay with 1us cycle time (1000 cycles)
00022 ;--------------------------------------------------------------------------------------------
007E 30F9 00023 onems MOVLW D'249' ; Count for 1ms delay
007F 00F0 00024 MOVWF Timer1 ; Load count
0080 0000 00025 loop1 NOP ; Pad for 4 cycle loop
Message[305]: Using default destination of 1 (file).
0081 0BF0 00026 DECFSZ Timer1 ; Count
0082 2880 00027 GOTO loop1 ; until Z
0083 0008 00028 RETURN ; and finish
00029
00030 ;---------------------------------------------------------------------------------------------
00031 ; Delay Xms
00032 ; Receives count in W, uses Onems
00033 ;---------------------------------------------------------------------------------------------
0084 00F1 00034 xms MOVWF TimerX ; Count for X ms
0085 207E 00035 loopX CALL onems ; Delay 1ms
Message[305]: Using default destination of 1 (file).
0086 0BF1 00036 DECFSZ TimerX ; Repeat X times
0087 2885 00037 GOTO loopX ; until Z
0088 0008 00038 RETURN ; and finish
00039
MPASM 03.70.01 Released TENBIT.ASM 3-28-2006 22:41:23 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00040 ;---------------------------------------------------------------------------------------------
00041 ; Generate data/command clock siganl E
00042 ;---------------------------------------------------------------------------------------------
0089 1508 00043 pulseE BSF PORTD,E ; Set E high
008A 207E 00044 CALL onems ; Delay 1ms
008B 1108 00045 BCF PORTD,E ; Reset E low
008C 207E 00046 CALL onems ; Delay 1ms
008D 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 ;---------------------------------------------------------------------------------------------
008E 00F5 00053 send MOVWF OutCod ; Store output code
008F 39F0 00054 ANDLW 0F0 ; Clear low nybble
0090 0088 00055 MOVWF PORTD ; Output high nybble
0091 18F4 00056 BTFSC Select,RS ; Test RS bit
0092 1488 00057 BSF PORTD,RS ; and set for data
0093 2089 00058 CALL pulseE ; and clock display register
0094 207E 00059 CALL onems ; wait 1ms for display to complete
00060
Message[305]: Using default destination of 1 (file).
0095 0EF5 00061 SWAPF OutCod ; Swap low and high nybbles
0096 0875 00062 MOVF OutCod,W ; Retrieve output code
0097 39F0 00063 ANDLW 0F0 ; Clear low nybble
0098 0088 00064 MOVWF PORTD ; Output low nybble
0099 18F4 00065 BTFSC Select,RS ; Test RS bit
009A 1488 00066 BSF PORTD,RS ; and set for data
009B 2089 00067 CALL pulseE ; and clock display register
009C 207E 00068 CALL onems ; wait 1ms for display to complete
009D 0008 00069 RETURN ; done
00070
00071 ;---------------------------------------------------------------------------------------------
00072 ; Initialise the display
00073 ; Uses Send
00074 ;---------------------------------------------------------------------------------------------
009E 3064 00075 inid MOVLW D'100' ; Load count for 100ms delay
009F 2084 00076 CALL xms ; and wait for display start
00A0 30F0 00077 MOVLW 0F0 ; Mask for select code
00A1 00F4 00078 MOVWF Select ; High nybble not masked
00079
00A2 3030 00080 MOVLW 0x30 ; Load initial nibble
00A3 0088 00081 MOVWF PORTD ; and output it to display
00A4 2089 00082 CALL pulseE ; Latch initial code
00A5 3005 00083 MOVLW D'5' ; Set delay 5ms
00A6 2084 00084 CALL xms ; and wait
00A7 2089 00085 CALL pulseE ; Latch initial code again
00A8 207E 00086 CALL onems ; Wait 1ms
00A9 2089 00087 CALL pulseE ; Latch initial code again
00AA 1208 00088 BCF PORTD,4 ; Set 4-bit mode
00AB 2089 00089 CALL pulseE ; Latch it
00090
00AC 3028 00091 MOVLW 0x28 ; Set 4-bit mode, 2 lines
MPASM 03.70.01 Released TENBIT.ASM 3-28-2006 22:41:23 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00AD 208E 00092 CALL send ; and send code
00AE 3008 00093 MOVLW 0x08 ; Switch off display
00AF 208E 00094 CALL send ; and send code
00B0 3001 00095 MOVLW 0x01 ; Code to clear display
00B1 208E 00096 CALL send ; and send code
00B2 3006 00097 MOVLW 0x06 ; Enable cursor auto inc
00B3 208E 00098 CALL send ; and send code
00B4 3080 00099 MOVLW 0x80 ; Zero display address
00B5 208E 00100 CALL send ; and send code
00B6 300C 00101 MOVLW 0x0C ; Turn on display
00B7 208E 00102 CALL send ; and send code
00103
00B8 0008 00104 RETURN ; Done
00105
00248 ;
00249 ; Contains routines:
00250 ; init: Initialises display
00251 ; onems: 1 ms delay
00252 ; xms: X ms delay
00253 ; Receives X in W
00254 ; send: sends a character to display
00255 ; Receives: Control code in W (Select,RS=0)
00256 ; ASCII character code in W (RS=1)
00257 ;
00258 ;----------------------------------------------------------
00259 END ; of source code
MPASM 03.70.01 Released TENBIT.ASM 3-28-2006 22:41:23 PAGE 9
SYMBOL TABLE
LABEL VALUE
ACKDT 00000005
ACKEN 00000004
ACKSTAT 00000006
ADCON0 0000001F
ADCON1 0000009F
ADCS0 00000006
ADCS1 00000007
ADDEN 00000003
ADFM 00000007
ADIE 00000006
ADIF 00000006
ADON 00000000
ADRESH 0000001E
ADRESL 0000009E
ADhi 00000031
ADlo 00000032
BCLIE 00000003
BCLIF 00000003
BF 00000000
BRGH 00000002
C 00000000
C1INV 00000004
C1OUT 00000006
C2INV 00000005
C2OUT 00000007
CCP1CON 00000017
CCP1IE 00000002
CCP1IF 00000002
CCP1M0 00000000
CCP1M1 00000001
CCP1M2 00000002
CCP1M3 00000003
CCP1X 00000005
CCP1Y 00000004
CCP2CON 0000001D
CCP2IE 00000000
CCP2IF 00000000
CCP2M0 00000000
CCP2M1 00000001
CCP2M2 00000002
CCP2M3 00000003
CCP2X 00000005
CCP2Y 00000004
CCPR1H 00000016
CCPR1L 00000015
CCPR2H 0000001C
CCPR2L 0000001B
CHS0 00000003
CHS1 00000004
CHS2 00000005
CIS 00000003
CKE 00000006
CKP 00000004
MPASM 03.70.01 Released TENBIT.ASM 3-28-2006 22:41:23 PAGE 10
SYMBOL TABLE
LABEL VALUE
CM0 00000000
CM1 00000001
CM2 00000002
CMCON 0000009C
CMIE 00000006
CMIF 00000006
CREN 00000004
CSRC 00000007
CVR0 00000000
CVR1 00000001
CVR2 00000002
CVR3 00000003
CVRCON 0000009D
CVREN 00000007
CVROE 00000006
CVRR 00000005
D 00000005
DATA_ADDRESS 00000005
DC 00000001
D_A 00000005
E 00000002
EEADR 0000010D
EEADRH 0000010F
EECON1 0000018C
EECON2 0000018D
EEDATA 0000010C
EEDATH 0000010E
EEIE 00000004
EEIF 00000004
EEPGD 00000007
F 00000001
FERR 00000002
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -