📄 main.ls
字号:
776 ; 196 delay_us(1);
778 0144 a601 ld a,#1
779 0146 cd002a call _delay_us
781 ; 198 GPIO_WriteLow(LCDCONT ,LCD162A_E);
783 0149 4b08 push #8
784 014b ae500a ldw x,#20490
785 014e cd0000 call _GPIO_WriteLow
787 0151 84 pop a
788 ; 200 }
791 0152 84 pop a
792 0153 81 ret
831 ; 203 u8 LCD_BUSY(void)
831 ; 204 {
832 switch .text
833 0154 _LCD_BUSY:
835 0154 88 push a
836 00000001 OFST: set 1
839 ; 205 u8 temp=0xff;
841 0155 a6ff ld a,#255
842 0157 6b01 ld (OFST+0,sp),a
843 ; 206 GPIO_Init(PortDATA, (GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7 |GPIO_PIN_0), GPIO_MODE_IN_PU_NO_IT );
845 0159 4b40 push #64
846 015b 4bff push #255
847 015d ae5005 ldw x,#20485
848 0160 cd0000 call _GPIO_Init
850 0163 85 popw x
851 ; 208 GPIO_WriteLow(LCDCONT,LCD162A_RS);
853 0164 4b02 push #2
854 0166 ae500a ldw x,#20490
855 0169 cd0000 call _GPIO_WriteLow
857 016c 84 pop a
858 ; 209 GPIO_WriteHigh(LCDCONT,LCD162A_RW);
860 016d 4b04 push #4
861 016f ae500a ldw x,#20490
862 0172 cd0000 call _GPIO_WriteHigh
864 0175 84 pop a
865 ; 210 GPIO_WriteHigh(LCDCONT,LCD162A_E);
867 0176 4b08 push #8
868 0178 ae500a ldw x,#20490
869 017b cd0000 call _GPIO_WriteHigh
871 017e 84 pop a
872 ; 213 delay_ms(1); //最少需要650um
874 017f ae0001 ldw x,#1
875 0182 cd0000 call _delay_ms
877 ; 214 temp=GPIO_ReadInputData(PortDATA);
879 0185 ae5005 ldw x,#20485
880 0188 cd0000 call _GPIO_ReadInputData
882 018b 6b01 ld (OFST+0,sp),a
883 ; 215 GPIO_WriteLow(LCDCONT,LCD162A_E);
885 018d 4b08 push #8
886 018f ae500a ldw x,#20490
887 0192 cd0000 call _GPIO_WriteLow
889 0195 84 pop a
890 ; 216 GPIO_Init(PortDATA, (GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7 |GPIO_PIN_0), GPIO_MODE_OUT_PP_LOW_FAST );
892 0196 4be0 push #224
893 0198 4bff push #255
894 019a ae5005 ldw x,#20485
895 019d cd0000 call _GPIO_Init
897 01a0 85 popw x
898 ; 217 if(temp&0x80)
900 01a1 7b01 ld a,(OFST+0,sp)
901 01a3 a580 bcp a,#128
902 01a5 2705 jreq L723
903 ; 218 return ( 1);
905 01a7 a601 ld a,#1
908 01a9 5b01 addw sp,#1
909 01ab 81 ret
910 01ac L723:
911 ; 220 return ( 0);
913 01ac 4f clr a
916 01ad 5b01 addw sp,#1
917 01af 81 ret
930 bsct
931 0000 _i:
932 0000 0a dc.b 10
1028 ; 28 void main()
1028 ; 29 {
1029 switch .text
1030 01b0 _main:
1032 01b0 520a subw sp,#10
1033 0000000a OFST: set 10
1036 ; 33 u16 Conversion_Value = 0;
1038 01b2 1e09 ldw x,(OFST-1,sp)
1039 ; 34 u8 *p1="Hello,world.YSU";
1041 01b4 ae0000 ldw x,#L304
1042 01b7 1f09 ldw (OFST-1,sp),x
1043 ; 37 GPIO_Init(GPIOC, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, GPIO_MODE_OUT_PP_LOW_FAST );
1045 01b9 4be0 push #224
1046 01bb 4b0e push #14
1047 01bd ae500a ldw x,#20490
1048 01c0 cd0000 call _GPIO_Init
1050 01c3 85 popw x
1051 ; 39 GPIO_Init(GPIOB, (GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7 |GPIO_PIN_0), GPIO_MODE_OUT_PP_LOW_FAST );
1053 01c4 4be0 push #224
1054 01c6 4bff push #255
1055 01c8 ae5005 ldw x,#20485
1056 01cb cd0000 call _GPIO_Init
1058 01ce 85 popw x
1059 ; 41 ADC1_DeInit();
1061 01cf cd0000 call _ADC1_DeInit
1063 ; 43 ADC1_Init(ADC1_CONVERSIONMODE_CONTINUOUS,ADC1_CHANNEL_9,ADC1_PRESSEL_FCPU_D18,ADC1_EXTTRIG_TIM,DISABLE,ADC1_ALIGN_RIGHT, ADC1_SCHMITTTRIG_CHANNEL9, DISABLE);
1065 01d2 4b00 push #0
1066 01d4 4b09 push #9
1067 01d6 4b08 push #8
1068 01d8 4b00 push #0
1069 01da 4b00 push #0
1070 01dc 4b70 push #112
1071 01de ae0009 ldw x,#9
1072 01e1 a601 ld a,#1
1073 01e3 95 ld xh,a
1074 01e4 cd0000 call _ADC1_Init
1076 01e7 5b06 addw sp,#6
1077 ; 47 ADC1_StartConversion();
1079 01e9 cd0000 call _ADC1_StartConversion
1081 ; 51 lcd162a_Reset();
1083 01ec cd00b2 call _lcd162a_Reset
1085 ; 52 lcd162a_cls();
1087 01ef cd0034 call _lcd162a_cls
1089 ; 53 lcd162a_ePutstr(1,1,p1);
1091 01f2 1e09 ldw x,(OFST-1,sp)
1092 01f4 89 pushw x
1093 01f5 ae0001 ldw x,#1
1094 01f8 a601 ld a,#1
1095 01fa 95 ld xh,a
1096 01fb cd0065 call _lcd162a_ePutstr
1098 01fe 85 popw x
1099 ; 61 delay_ms(2000);//lcd162c中有定义,延迟2s
1101 01ff ae07d0 ldw x,#2000
1102 0202 cd0000 call _delay_ms
1104 ; 62 lcd162a_cls();
1106 0205 cd0034 call _lcd162a_cls
1108 0208 L504:
1109 ; 68 lcd162a_cls();
1111 0208 cd0034 call _lcd162a_cls
1113 ; 69 Conversion_Value=ADC1_GetConversionValue();
1115 020b cd0000 call _ADC1_GetConversionValue
1117 020e 1f09 ldw (OFST-1,sp),x
1118 ; 70 Conversion_Value=(((u32)1024*(u32)10000)/Conversion_Value-10000);
1120 0210 1e09 ldw x,(OFST-1,sp)
1121 0212 cd0000 call c_uitolx
1123 0215 96 ldw x,sp
1124 0216 1c0001 addw x,#OFST-9
1125 0219 cd0000 call c_rtol
1127 021c ae4000 ldw x,#16384
1128 021f bf02 ldw c_lreg+2,x
1129 0221 ae009c ldw x,#156
1130 0224 bf00 ldw c_lreg,x
1131 0226 96 ldw x,sp
1132 0227 1c0001 addw x,#OFST-9
1133 022a cd0000 call c_ludv
1135 022d be02 ldw x,c_lreg+2
1136 022f 1d2710 subw x,#10000
1137 0232 1f09 ldw (OFST-1,sp),x
1138 ; 72 qian=(Conversion_Value/1000);
1140 0234 1e09 ldw x,(OFST-1,sp)
1141 0236 90ae03e8 ldw y,#1000
1142 023a 65 divw x,y
1143 023b 01 rrwa x,a
1144 023c 6b05 ld (OFST-5,sp),a
1145 023e 02 rlwa x,a
1146 ; 73 bai=(Conversion_Value%1000)/100;
1148 023f 1e09 ldw x,(OFST-1,sp)
1149 0241 90ae03e8 ldw y,#1000
1150 0245 65 divw x,y
1151 0246 51 exgw x,y
1152 0247 a664 ld a,#100
1153 0249 62 div x,a
1154 024a 01 rrwa x,a
1155 024b 6b06 ld (OFST-4,sp),a
1156 024d 02 rlwa x,a
1157 ; 74 shi=(Conversion_Value%100)/10;
1159 024e 1e09 ldw x,(OFST-1,sp)
1160 0250 a664 ld a,#100
1161 0252 62 div x,a
1162 0253 5f clrw x
1163 0254 97 ld xl,a
1164 0255 a60a ld a,#10
1165 0257 62 div x,a
1166 0258 01 rrwa x,a
1167 0259 6b07 ld (OFST-3,sp),a
1168 025b 02 rlwa x,a
1169 ; 75 ge=(Conversion_Value%10);
1171 025c 1e09 ldw x,(OFST-1,sp)
1172 025e a60a ld a,#10
1173 0260 62 div x,a
1174 0261 5f clrw x
1175 0262 97 ld xl,a
1176 0263 9f ld a,xl
1177 0264 6b08 ld (OFST-2,sp),a
1178 ; 79 lcd162a_DispOneChar(1,1,qian+48);
1180 0266 7b05 ld a,(OFST-5,sp)
1181 0268 ab30 add a,#48
1182 026a 88 push a
1183 026b ae0001 ldw x,#1
1184 026e a601 ld a,#1
1185 0270 95 ld xh,a
1186 0271 cd0056 call _lcd162a_DispOneChar
1188 0274 84 pop a
1189 ; 80 lcd162a_DispOneChar(1,2,bai+48);
1191 0275 7b06 ld a,(OFST-4,sp)
1192 0277 ab30 add a,#48
1193 0279 88 push a
1194 027a ae0002 ldw x,#2
1195 027d a601 ld a,#1
1196 027f 95 ld xh,a
1197 0280 cd0056 call _lcd162a_DispOneChar
1199 0283 84 pop a
1200 ; 81 lcd162a_DispOneChar(1,3,shi+48);
1202 0284 7b07 ld a,(OFST-3,sp)
1203 0286 ab30 add a,#48
1204 0288 88 push a
1205 0289 ae0003 ldw x,#3
1206 028c a601 ld a,#1
1207 028e 95 ld xh,a
1208 028f cd0056 call _lcd162a_DispOneChar
1210 0292 84 pop a
1211 ; 82 lcd162a_DispOneChar(1,4,ge+48);
1213 0293 7b08 ld a,(OFST-2,sp)
1214 0295 ab30 add a,#48
1215 0297 88 push a
1216 0298 ae0004 ldw x,#4
1217 029b a601 ld a,#1
1218 029d 95 ld xh,a
1219 029e cd0056 call _lcd162a_DispOneChar
1221 02a1 84 pop a
1222 ; 83 lcd162a_DispOneChar(1,5,75);
1224 02a2 4b4b push #75
1225 02a4 ae0005 ldw x,#5
1226 02a7 a601 ld a,#1
1227 02a9 95 ld xh,a
1228 02aa cd0056 call _lcd162a_DispOneChar
1230 02ad 84 pop a
1231 ; 89 delay_ms(500);//lcd162c中有定义
1233 02ae ae01f4 ldw x,#500
1234 02b1 cd0000 call _delay_ms
1237 02b4 ac080208 jpf L504
1279 xdef _main
1280 switch .ubsct
1281 0000 _t:
1282 0000 00000000 ds.b 4
1283 xdef _t
1284 xdef _i
1285 0004 _r:
1286 0004 0000 ds.b 2
1287 xdef _r
1288 xdef _delay_us
1289 xdef _delay_ms
1290 xdef _LCD_BUSY
1291 xdef _lcd162a_ePutstr
1292 xdef _lcd162a_WriteData
1293 xdef _lcd162a_WriteCommand
1294 xdef _lcd162a_LocateXY
1295 xdef _lcd162a_cls
1296 xdef _lcd162a_DispOneChar
1297 xdef _lcd162a_Reset
1298 xref _ADC1_GetConversionValue
1299 xref _ADC1_StartConversion
1300 xref _ADC1_Init
1301 xref _ADC1_DeInit
1302 xref _GPIO_ReadInputData
1303 xref _GPIO_WriteLow
1304 xref _GPIO_WriteHigh
1305 xref _GPIO_Write
1306 xref _GPIO_Init
1307 .const: section .text
1308 0000 L304:
1309 0000 48656c6c6f2c dc.b "Hello,world.YSU",0
1310 xref.b c_lreg
1311 xref.b c_x
1331 xref c_ludv
1332 xref c_rtol
1333 xref c_uitolx
1334 end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -