📄 lm032l8.lst
字号:
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
0001 LIST P=16C64, F=INHX8M
0002 ;
0003 ; This program interfaces to a Hitachi (LM032L) 2 line by 20 character display
0004 ; module. The program assembles for either 4-bit or 8-bit data interface, depending
0005 ; on the value of the 4bit flag. LCD_DATA is the port which supplies the data to
0006 ; the LM032L, while LCD_CNTL is the port that has the control lines ( E, RS, R_W ).
0007 ; In 4-bit mode the data is transfer on the high nibble of the port ( PORT<7:4> ).
0008 ;
0009 ; Program = LM032L.ASM
0010 ; Revision Date: 5-10-94
0011 ;
0012 ;
0013 include <C74_reg.h>
0233
0013
0014 include <lm032l.h>
0014
0015 ;
0000 0016 Four_bit EQU FALSE ; Selects 4- or 8-bit data transfers
0001 0017 Data_HI EQU TRUE ; If 4-bit transfers, Hi or Low nibble of PORT
0018 ;
0019 ;
0020 if ( Four_bit && !Data_HI )
0021 ;
0022 LCD_DATA EQU PORTB
0023 LCD_DATA_TRIS EQU TRISB
0024 ;
0025 else
0026 ;
0008 0027 LCD_DATA EQU PORTD
0088 0028 LCD_DATA_TRIS EQU TRISD
0029 ;
0030 endif
0031 ;
0005 0032 LCD_CNTL EQU PORTA
0033 ;
0034 ;
0035 ;
0036 ; LCD Display Commands and Control Signal names.
0037 ;
0038 if ( Four_bit && !Data_HI )
0039 ;
0040 E EQU 0 ; LCD Enable control line
0041 R_W EQU 1 ; LCD Read/Write control line
0042 RS EQU 2 ; LCD Register Select control line
0043 ;
0044 else
0045 ;
0003 0046 E EQU 3 ; LCD Enable control line
0002 0047 R_W EQU 2 ; LCD Read/Write control line
0001 0048 RS EQU 1 ; LCD Register Select control line
0049 ;
0050 endif
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
0051 ;
0052 ;
0030 0053 TEMP1 EQU 0x030
0054 ;
0055 org RESET_V ; RESET vector location
0000 2808 0056 RESET GOTO START ;
0057 ;
0058 ; This is the Periperal Interrupt routine. Should NOT get here
0059 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
0061 org ISR_V ; Interrupt vector location
0062 PER_INT_V
0004 1283 0063 ERROR1 BCF STATUS, RP0 ; Bank 0
0005 1407 0064 BSF PORTC, 0
0006 1007 0065 BCF PORTC, 0
0007 2804 0066 GOTO ERROR1
0067 ;
0068 ;
0069 ;
0070 START ; POWER_ON Reset (Beginning of program)
0008 0183 0071 CLRF STATUS ; Do initialization (Bank 0)
0009 018B 0072 CLRF INTCON
000A 018C 0073 CLRF PIR1
000B 1683 0074 BSF STATUS, RP0 ; Bank 1
000C 3000 0075 MOVLW 0x00 ; The LCD module does not like to work w/ weak pull-ups
Warning: Argument out of range OPTION_R (0081). Least significant bits used.
000D 0081 0076 MOVWF OPTION_R ;
Warning: Argument out of range PIE1 (008C). Least significant bits used.
000E 018C 0077 CLRF PIE1 ; Disable all peripheral interrupts
000F 30FF 0078 MOVLW 0xFF ;
Warning: Argument out of range ADCON1 (009F). Least significant bits used.
0010 009F 0079 MOVWF ADCON1 ; Port A is Digital.
0080 ;
0081 ;
0011 1283 0082 BCF STATUS, RP0 ; Bank 0
0012 0185 0083 CLRF PORTA ; ALL PORT output should output Low.
0013 0186 0084 CLRF PORTB
0014 0187 0085 CLRF PORTC
0015 0188 0086 CLRF PORTD
0016 0189 0087 CLRF PORTE
0017 1010 0088 BCF T1CON, TMR1ON ; Timer 1 is NOT incrementing
0089 ;
0018 1683 0090 BSF STATUS, RP0 ; Select Bank 1
Warning: Argument out of range TRISA (0085). Least significant bits used.
0019 0185 0091 CLRF TRISA ; RA5 - 0 outputs
001A 30F0 0092 MOVLW 0xF0 ;
Warning: Argument out of range TRISB (0086). Least significant bits used.
001B 0086 0093 MOVWF TRISB ; RB7 - 4 inputs, RB3 - 0 outputs
Warning: Argument out of range TRISC (0087). Least significant bits used.
001C 0187 0094 CLRF TRISC ; RC Port are outputs
Warning: Argument out of range TRISC (0087). Least significant bits used.
001D 1407 0095 BSF TRISC, T1OSO ; RC0 needs to be input for the oscillator to function
Warning: Argument out of range TRISD (0088). Least significant bits used.
001E 0188 0096 CLRF TRISD ; RD Port are outputs
Warning: Argument out of range TRISE (0089). Least significant bits used.
001F 0189 0097 CLRF TRISE ; RE Port are outputs
Warning: Argument out of range PIE1 (008C). Least significant bits used.
0020 140C 0098 BSF PIE1, TMR1IE ; Enable TMR1 Interrupt
Warning: Argument out of range OPTION_R (0081). Least significant bits used.
0021 1781 0099 BSF OPTION_R, RBPU ; Disable PORTB pull-ups
0022 1283 0100 BCF STATUS, RP0 ; Select Bank 0
0101 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
0103 ;
0104 ; Initilize the LCD Display Module
0105 ;
0023 0185 0106 CLRF LCD_CNTL ; ALL PORT output should output Low.
0107
0108 DISPLAY_INIT
0109 if ( Four_bit && !Data_HI )
0110 MOVLW 0x02 ; Command for 4-bit interface low nibble
0111 endif
0112 ;
0113 if ( Four_bit && Data_HI )
0114 MOVLW 0x020 ; Command for 4-bit interface high nibble
0115 endif
0116 ;
0117 if ( !Four_bit )
0024 3038 0118 MOVLW 0x038 ; Command for 8-bit interface
0119 endif
0120 ;
0025 0088 0121 MOVWF LCD_DATA ;
0026 1585 0122 BSF LCD_CNTL, E ;
0027 1185 0123 BCF LCD_CNTL, E ;
0124 ;
0125 ; This routine takes the calculated times that the delay loop needs to
0126 ; be executed, based on the LCD_INIT_DELAY EQUate that includes the
0127 ; frequency of operation. These uses registers before they are needed to
0128 ; store the time.
0129 ;
0028 3006 0130 LCD_DELAY MOVLW LCD_INIT_DELAY ;
0029 00B3 0131 MOVWF MSD ; Use MSD and LSD Registers to Initilize LCD
002A 01B4 0132 CLRF LSD ;
002B 0BB4 0133 LOOP2 DECFSZ LSD ; Delay time = MSD * ((3 * 256) + 3) * Tcy
002C 282B 0134 GOTO LOOP2 ;
002D 0BB3 0135 DECFSZ MSD ;
0136 END_LCD_DELAY
002E 282B 0137 GOTO LOOP2 ;
0138 ;
0139 ; Command sequence for 2 lines of 5x7 characters
0140 ;
0141 CMD_SEQ
0142 ;
0143 if ( Four_bit )
0144 if ( !Data_HI )
0145 MOVLW 0X02 ; 4-bit low nibble xfer
0146 else
0147 MOVLW 0X020 ; 4-bit high nibble xfer
0148 endif
0149 ;
0150 else ; 8-bit mode
002F 3038 0151 MOVLW 0X038
0152 endif
0153 ;
0030 0088 0154 MOVWF LCD_DATA ; This code for both 4-bit and 8-bit modes
0031 1585 0155 BSF LCD_CNTL, E ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
0032 1185 0156 BCF LCD_CNTL, E ;
0157 ;
0158 if ( Four_bit ) ; This code for only 4-bit mode (2nd xfer)
0159 if ( !Data_HI )
0160 MOVLW 0x08 ; 4-bit low nibble xfer
0161 else
0162 MOVLW 0x080 ; 4-bit high nibble xfer
0163 endif
0164 MOVWF LCD_DATA ;
0165 BSF LCD_CNTL, E ;
0166 BCF LCD_CNTL, E ;
0167 endif
0168 ;
0169 ; Busy Flag should be valid after this point
0170 ;
0033 300C 0171 MOVLW DISP_ON ;
0034 206A 0172 CALL SEND_CMD ;
0035 3001 0173 MOVLW CLR_DISP ;
0036 206A 0174 CALL SEND_CMD ;
0037 3006 0175 MOVLW ENTRY_INC ;
0038 206A 0176 CALL SEND_CMD ;
0039 3080 0177 MOVLW DD_RAM_ADDR ;
003A 206A 0178 CALL SEND_CMD ;
0179 ;
MPASM 00.00.68 Intermediate LM032L.ASM 6-8-1994 0:53:47 PAGE 6
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -