📄 amps.lst
字号:
00030
00031 ;--------------------------------------------------------------
00032 ; Delay Xms
00033 ; Receives count in W, uses Onems
00034 ;--------------------------------------------------------------
004F 00F1 00035 xms MOVWF TimerX ; Count for X ms
0050 2049 00036 loopX CALL onems ; Delay 1ms
Message[305]: Using default destination of 1 (file).
0051 0BF1 00037 DECFSZ TimerX ; Repeat X times
MPASM 03.70.01 Released AMPS.ASM 3-28-2006 22:26:09 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0052 2850 00038 GOTO loopX ; until Z
0053 0008 00039 RETURN ; and finish
00040
00041 ;--------------------------------------------------------------
00042 ; Generate data/command clock siganl E
00043 ;--------------------------------------------------------------
0054 1508 00044 pulseE BSF PORTD,E ; Set E high
0055 2049 00045 CALL onems ; Delay 1ms
0056 1108 00046 BCF PORTD,E ; Reset E low
0057 2049 00047 CALL onems ; Delay 1ms
0058 0008 00048 RETURN ; done
00049
00050 ;--------------------------------------------------------------
00051 ; Send a command byte in two nibbles from RB4 - RB7
00052 ; Receives command in W, uses PulseE and Onems
00053 ;--------------------------------------------------------------
0059 00F5 00054 send MOVWF OutCod ; Store output code
005A 39F0 00055 ANDLW 0F0 ; Clear low nybble
005B 0088 00056 MOVWF PORTD ; Output high nybble
005C 18F4 00057 BTFSC Select,RS ; Test RS bit
005D 1488 00058 BSF PORTD,RS ; and set for data
005E 2054 00059 CALL pulseE ; and clock display register
005F 2049 00060 CALL onems ; wait 1ms for display
00061
Message[305]: Using default destination of 1 (file).
0060 0EF5 00062 SWAPF OutCod ; Swap low and high nybbles
0061 0875 00063 MOVF OutCod,W ; Retrieve output code
0062 39F0 00064 ANDLW 0F0 ; Clear low nybble
0063 0088 00065 MOVWF PORTD ; Output low nybble
0064 18F4 00066 BTFSC Select,RS ; Test RS bit
0065 1488 00067 BSF PORTD,RS ; and set for data
0066 2054 00068 CALL pulseE ; and clock display register
0067 2049 00069 CALL onems ; wait 1ms for display
0068 0008 00070 RETURN ; done
00071
00072 ;--------------------------------------------------------------
00073 ; Initialise the display
00074 ; Uses Send
00075 ;--------------------------------------------------------------
0069 3064 00076 inid MOVLW D'100' ; Load count for 100ms delay
006A 204F 00077 CALL xms ; and wait for display start
006B 30F0 00078 MOVLW 0F0 ; Mask for select code
006C 00F4 00079 MOVWF Select ; High nybble not masked
00080
006D 3030 00081 MOVLW 0x30 ; Load initial nibble
006E 0088 00082 MOVWF PORTD ; and output it to display
006F 2054 00083 CALL pulseE ; Latch initial code
0070 3005 00084 MOVLW D'5' ; Set delay 5ms
0071 204F 00085 CALL xms ; and wait
0072 2054 00086 CALL pulseE ; Latch initial code again
0073 2049 00087 CALL onems ; Wait 1ms
0074 2054 00088 CALL pulseE ; Latch initial code again
0075 1208 00089 BCF PORTD,4 ; Set 4-bit mode
MPASM 03.70.01 Released AMPS.ASM 3-28-2006 22:26:09 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0076 2054 00090 CALL pulseE ; Latch it
00091
0077 3028 00092 MOVLW 0x28 ; Set 4-bit mode, 2 lines
0078 2059 00093 CALL send ; and send code
0079 3008 00094 MOVLW 0x08 ; Switch off display
007A 2059 00095 CALL send ; and send code
007B 3001 00096 MOVLW 0x01 ; Code to clear display
007C 2059 00097 CALL send ; and send code
007D 3006 00098 MOVLW 0x06 ; Enable cursor auto inc
007E 2059 00099 CALL send ; and send code
007F 3080 00100 MOVLW 0x80 ; Zero display address
0080 2059 00101 CALL send ; and send code
0081 300C 00102 MOVLW 0x0C ; Turn on display
0082 2059 00103 CALL send ; and send code
00104
0083 0008 00105 RETURN ; Done
00106
00107 ;--------------------------------------------------------------
00158 ; Contains routines:
00159 ; init: Initialises display
00160 ; onems: 1 ms delay
00161 ; xms: X ms delay
00162 ; Receives X in W
00163 ; send: sends a character to display
00164 ; Receives: Control code in W (Select,RS=0)
00165 ; ASCII character code in W (RS=1)
00166 ;
00167 ;----------------------------------------------------------
00168 END ; of source code
MPASM 03.70.01 Released AMPS.ASM 3-28-2006 22:26:09 PAGE 7
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
ADbin 00000031
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
CM0 00000000
MPASM 03.70.01 Released AMPS.ASM 3-28-2006 22:26:09 PAGE 8
SYMBOL TABLE
LABEL VALUE
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
FSR 00000004
GCEN 00000007
GIE 00000007
GO 00000002
GO_DONE 00000002
I2C_DATA 00000005
I2C_READ 00000002
I2C_START 00000003
I2C_STOP 00000004
IBF 00000007
IBOV 00000005
INDF 00000000
INTCON 0000000B
INTE 00000004
INTEDG 00000006
INTF 00000001
IRP 00000007
NOT_A 00000005
NOT_ADDRESS 00000005
NOT_BO 00000000
NOT_BOR 00000000
NOT_DONE 00000002
MPASM 03.70.01 Released AMPS.ASM 3-28-2006 22:26:09 PAGE 9
SYMBOL TABLE
LABEL VALUE
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -