📄 74as.lst
字号:
MPASM 4.00 Released 74AS.ASM 11-1-2006 9:15:52 PAGE 1
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00001 #include <p16f74.inc>
00001 LIST
00002 ; P16F74.INC Standard Header File, Version 1.00 Microchip Technology, Inc.
00334 LIST
00002 udata 0x0020
0020 00003 input res 1
0021 00004 ctrlword res 1
0022 00005 count res 1 ;计数用
0023 00006 count1 res 1
0024 00007 count2 res 1
0025 00008 w_temp res 1
0026 00009 status_temp res 1
0027 00010 bufferx2 res 1 ;触摸屏数据接收缓冲
0028 00011 bufferx1 res 1
0029 00012 buffery2 res 1
002A 00013 buffery1 res 1
002B 00014 modeaddress res 1 ;视频解码模块寄存器控制
002C 00015 selectaddress res 1
002D 00016 selectvalue res 1
002E 00017 shipinaddress res 1
002F 00018 shipinvalue res 1
0030 00019 tmr0_temp res 1
0031 00020 irvalue res 1
00000078 00021 datax equ 0x78 ;初始控制解码芯片
000000D0 00022 controlx equ 0xd0 ;ADS7846控制字
00000090 00023 controly equ 0x90
00000005 00024 timevalue equ 0x05
00025 #define MODE .32 ;LRS5752控制液晶显示的较好值
00026 #define PICTURE .16
00027 #define COLOR .148
00028 #define TINT .158
00029 #define PHASE .44
00030 #define CONTVIDEO .161
00031 #define CONTRGB1 .0
00032 #define CONTRGB2 .1
00033 #define GAMMA1 .145
00034 #define GAMMA2 .160
00035 #define RGBAMP .89
00036 #define BRIGHT .185
00037 #define SUBBRIGHT_R .139
00038 #define SUBBRIGHT_B .140
00039 #define COM_AMP .132
00040 #define COM_DC .100
00041 #define DACOUT .163
00042 data_tx macro address,value
00043 banksel PORTC;写入LRS5752各寄存器的合适值
00044 bcf PORTC,1
00045 ;writeaddress
00046 movlw address
00047 movwf input
00048 movlw 8
00049 movwf count
00050 movlw 0xff
MPASM 4.00 Released 74AS.ASM 11-1-2006 9:15:52 PAGE 2
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00051 andwf input,1 ;使用GPIO的方法,将RC3作为时钟输入,RC4作为数据输入(并口模拟串口的方法)
00052 btfsc input,0 ;上升沿触发
00053 bsf PORTC,4
00054 bcf PORTC,4
00055 bcf PORTC,3
00056 nop
00057 bsf PORTC,3
00058 nop
00059 rrf input,1
00060 decfsz count,1
00061 goto $-.11
00062 ;writevalue
00063 movlw value
00064 movwf input
00065 movlw 8
00066 movwf count
00067 movlw 0xff
00068 andwf input,1
00069 btfsc input,0
00070 bsf PORTC,4
00071 bcf PORTC,4
00072 bcf PORTC,3
00073 nop
00074 bsf PORTC,3
00075 nop
00076 rrf input,1
00077 decfsz count,1
00078 goto $-.11
00079 bsf PORTC,1
00080 endm
00081
00082 data_select macro ;按键选择,输入选择寄存器和相应的值
00083 banksel PORTC
00084 bcf PORTC,1
00085 ;writeaddress
00086 movf shipinaddress,w
00087 movwf input
00088 movlw 8
00089 movwf count
00090 movlw 0xff
00091 andwf input,1
00092 btfsc input,0
00093 bsf PORTC,4
00094 bcf PORTC,4
00095 bcf PORTC,3
00096 nop
00097 bsf PORTC,3
00098 nop
00099 rrf input,1
00100 decfsz count,1
00101 goto $-.11
00102 ;writevalue
00103 movf shipinvalue,w
MPASM 4.00 Released 74AS.ASM 11-1-2006 9:15:52 PAGE 3
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00104 movwf input
00105 movlw 8
00106 movwf count
00107 movlw 0xff
00108 andwf input,1
00109 btfsc input,0
00110 bsf PORTC,4
00111 bcf PORTC,4
00112 bcf PORTC,3
00113 nop
00114 bsf PORTC,3
00115 nop
00116 rrf input,1
00117 decfsz count,1
00118 goto $-.11
00119 bsf PORTC,1
00120 endm
00121
00122 push macro
00123 movwf w_temp
00124 movf STATUS,w
00125 movwf status_temp
00126 endm
00127
00128 pop macro
00129 movf status_temp,w
00130 movwf STATUS
00131 swapf w_temp,f
00132 swapf w_temp,w
00133 endm
00134
00135 gettouchvalue macro controlvalue,storeone,storetwo
00136 movlw controlvalue
00137 movwf ctrlword
00138 movlw 8
00139 movwf count
00140 ;LOOP1 ;input controlword
00141 movlw 0xff
00142 andwf ctrlword,1 ;同样用GPIO的方法进行ADS7846控制字的写入
00143 btfsc ctrlword,7 ;得到触摸屏的x值和y值,特别要注意时序问题
00144 bsf PORTC,4
00145 bcf PORTC,4
00146 bcf PORTC,3
00147 nop
00148 bsf PORTC,3 ;上升沿触发
00149 nop
00150 rlf input,1
00151 decfsz count,1
00152 goto $-.11
00153 clrf storetwo
00154 banksel TRISC
00155 bsf TRISC,5
00156 ;wait
MPASM 4.00 Released 74AS.ASM 11-1-2006 9:15:52 PAGE 4
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
00157 banksel PORTB
00158 btfsc PORTB,1
00159 goto $-.1
00160 movlw 4
00161 movwf count
00162 ;coutinue1
00163 rlf storetwo,1
00164 bsf PORTC,3
00165 nop
00166 bcf PORTC,3 ;下降沿触发
00167 nop
00168 btfsc PORTC,5
00169 incf storetwo,1
00170 decfsz count,1
00171 goto $-.8
00172 movlw 8
00173 movwf count
00174 ;coutinue2
00175 rlf storeone,1
00176 bsf PORTC,3
00177 nop
00178 bcf PORTC,3
00179 nop
00180 btfsc PORTC,5
00181 incf storeone,1
00182 decfsz count,1
00183 goto $-.8
00184 endm
00185
00186 RST code 0x00
0000 0000 00187 nop
0001 018A 00188 clrf PCLATH
00189 ;pagesel start
0002 2??? 00190 goto start
0003 0000 00191 nop
0004 2??? 00192 goto ISR
00193 PGM code
0000 00194 start
0000 1683 1303 00195 banksel TRISC ;初始化,配置一些寄存器
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0002 0187 00196 clrf TRISC
0003 1283 1303 00197 banksel SSPCON
0005 1294 00198 bcf SSPCON,SSPEN
0006 1283 1303 00199 banksel T1CON
0008 1010 00200 bcf T1CON,TMR1ON
0009 1283 1303 00201 banksel TMR0
000B 3005 00202 movlw timevalue
000C 0081 00203 movwf TMR0
000D 1283 1303 00204 banksel INTCON
000F 018B 00205 clrf INTCON
0010 178B 00206 bsf INTCON,GIE
0011 108B 00207 bcf INTCON,INTF
0012 110B 00208 bcf INTCON,T0IF
MPASM 4.00 Released 74AS.ASM 11-1-2006 9:15:52 PAGE 5
LOC OBJECT CODE LINE SOURCE TEXT
VALUE
0013 100B 00209 bcf INTCON,RBIF
0014 160B 00210 bsf INTCON,INTE ;允许INT中断
0015 168B 00211 bsf INTCON,T0IE ;允许TIMER0中断
0016 158B 00212 bsf INTCON,RBIE ;允许RB中断
0017 1683 1303 00213 banksel OPTION_REG
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0019 0181 00214 clrf OPTION_REG
001A 1683 1303 00215 banksel TRISB
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
001C 1106 00216 bcf TRISB,2
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
001D 1186 00217 bcf TRISB,3
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
001E 1486 00218 bsf TRISB,1
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
001F 1786 00219 bsf TRISB,7
0020 1283 1303 00220 banksel PORTB
0022 1506 00221 bsf PORTB,2
0023 1186 00222 bcf PORTB,3
0024 1683 1303 00223 banksel TRISA
0026 30FF 00224 movlw 0xff
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
0027 0085 00225 movwf TRISA
0028 1683 1303 00226 banksel TRISD
Message[302]: Register in operand not in bank 0. Ensure that bank bits are correct.
002A 1088 00227 bcf TRISD,1
002B 1283 1303 00228 banksel PORTC
002D 1487 00229 bsf PORTC,1
002E 1407 00230 bsf PORTC,0
002F 1283 1303 00231 banksel PORTD
0031 1488 00232 bsf PORTD,1
0032 3078 00233 movlw datax ;对LRS5752进行初始化 datax=0x78
0033 00?? 00234 movwf input
0034 3008 00235 movlw 8
0035 00?? 00236 movwf count
0036 00237 LOOP ;初始化解码芯片
0036 30FF 00238 movlw 0xff
0037 05?? 00239 andwf input,1
0038 1800 00240 btfsc input,0
0039 1607 00241 bsf PORTC,4
003A 1207 00242 bcf PORTC,4
003B 1187 00243 bcf PORTC,3
003C 0000 00244 nop
003D 1587 00245 bsf PORTC,3
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -