📄 lm032l.lst
字号:
M else
88B8 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
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 6
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M
M if (cycles > ((255*3)+5))
M
0007 302D M movlw ((cycles-5)/(256*3+6))
0008 2??? M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
0009 0064 00063 clrwdt
00064 ;clear LCD port to all low here!!!!!!!!!!!!!!!
000A 3031 00065 movlw b'00110001' ; Command for 8-bit interface high nibble vv-B.0=1
000B 0086 00066 movwf LCD_DATA ; ie 0011xxxx
000C 1486 00067 bsf LCD_E
000D 0000 00068 nop ;incase the clk is >8MHz
00069 ;nop ;incase the clk is >16MHz
000E 1086 00070 bcf LCD_E
00071 ;have to wait 4.1ms here
00072 Wait 4100 Microsec, 0
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
1004 M variable cycles = ((4100 * D'1000') / 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
1004 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
000F 3005 M movlw ((cycles-5)/(256*3+6))
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 7
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0010 2??? M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
0011 1486 00073 bsf LCD_E ;nibble is already setup
0012 0000 00074 nop ;incase the clk is >8MHz
00075 ;nop ;incase the clk is >16MHz
0013 1086 00076 bcf LCD_E
00077 ;have to wait 100us here
00078 Wait 100 Microsec, 0
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
0064 M variable cycles = ((100 * D'1000') / 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
0064 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
M movlw ((cycles-5)/(256*3+6))
M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
M endif
M
M exitm
M endif
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 8
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M
M if ((cycles > 8 ) && (cycles < (255*3 + 5)))
M
0014 301F M movlw ((cycles-5)/3)
0015 2??? M call shortdelay
M
M ifndef INCSHORTDELAY
M #define INCSHORTDELAY
M endif
M
M exitm
0016 1486 00079 bsf LCD_E ;nibble is already setup
0017 0000 00080 nop ;incase the clk is >8MHz
00081 ;nop ;incase the clk is >16MHz
0018 1086 00082 bcf LCD_E
00083 ;have to wait 100us here
00084 Wait 100 Microsec, 0
M radix dec
03E8 M variable instruct_time_ns = (( 1 Seconds ) / (Clock_Freq / 4 ))
0000 M local cycles
0064 M variable cycles = ((100 * D'1000') / 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
0064 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
M movlw ((cycles-5)/(256*3+6))
M call longdelay
M
M ifndef INCLONGDELAY
M #define INCLONGDELAY
MPASM 03.80 Released LM032L.ASM 11-20-2005 18:21:09 PAGE 9
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
M endif
M
M exitm
M endif
M
M if ((cycles > 8 ) && (cycles < (255*3 + 5)))
M
0019 301F M movlw ((cycles-5)/3)
001A 2??? M call shortdelay
M
M ifndef INCSHORTDELAY
M #define INCSHORTDELAY
M endif
M
M exitm
001B 3021 00085 movlw b'00100001' ; Command for 4-bit interface high nibble vv-B.0=1
001C 0086 00086 movwf LCD_DATA ; ie 0010xxxx
001D 1486 00087 bsf LCD_E
001E 0000 00088 nop ;incase the clk is >8MHz
00089 ;nop ;incase the clk is >16MHz
001F 1086 00090 bcf LCD_E
0020 0064 00091 clrwdt
00092 ;from here interface is 4 bit and busy can be checked
00093 ; 001DL NF**
0021 3028 00094 movlw FUNC_SET ;has to be 0010 10XX
0022 2??? 00095 call SEND_CMD_W
00096 ;0000 1DCB
0023 3008 00097 movlw DISP_OFF ;0000 1000
0024 2??? 00098 call SEND_CMD_W
00099
00100 ;****************************
00101 ;* *
00102 ;* INITIALIZE DISPLAY *
00103 ;* *
00104 ;****************************
0025 00105 INIT_DISPLAY
0025 300C 00106 movlw DISP_ON ; Display On, Cursor On
0026 2??? 00107 call SEND_CMD_W
00108
0027 3001 00109 movlw CLR_DISP ; Clear the Display
0028 2??? 00110 call SEND_CMD_W
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -