📄 lm032l.lst
字号:
00111 Wait 2 Millisec, 0
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
07D0 M variable cycles = ((2 * D'1000000') / instruct_time_ns) ;required delay in
M ;100ths of instructions
M
M if (cycles < (0) )
M messg NOTE - negative delay time with 0 cycles (no code)
M
M exitm
M else
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 10
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
07D0 M variable cycles = (cycles - (0))
M endif
M
M if (cycles == 0)
M messg "WARNING - delay time less than 1 instructions"
M
M nop
M exitm
M endif
M
M if (cycles > (255*(256*3 + 6) + 2 + 3))
M messg "ERROR : Too long a wait for the WAIT macro at present!!"
M exitm
M endif
M
M ; messg Info - calculated number of cycles = #v(cycles)
M
M
M if (cycles > ((255*3)+5))
M
0029 3002 M movlw ((cycles-5)/(256*3+6))
002A 2??? M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
00112 ;0000 01IS
002B 3006 00113 movlw ENTRY_INC ;0000 0110
002C 2??? 00114 call SEND_CMD_W
00115
002D 0008 00116 return
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 11
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00117 page
00118 ;*******************************************************************
00119 ;* The LCD Module Subroutines *
00120 ;*******************************************************************
00121 ;
00122 ;*******************************************************************
00123 ;*SendChar - Sends character to LCD *
00124 ;*This routine splits the character into the upper and lower *
00125 ;*nibbles and sends them to the LCD, upper nibble first. *
00126 ;*******************************************************************
00127 ;
002E 00128 SEND_CHAR_W
002E 00?? 00129 movwf CHARBUF ;Character to be sent is in W so put in
00130 ;local CHARBUF
002F 00131 SEND_CHAR
002F 2??? 00132 call BUSY_CHECK ;Wait for LCD to be ready
0030 08?? 00133 movf CHARBUF, W
0031 39F0 00134 andlw 0x0F0 ;Get upper nibble into upper half port
0032 3801 00135 iorlw 0x01 ;vv-LED off
00136
0033 0086 00137 movwf LCD_DATA ;Send data to LCD
00138 ;bcf LCD_R_W ;Set LCD to read
0034 1586 00139 bsf LCD_RS ;Set LCD to data mode
0035 2??? 00140 call LCDtglclk ;saving space - sod readability thou
00141 ;bsf LCD_E ;toggle E for LCD
00142 ;nop ;incase the clk is >8MHz
00143 ;;nop ;incase the clk is >16MHz
00144 ;bcf LCD_E
0036 0E?? 00145 swapf CHARBUF, w
0037 39F0 00146 andlw 0x0F0 ;Get lower nibble into upper half port
0038 3801 00147 iorlw 0x01 ;vv-LED off
00148
0039 0086 00149 movwf LCD_DATA ;Send data to LCD
003A 1586 00150 bsf LCD_RS ;Set LCD to data mode
003B 1486 00151 LCDtglclk bsf LCD_E ;toggle E for LCD
003C 0000 00152 nop ;incase the clk is >8MHz
00153 ;nop ;incase the clk is >16MHz
003D 1086 00154 bcf LCD_E
003E 0008 00155 return
00156
00157 ;*******************************************************************
00158 ;* SEND_CMD - Sends command to LCD *
00159 ;* This routine splits the command into the upper and lower *
00160 ;* nibbles and sends them to the LCD, upper nibble first. *
00161 ;*******************************************************************
00162
003F 00163 SEND_CMD_W
003F 00?? 00164 movwf CHARBUF ; Character to be sent is in W so put in
00165 ;local CHARBUF
0040 00166 SEND_CMD
0040 2??? 00167 call BUSY_CHECK ; Wait for LCD to be ready
0041 08?? 00168 movf CHARBUF, W
0042 39F0 00169 andlw 0x0F0 ; Get upper nibble into lower half port
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 12
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0043 3801 00170 iorlw 0x01 ;vv-LED off
00171
0044 0086 00172 movwf LCD_DATA ; Send data to LCD
00173 ;bcf LCD_R_W ; Set LCD to read
00174 ;bcf LCD_RS ; Set LCD to command mode
0045 2??? 00175 call LCDtglclk ;saving space - sod readability thou
00176 ;bsf LCD_E ; toggle E for LCD
00177 ;nop ;incase the clk is >8MHz
00178 ;;nop ;incase the clk is >16MHz
00179 ;bcf LCD_E
0046 0E?? 00180 swapf CHARBUF,w
0047 39F0 00181 andlw 0x0F0 ; Get lower nibble into lower half port
0048 3801 00182 iorlw 0x01 ;vv-LED off
00183
0049 0086 00184 movwf LCD_DATA ; Send data to LCD
004A 2??? 00185 goto LCDtglclk ;saving space - sod readability thou
00186 ;bsf LCD_E ; toggle E for LCD
00187 ;nop ;incase the clk is >8MHz
00188 ;;nop ;incase the clk is >16MHz
00189 ;bcf LCD_E
00190 ;return
00191
00192 ;*******************************************************************
00193 ;* This routine checks the busy flag, returns when not busy *
00194 ;*******************************************************************
00195 ;
004B 00196 BUSY_CHECK
004B 1683 00197 bsf STATUS, RP0 ; Select Register page 1
004C 30F0 00198 movlw 0xF0 ; st 0xF1 Set high nibble + keep INT for input
004D 0086 00199 movwf LCD_DATA_TRIS
004E 1283 00200 bcf STATUS, RP0 ; Select Register page 0
004F 1186 00201 bcf LCD_RS ; Set LCD for Command mode
0050 1506 00202 bsf LCD_R_W ; Setup to read busy flag
0051 1486 00203 bsf LCD_E ; Set E high
0052 0000 00204 nop ;incase the clk is >8MHz
00205 ;nop ;incase the clk is >16MHz
0053 0806 00206 movf LCD_DATA, W ; Read upper nibble busy flag, DDRam address
0054 1086 00207 bcf LCD_E ; Set E low
00208 ;andlw 0x0F0 ; Mask out lower nibble ***chng 1/10/96
0055 3980 00209 andlw 0x80 ; Mask out lower nibble ***chng 1/10/96
00210 ;movwf TEMP
0056 0000 00211 nop
0057 1486 00212 bsf LCD_E ; Toggle E to get lower nibble
0058 0000 00213 nop
0059 0000 00214 nop ;incase the clk is >8MHz
00215 ;nop ;incase the clk is >16MHz
00216 ;swapF LCD_DATA, W ; Read lower nibble DDRam address
005A 1086 00217 bcf LCD_E
00218 ;andlw 0x0F ; Mask out upper nibble
00219 ;iorwf TEMP, F ; Combine nibbles
005B 3A80 00220 xorlw 0x80
005C 1903 00221 btfsc STATUS, Z
00222 ;btfsc TEMP, 7 ; Check busy flag, high = busy
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 13
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
005D 2??? 00223 goto BUSY_CHECK ; If busy, check again
005E 1106 00224 bcf LCD_R_W
005F 1683 00225 bsf STATUS, RP0 ; Select Register page 1
0060 3000 00226 movlw b'00000000'
0061 0086 00227 movwf LCD_DATA_TRIS ; Set for output
0062 1283 00228 bcf STATUS, RP0 ; Select Register page 0
0063 0008 00229 return
00230
0064 00231 LOAD_CGRAM
00232 ; load user defined characters
0064 3040 00233 movlw 0x40
0065 2??? 00234 call SEND_CMD_W
00235 ; start address passed in temp_lo (reuse temp_lo memory)
00236 ; running address in temp_hi (reuse temp_hi memory)
00237 ; loop counter in acc_hi (reuse acc_hi memory)
0066 00238 LOAD_CGRAM_LOC
0066 01?? 00239 clrf temp_hi
0067 08?? 00240 movf temp_lo, W
0068 07?? 00241 addwf temp_hi, F
0069 3008 00242 movlw 0x08
006A 00?? 00243 movwf acc_hi
00244
006B 00245 load
006B 08?? 00246 movf temp_hi, W
006C 2??? 00247 call uchars
006D 2??? 00248 call SEND_CHAR_W
006E 0A?? 00249 incf temp_hi, F
006F 0B?? 00250 decfsz acc_hi, F
0070 2??? 00251 goto load
0071 0008 00252 return
00253
00254 end
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 14
SYMBOL TABLE
LABEL VALUE
ADEN 00000003
BRGH 00000002
BUSY_CHECK 0000004B
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
CCPR1H 00000016
CCPR1L 00000015
CHARBUF 00000027
CIS 00000003
CLR_DISP 00000001
CM0 00000000
CM1 00000001
CM2 00000002
CMCON 0000001F
CMIE 00000006
CMIF 00000006
CREN 00000004
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -