📄 almset1.lst
字号:
1034 4 {flag_section_6_set_alarm = FALSE;
1035 5 count_bell = 100/TIME_TIMER0;
1036 5 count_sound = 1;
1037 5 }else
1038 4 if(section_number==7)
1039 4 {flag_section_7_set_alarm = FALSE;
1040 5 count_bell = 100/TIME_TIMER0;
1041 5 count_sound = 1;
1042 5 }else
1043 4 if(section_number==8)
1044 4 {flag_section_8_set_alarm = FALSE;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 18
1045 5 count_bell = 100/TIME_TIMER0;
1046 5 count_sound = 1;
1047 5 }
1048 4 section_number = 0;
1049 4 }
1050 3 }
1051 2 rc_open_count = 0;
1052 2 }
1053 1 ///////////////
1054 1 count_green_led_flash --;
1055 1 if(!count_green_led_flash)
1056 1 {change_green_led;
1057 2 if(flag_reporting_alarm)
1058 2 {count_green_led_flash = 100/TIME_TIMER0;
1059 3 }else
1060 2 if((!(flag_serial_number_valid&&flag_phone_1_number_valid))
1061 2 ||flag_mb_ring_occur||flag_mbphone_wrong)
1062 2 {count_green_led_flash = 20/TIME_TIMER0;
1063 3 }
1064 2 else
1065 2 {count_green_led_flash = 1000/TIME_TIMER0;
1066 3 }
1067 2 }
1068 1 count_red_led_flash --;
1069 1 if(!count_red_led_flash)
1070 1 {if(flag_urgent_alarm_occur)
1071 2 {if(!bit_red_led)
1072 3 {turn_off_red_led;
1073 4 count_red_led_flash = 50/TIME_TIMER0;
1074 4 }
1075 3 else
1076 3 {turn_on_red_led;
1077 4 count_red_led_flash = 50/TIME_TIMER0;
1078 4 }
1079 3 }else
1080 2 if(flag_section_1_set_alarm&&flag_section_2_set_alarm
1081 2 &&flag_section_3_set_alarm&&flag_section_4_set_alarm
1082 2 &&flag_section_5_set_alarm&&flag_section_6_set_alarm
1083 2 &&flag_section_7_set_alarm&&flag_section_8_set_alarm)
1084 2 {if(!bit_red_led)
1085 3 {turn_off_red_led;
1086 4 count_red_led_flash = 200/TIME_TIMER0;
1087 4 }
1088 3 else
1089 3 {turn_on_red_led;
1090 4 count_red_led_flash = 1000/TIME_TIMER0;
1091 4 }
1092 3 }else
1093 2 if(!(flag_section_1_set_alarm||flag_section_2_set_alarm
1094 2 ||flag_section_3_set_alarm||flag_section_4_set_alarm
1095 2 ||flag_section_5_set_alarm||flag_section_6_set_alarm
1096 2 ||flag_section_7_set_alarm||flag_section_8_set_alarm))
1097 2 {change_red_led;
1098 3 count_red_led_flash = 1000/TIME_TIMER0;
1099 3 }else
1100 2 {if(!bit_red_led)
1101 3 {turn_off_red_led;
1102 4 count_red_led_flash = 200/TIME_TIMER0;
1103 4 }
1104 3 else
1105 3 {if(count_led_pulse)
1106 4 {count_led_pulse --;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 19
1107 5 turn_on_red_led;
1108 5 if(flag_section_1_set_alarm||flag_section_2_set_alarm
1109 5 ||flag_section_3_set_alarm||flag_section_4_set_alarm
1110 5 ||flag_section_5_set_alarm||flag_section_6_set_alarm
1111 5 ||flag_section_7_set_alarm||flag_section_8_set_alarm)
1112 5 {count_red_led_flash = 200/TIME_TIMER0;
1113 6 }
1114 5 else
1115 5 {count_red_led_flash = 1000/TIME_TIMER0;
1116 6 }
1117 5 }
1118 4 else
1119 4 {count_red_led_flash = 10/TIME_TIMER0;
1120 5 stage_led_flash ++;
1121 5 if(stage_led_flash>8)
1122 5 {stage_led_flash = 1;
1123 6 }
1124 5 if((stage_led_flash==1)&&flag_section_1_set_alarm)
1125 5 {count_led_pulse = 1;
1126 6 count_red_led_flash = 500/TIME_TIMER0;
1127 6 }
1128 5 else if((stage_led_flash==2)&&flag_section_2_set_alarm)
1129 5 {count_led_pulse = 2;
1130 6 count_red_led_flash = 500/TIME_TIMER0;
1131 6 }
1132 5 else if((stage_led_flash==3)&&flag_section_3_set_alarm)
1133 5 {count_led_pulse = 3;
1134 6 count_red_led_flash = 500/TIME_TIMER0;
1135 6 }
1136 5 else if((stage_led_flash==4)&&flag_section_4_set_alarm)
1137 5 {count_led_pulse = 4;
1138 6 count_red_led_flash = 500/TIME_TIMER0;
1139 6 }
1140 5 else if((stage_led_flash==5)&&flag_section_5_set_alarm)
1141 5 {count_led_pulse = 5;
1142 6 count_red_led_flash = 500/TIME_TIMER0;
1143 6 }
1144 5 else if((stage_led_flash==6)&&flag_section_6_set_alarm)
1145 5 {count_led_pulse = 6;
1146 6 count_red_led_flash = 500/TIME_TIMER0;
1147 6 }
1148 5 else if((stage_led_flash==7)&&flag_section_7_set_alarm)
1149 5 {count_led_pulse = 7;
1150 6 count_red_led_flash = 500/TIME_TIMER0;
1151 6 }
1152 5 else if((stage_led_flash==8)&&flag_section_8_set_alarm)
1153 5 {count_led_pulse = 8;
1154 6 count_red_led_flash = 500/TIME_TIMER0;
1155 6 }
1156 5 }
1157 4 }
1158 3 }
1159 2 }
1160 1 }
1161
1162 static uchar receive_dtmf_byte()
1163 {uchar k;
1164 1 k = 0x55;
1165 1 bit_dtmf_dv = HIGH;
1166 1 bit_dtmf_d0 = HIGH;
1167 1 bit_dtmf_d1 = HIGH;
1168 1 bit_dtmf_d2 = HIGH;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 20
1169 1 bit_dtmf_d3 = HIGH;
1170 1 bit_dtmf_oei = LOW;
1171 1 if(bit_dtmf_dv)
1172 1 {delay_milliseconds(1);
1173 2 if(bit_dtmf_dv)
1174 2 {bit_dtmf_oei = HIGH;
1175 3 k = 0;
1176 3 if(bit_dtmf_d0)
1177 3 {k = 1;
1178 4 }
1179 3 if(bit_dtmf_d1)
1180 3 {k += 2;
1181 4 }
1182 3 if(bit_dtmf_d2)
1183 3 {k += 4;
1184 4 }
1185 3 if(bit_dtmf_d3)
1186 3 {k += 8;
1187 4 }
1188 3 bit_dtmf_oei = LOW;
1189 3 }
1190 2 while(bit_dtmf_dv) ;
1191 2 delay_milliseconds(200);
1192 2 while(bit_dtmf_dv) ;
1193 2 }
1194 1 return(k);
1195 1 }
1196
1197 static void store_rc_inst()
1198 {uchar data * pt;
1199 1 pt = number;
1200 1 if(flag_section_1_set_alarm) number[0] = 0xaa;
1201 1 else number[0] = 0x55;
1202 1 if(flag_section_2_set_alarm) number[1] = 0xaa;
1203 1 else number[1] = 0x55;
1204 1 if(flag_section_3_set_alarm) number[2] = 0xaa;
1205 1 else number[2] = 0x55;
1206 1 if(flag_section_4_set_alarm) number[3] = 0xaa;
1207 1 else number[3] = 0x55;
1208 1 if(flag_section_5_set_alarm) number[4] = 0xaa;
1209 1 else number[4] = 0x55;
1210 1 if(flag_section_6_set_alarm) number[5] = 0xaa;
1211 1 else number[5] = 0x55;
1212 1 if(flag_section_7_set_alarm) number[6] = 0xaa;
1213 1 else number[6] = 0x55;
1214 1 if(flag_section_8_set_alarm) number[7] = 0xaa;
1215 1 else number[7] = 0x55;
1216 1 write_n_bytes(pt,8,RC_INST_ADDRESS);
1217 1 }
1218
1219 static void get_rc_inst()
1220 {uchar data * pt;
1221 1 number[0] = 0;
1222 1 number[1] = 0;
1223 1 number[2] = 0;
1224 1 number[3] = 0;
1225 1 number[4] = 0;
1226 1 number[5] = 0;
1227 1 number[6] = 0;
1228 1 number[7] = 0;
1229 1 pt = number;
1230 1 read_n_bytes(pt,8,RC_INST_ADDRESS);
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 21
1231 1 flag_enable_report_to_user = FALSE;
1232 1 if(number[0]==0xaa)
1233 1 {flag_section_1_set_alarm = TRUE;
1234 2 flag_enable_report_to_user = TRUE;
1235 2 }
1236 1 else
1237 1 {flag_section_1_set_alarm = FALSE;
1238 2 }
1239 1 if(number[1]==0xaa)
1240 1 {flag_section_2_set_alarm = TRUE;
1241 2 flag_enable_report_to_user = TRUE;
1242 2 }
1243 1 else
1244 1 {flag_section_2_set_alarm = FALSE;
1245 2 }
1246 1 if(number[2]==0xaa)
1247 1 {flag_section_3_set_alarm = TRUE;
1248 2 flag_enable_report_to_user = TRUE;
1249 2 }
1250 1 else
1251 1 {flag_section_3_set_alarm = FALSE;
1252 2 }
1253 1 if(number[3]==0xaa)
1254 1 {flag_section_4_set_alarm = TRUE;
1255 2 flag_enable_report_to_user = TRUE;
1256 2 }
1257 1 else
1258 1 {flag_section_4_set_alarm = FALSE;
1259 2 }
1260 1 if(number[4]==0xaa)
1261 1 {flag_section_5_set_alarm = TRUE;
1262 2 flag_enable_report_to_user = TRUE;
1263 2 }
1264 1 else
1265 1 {flag_section_5_set_alarm = FALSE;
1266 2 }
1267 1 if(number[5]==0xaa)
1268 1 {flag_section_6_set_alarm = TRUE;
1269 2 flag_enable_report_to_user = TRUE;
1270 2 }
1271 1 else
1272 1 {flag_section_6_set_alarm = FALSE;
1273 2 }
1274 1 if(number[6]==0xaa)
1275 1 {flag_section_7_set_alarm = TRUE;
1276 2 flag_enable_report_to_user = TRUE;
1277 2 }
1278 1 else
1279 1 {flag_section_7_set_alarm = FALSE;
1280 2 }
1281 1 if(number[7]==0xaa)
1282 1 {flag_section_8_set_alarm = TRUE;
1283 2 flag_enable_report_to_user = TRUE;
1284 2 }
1285 1 else
1286 1 {flag_section_8_set_alarm = FALSE;
1287 2 }
1288 1 }
1289
1290 static void get_number(uchar address)
1291 {uchar k,sum;
1292 1 bit flag1,flag2,flag3;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 22
1293 1 uchar data * pt;
1294 1 pt = number;
1295 1 read_n_bytes(pt,16,address);
1296 1 for (k=0,sum=0;k<15;k++)
1297 1 {sum += number[k]*(k+1);
1298 2 }
1299 1 flag1 = FALSE;
1300 1 if(sum==number[15])
1301 1 {flag1 = TRUE;
1302 2 }
1303 1 pt = number;
1304 1 read_n_bytes(pt,16,address+0x40);
1305 1 for (k=0,sum=0;k<15;k++)
1306 1 {sum += number[k]*(k+1);
1307 2 }
1308 1 flag2 = FALSE;
1309 1 if(sum==number[15])
1310 1 {flag2 = TRUE;
1311 2 }
1312 1 if(flag2&&(!flag1))
1313 1 {pt = number;
1314 2 write_n_bytes(pt,8,address);
1315 2 pt = number + 8;
1316 2 write_n_bytes(pt,8,address+8);
1317 2 }
1318 1 if(flag1&&(!flag2))
1319 1 {pt = number;
1320 2 read_n_bytes(pt,16,address);
1321 2 pt = number;
1322 2 write_n_bytes(pt,8,address+0x40);
1323 2 pt = number + 8;
1324 2 write_n_bytes(pt,8,address+0x48);
1325 2 }
1326 1 for(k=0;k<16;k++)
1327 1 {if((number[k]>=0x30)&&(number[k]<=0x39))
1328 2 {number[k] -= 0x30;
1329 3 }
1330 2 else
1331 2 {break;
1332 3 }
1333 2 }
1334 1 for (;k<16;k++)
1335 1 {number[k] = 0xff;
1336 2 }
1337 1 if(address==SERIAL_NUMBER_ADDRESS)
1338 1 {flag_serial_number_valid = flag1|flag2;
1339 2 }
1340 1 if(address==PHONE_1_NUMBER_ADDRESS)
1341 1 {flag_phone_1_number_valid = flag1|flag2;
1342 2 }
1343 1 if(address==PHONE_2_NUMBER_ADDRESS)
1344 1 {flag_phone_2_number_valid = flag1|flag2;
1345 2 }
1346 1 if(address==PHONE_3_NUMBER_ADDRESS)
1347 1 {flag_phone_3_number_valid = flag1|flag2;
1348 2 }
1349 1 }
*** WARNING C280 IN LINE 1292 OF ..\ALARM\ALMSET1.C: 'flag3': unreferenced local variable
1350
1351 void delay_milliseconds(uint i)
1352 {uint j;
1353 1 uchar k;
C51 COMPILER V7.00 ALMSET1 09/25/2002 15:25:41 PAGE 23
1354 1 for (j=0;j<i;j++)
1355 1 {for (k=0;k<100;k++)
1356 2 {_nop_();
1357 3 _nop_();
1358 3 _nop_();
1359 3 _nop_();
1360 3 _nop_();
1361 3 _nop_();
1362 3 }
1363 2 }
1364 1 }
MODULE INFORMATION: STATIC OVERLAYABLE
CODE SIZE = 4227 ----
CONSTANT SIZE = ---- ----
XDATA SIZE = ---- ----
PDATA SIZE = ---- ----
DATA SIZE = 41 24
IDATA SIZE = ---- ----
BIT SIZE = 32 8
END OF MODULE INFORMATION.
C51 COMPILATION COMPLETE. 3 WARNING(S), 0 ERROR(S)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -