⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tele_control.lst

📁 基于PIC单片机的智能电话控制系统
💻 LST
📖 第 1 页 / 共 5 页
字号:
  1045:                         PORTB=(LED4[i])|(PORTB&0x0f);

  1046:                 }

  1047:                 dsbuf[0]=dsbuf[2]=0xee;

  1048:                 dsbuf[1]=Tel_num;

  1049:                 dsbuf[3]=(dsbuf[3]&0x0f)|0xa0;

  1050:                 Tel_num=0x00;

  1051:         }

  1052:         if(jdq_delay)                   //wait for 1S

  1053:         {

  1054:                 timedelay++;

  1055:                 if(timedelay==0xfa)

  1056:                 {

  1057:                         jdq_delay=0;

  1058:                         INTE=1;

  1059:                 }

  1060:                 else{INTE=0;}

  1061:         }

  1062:         else

  1063:         {

  1064:                 INTE=1;

  1065:                 timedelay=0x00;

  1066:         }

  1067: }

  1068: //*****************************

  1069: //

  1070: //*****************************

  1071: void jdq_check(void)

  1072: {

  1073:         if(Tel_num_change)

  1074:         {

  1075:                 unsigned char i;

  1076:                 Tel_num_change=0;

  1077:                 voice(0x7c);

  1078:                 i=ds1302_read(adr_jdqsta);

  1079:                 dsbuf[0]=dsbuf[2]=0xee;

  1080:                 dsbuf[1]=0xff;

  1081:                 dsbuf[3]=(dsbuf[3]&0x0f)|0xa0;

  1082:                 if(Tel_num==0x01)

  1083:                 {

  1084:                         dsbuf[1]=Tel_num;

  1085:                         if(i&0x01){voice(0x40);}

  1086:                         else{voice(0x58);}

  1087:                 }

  1088:                 if(Tel_num==0x02)

  1089:                 {

  1090:                         dsbuf[1]=Tel_num;

  1091:                         if(i&0x02){voice(0x40);}

  1092:                         else{voice(0x58);}

  1093:                 }

  1094:                 if(Tel_num==0x03)

  1095:                 {

  1096:                         dsbuf[1]=Tel_num;

  1097:                         if(i&0x04){voice(0x40);}

  1098:                         else{voice(0x58);}

  1099:                 }

  1100:                 if(Tel_num==0x04)

  1101:                 {

  1102:                         dsbuf[1]=Tel_num;

  1103:                         if(i&0x08){voice(0x40);}

  1104:                         else{voice(0x58);}

  1105:                 }

  1106:                 if(Tel_num==0x05)

  1107:                 {

  1108:                         dsbuf[1]=Tel_num;

  1109:                         if(VOICE){VOICE=0;voice(0x58);}

  1110:                         else{VOICE=1;voice(0x40);}

  1111:                 }

  1112:                 if(Tel_num==0x0e)

  1113:                 {

  1114:                         VOICE=0;

  1115:                         voice(0x60);

  1116:                         STA=0x01;

  1117:                 }

  1118:                 Tel_num=0x00;

  1119:         }

  1120: 

  1121: }

  1122: //*****************************

  1123: //

  1124: //*****************************

  1125: void reset_password(void)

  1126: {

  1127:         if(Tel_num_change)

  1128:         {       

  1129:                 unsigned char i,j;

  1130:                 Tel_num_change=0;

  1131:                 i=Tel_num&0x0f;

  1132:                 j=0xf0;

  1133:                 if(password_buf[7]&0x01)

  1134:                 {;}

  1135:                 else

  1136:                 {

  1137:                         i=(i>>4)|(i<<4);

  1138:                         j=(j<<4)|(j>>4);

  1139:                 }

  1140:                 if(check_bit0)

  1141:                 {

  1142:                         password_buf[(password_buf[7]>>1)&0x07]&=j;

  1143:                         password_buf[(password_buf[7]>>1)&0x07]|=i;

  1144:                 }

  1145:                 else

  1146:                 {

  1147:                         password1_buf[(password_buf[7]>>1)&0x07]&=j;

  1148:                         password1_buf[(password_buf[7]>>1)&0x07]|=i;

  1149:                 }

  1150:                 password_buf[7]++;

  1151:                 if(password_buf[7]==0x0e)

  1152:                 {

  1153:                         password_buf[7]=0x0d;

  1154:                 }

  1155:                 if(Tel_num==0x0f)               //Tel_num==#?

  1156:                 {       

  1157:                         Tel_num=0x00;

  1158:                         password_buf[7]=0x00;

  1159:                         if(check_bit0){check_bit1=1;}

  1160:                         check_bit0=1;

  1161:                         voice(0x40);

  1162:                 }

  1163:                 if(check_bit1)

  1164:                 {

  1165:                         check_bit0=0;

  1166:                         check_bit1=0;

  1167:                         for(i=0;i<7;i++)

  1168:                         {

  1169:                                 if(password_buf[i]==password1_buf[i])

  1170:                                 {;}

  1171:                                 else

  1172:                                 {       password_times|=0x80;}

  1173:                         }

  1174:                         if(password_times&0x80)

  1175:                         {

  1176:                                 password_times&=0x7f;

  1177:                                 voice(0x7c);

  1178:                         }

  1179:                         else

  1180:                         {

  1181:                                 ds1302_write(ds1302_control,0x00);      //close write protect

  1182:                                 ds1302_write(adr_password,password_buf[0]);     //password0

  1183:                                 ds1302_write(adr_password+2,password_buf[1]);   //password1

  1184:                                 ds1302_write(adr_password+4,password_buf[2]);   //password2

  1185:                                 ds1302_write(adr_password+6,password_buf[3]);   //password3

  1186:                                 ds1302_write(adr_password+8,password_buf[4]);   //password4

  1187:                                 ds1302_write(adr_password+10,password_buf[5]);  //password5

  1188:                                 ds1302_write(adr_password+12,password_buf[6]);  //password6

  1189:                                 ds1302_write(ds1302_control,0x80);      //open write protect

  1190:                                 voice(0x60);

  1191:                                 STA=0X01;

  1192:                         }

  1193:                         password1_buf[0]=0xaa;          //reload

  1194:                         password1_buf[1]=0xaa;

  1195:                         password1_buf[2]=0xaa;

  1196:                         password1_buf[3]=0xaa;

  1197:                         password1_buf[4]=0xaa;

  1198:                         password1_buf[5]=0xaa;

  1199:                         password1_buf[6]=0xaa;

  1200:                         password_buf[0]=0xaa;           //reload

  1201:                         password_buf[1]=0xaa;

  1202:                         password_buf[2]=0xaa;

  1203:                         password_buf[3]=0xaa;

  1204:                         password_buf[4]=0xaa;

  1205:                         password_buf[5]=0xaa;

  1206:                         password_buf[6]=0xaa;

  1207:                         password_buf[7]=0x00;   

  1208:                 }

  1209:                 if(Tel_num==0x0e)

  1210:                 {

  1211:                         check_bit0=0;

  1212:                         check_bit1=0;

  1213:                         password_times&=0x7f;

  1214:                         password1_buf[0]=0xaa;          //reload

  1215:                         password1_buf[1]=0xaa;

  1216:                         password1_buf[2]=0xaa;

  1217:                         password1_buf[3]=0xaa;

  1218:                         password1_buf[4]=0xaa;

  1219:                         password1_buf[5]=0xaa;

  1220:                         password1_buf[6]=0xaa;

  1221:                         password_buf[0]=0xaa;           //reload

  1222:                         password_buf[1]=0xaa;

  1223:                         password_buf[2]=0xaa;

  1224:                         password_buf[3]=0xaa;

  1225:                         password_buf[4]=0xaa;

  1226:                         password_buf[5]=0xaa;

  1227:                         password_buf[6]=0xaa;

  1228:                         password_buf[7]=0x00;

  1229:                         voice(0x60);

  1230:                         STA=0x01;

  1231:                 }

  1232:                 if(check_bit0)

  1233:                 {

  1234:                         if((password_buf[7]&0x0f)>0x06)

  1235:                         {

  1236:                                 dsbuf[0]=password_buf[3];

  1237:                                 dsbuf[1]=password_buf[4];

  1238:                                 dsbuf[2]=password_buf[5];

  1239:                                 dsbuf[3]=(password_buf[6]&0xf0)|(dsbuf[3]&0x0f);

  1240:                         }

  1241:                         else

  1242:                         {

  1243:                                 dsbuf[0]=password_buf[0];

  1244:                                 dsbuf[1]=password_buf[1];

  1245:                                 dsbuf[2]=password_buf[2];

  1246:                                 dsbuf[3]=0x20|(dsbuf[3]&0x0f);

  1247:                         }

  1248:                 }

  1249:                 else

  1250:                 {

  1251:                         if((password_buf[7]&0x0f)>0x06)

  1252:                         {

  1253:                                 dsbuf[0]=password1_buf[3];

  1254:                                 dsbuf[1]=password1_buf[4];

  1255:                                 dsbuf[2]=password1_buf[5];

  1256:                                 dsbuf[3]=(password1_buf[6]&0xf0)|(dsbuf[3]&0x0f);

  1257:                         }

  1258:                         else

  1259:                         {

  1260:                                 dsbuf[0]=password1_buf[0];

  1261:                                 dsbuf[1]=password1_buf[1];

  1262:                                 dsbuf[2]=password1_buf[2];

  1263:                                 dsbuf[3]=0x10|(dsbuf[3]&0x0f);

  1264:                         }

  1265:                 }

  1266:         }       

  1267: }

  1268: //*****************************

  1269: //

  1270: //*****************************

  1271: void reset_ringtimes(void)

  1272: {

  1273:         if(Tel_num_change)

  1274:         {

  1275:                 Tel_num_change=0;

  1276:                 dsbuf[0]=0xee;

  1277:                 dsbuf[1]=0xff;

  1278:                 dsbuf[2]=0xee;

  1279:                 dsbuf[3]=0xa0|(dsbuf[3]&0x0f);

  1280:                 if(Tel_num==0x0e)

  1281:                 {

  1282:                         voice(0x60);

  1283:                         STA=0x01;

  1284:                 }

  1285:                 else if(Tel_num==0x00)

  1286:                 {

  1287:                         voice(0x7c);

  1288:                 }

  1289:                 else if(Tel_num==0x0f)

  1290:                 {

  1291:                         voice(0x7c);

  1292:                 }

  1293:                 else

  1294:                 {

  1295:                         dsbuf[1]=Tel_num;

  1296:                         voice(0x40);

  1297:                         ds1302_write(ds1302_control,0x00);      //close write protect

  1298:                         ds1302_write(adr_ringtimes,Tel_num);//ring times,n times

  1299:                         ds1302_write(ds1302_control,0x80);      //open write protect

  1300:                 }

  1301:                 Tel_num=0x00;

  1302:         }

  1303: }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -