📄 smsdrive.lst
字号:
290 2 ydl++;
291 2 count++;
292 2 flag=1;
293 2 RI=0;
294 2 }
295 1
296 1 if(count>=50)
297 1 {
298 2 if(rec[13]=='C'&&rec[14]=='M'&&rec[15]=='G'&&rec[16]=='R')
299 2 if(rec[26]=='0'&&rec[27]=='8'&&rec[28]=='9'&&rec[29]=='1')
300 2 {ReceiveFlag=1;count=0;P0=0x1f;}
301 2 }
302 1
C51 COMPILER V7.08 SMSDRIVE 04/12/2010 21:34:57 PAGE 6
303 1 EA=1;//恢复中断
304 1 }
305
306
307
308
309 /*===========================================
310 *函数名:TC35 AT联机测试 子函数
311 *参 数:
312 *功 能:
313 *返回值:
314 *作 者:weishao2401 2009/4/29
315 *============================================*/
316
317 void TC35_AtSend(void) // at联机测试命令
318 {
319 1 while(1)
320 1 {
321 2 TI=0; //清除发送标志
322 2 RI=0; //清除接收标志
323 2
324 2 uart_send(Command_At,3); //串口发送 at联机测试命令
325 2 deal_with_attention();
326 2
327 2 DelayMs(250); //延时,等待TC35的反馈信息
328 2 DelayMs(250);
329 2 DelayMs(250);
330 2 DelayMs(250);
331 2
332 2 if(flag == 1 && count == 9)
333 2 {
334 3 if(rec[5]=='O'&&rec[6]=='K')
335 3 {
336 4 deal_with_right();
337 4 flag=0;
338 4 count=0;
339 4 break;
340 4 } //如果第6和第7个字符分别是“O和“K”,那联机正确,直接退出
341 3 else
342 3 {
343 4 deal_with_error();
344 4 flag=0;
345 4 count=0;
346 4 } //出错处理,并且进入下一场循环,再次发送AT测试命令,直到联机正确
347 3
348 3 }
349 2
350 2
351 2 }
352 1 }
353 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-/////////////////////////////////////
354 void TC35_ATE1(void) // ATE1测试命令
355 {
356 1 while(1)
357 1 {
358 2 TI=0; //清除发送标志
359 2 RI=0; //清除接收标志
360 2
361 2 uart_send(Command_ATE1,6); //串口发送ATE1测试命令
362 2 deal_with_attention();
363 2
C51 COMPILER V7.08 SMSDRIVE 04/12/2010 21:34:57 PAGE 7
364 2 DelayMs(250); //延时,等待TC35的反馈信息
365 2 DelayMs(250);
366 2 DelayMs(250);
367 2 DelayMs(250);
368 2
369 2 if(flag == 1 && count == 11)
370 2 {
371 3 if(rec[7]=='O'&&rec[8]=='K')
372 3 {
373 4 deal_with_right();
374 4 flag=0;
375 4 count=0;
376 4 break;
377 4 } //如果第8和第9个字符分别是“O和“K确,直接退出
378 3 else
379 3 {
380 4 deal_with_error();
381 4 flag=0;
382 4 count=0;
383 4 } //出错处理,并且进入下一场循环,再次发送AT测试命令,直到联机正确
384 3
385 3 }
386 2
387 2
388 2 }
389 1 }
390
391 //////////////////////////////////////////////////////////////////////////////////////////////////////////
-///////////////////////////////////////
392 /* void TC35_ATV1(void) // at联机测试命令
393 {
394 while(1)
395 {
396 TI=0; //清除发送标志
397 RI=0; //清除接收标志
398
399 uart_send(Command_ATV1,6); //串口发送 at联机测试命令
400 deal_with_attention();
401
402 DelayMs(250); //延时,等待TC35的反馈信息
403 DelayMs(250);
404 DelayMs(250);
405 DelayMs(250);
406
407 if(flag == 1 && count == 6)
408 {
409 if(rec[2]=='O'&&rec[3]=='K')
410 {
411 deal_with_right();
412 flag=0;
413 count=0;
414 break;
415 }
416 else
417 {
418 deal_with_error();
419 flag=0;
420 count=0;
421 }
422 }
423
424
C51 COMPILER V7.08 SMSDRIVE 04/12/2010 21:34:57 PAGE 8
425 }
426 }*/
427 //////////////////////////////////////////////////////////////////////////////////////////////////////
428 /*===========================================
429 *函数名:TC35信号强度测试 子函数
430 *参 数:
431 *功 能:
432 *返回值:
433 *作 者:weishao2401 2009/4/29
434 *============================================*/
435
436 void TC35_SignalTest(void) // TC35信号强度测试
437 {
438 1 while(1)
439 1 {
440 2 TI=0;
441 2 RI=0;
442 2 uart_send(Command_Csq,7); // AT+CSQ
443 2 deal_with_attention();
444 2
445 2 DelayMs(250); //延时,等待TC35的反馈信息
446 2 DelayMs(250);
447 2 DelayMs(250);
448 2 DelayMs(250);
449 2
450 2 if(flag == 1 && count == 28)
451 2 {
452 3 if(rec[18]== '9'&& rec[19]== '9')
453 3 {
454 4 deal_with_right();
455 4 flag=0;
456 4 count=0;
457 4 break;
458 4 } //如果第19和第20个字符分别是“9和“9”,那正确,直接退出
459 3 else
460 3 {
461 4 deal_with_error();
462 4 flag=0;
463 4 count=0;
464 4 } //出错,进入下一次循环
465 3
466 3 }
467 2
468 2
469 2 }
470 1 }
471
472 /*===========================================
473 *函数名:TC35短信格式设置 子函数
474 *参 数:
475 *功 能:
476 *返回值:
477 *作 者:weishao2401 2009/4/29
478 *============================================*/
479
480 void TC35_AtCmgf1(void) // TC35短信格式设置
481 {
482 1 while(1)
483 1 {
484 2 TI=0;
485 2 RI=0;
486 2 uart_send(Command_Cmgf1,10); // AT+Cmgf =1
C51 COMPILER V7.08 SMSDRIVE 04/12/2010 21:34:57 PAGE 9
487 2 deal_with_attention();
488 2
489 2 DelayMs(250); //延时,等待TC35的反馈信息
490 2 DelayMs(250);
491 2 DelayMs(250);
492 2 DelayMs(250);
493 2
494 2 if(flag == 1 && count == 16)
495 2 {
496 3 if(rec[12]=='O'&&rec[13]=='K')
497 3 {
498 4 deal_with_right();
499 4 flag=0;
500 4 count=0;
501 4 break;
502 4 }//如果第13和第14个字符分别是“O和“K”,那说明正确,直接退出,否则就说明出错了
503 3
504 3 else
505 3 {
506 4 deal_with_error();
507 4 flag=0;
508 4 count=0;
509 4 } //出错,进入下一次循环
510 3
511 3 }
512 2
513 2 }
514 1 }
515
516 /*===========================================
517 *函数名:TC35编解码字符设置 子函数
518 *参 数:
519 *功 能:
520 *返回值:
521 *作 者:weishao2401 2009/4/29
522 *============================================*/
523
524 void TC35_AtCscs(void) // TC35编解码字符设置
525 {
526 1 while(1)
527 1 {
528 2 TI=0;
529 2 RI=0;
530 2 uart_send(Command_Cscs,12); // AT+CSCS=GSM
531 2 deal_with_attention();
532 2
533 2 DelayMs(250); //延时,等待TC35的反馈信息
534 2 DelayMs(250);
535 2 DelayMs(250);
536 2 DelayMs(250);
537 2
538 2 if(flag == 1 && count == 18)
539 2 {
540 3 if(rec[14]=='O'&&rec[15]=='K')
541 3 {
542 4 deal_with_right();
543 4 flag=0;
544 4 count=0;
545 4 break;
546 4 }//如果第15和第16个字符分别是“O和“K”,那说明正确,直接退出,否则就说明出错了
547 3
548 3 else
C51 COMPILER V7.08 SMSDRIVE 04/12/2010 21:34:57 PAGE 10
549 3 {
550 4 deal_with_error();
551 4 flag=0;
552 4 count=0;
553 4 } //出错,进入下一次循环
554 3
555 3 }
556 2
557 2 }
558 1 }
559
560
561 /*===========================================
562 *函数名:TC35新消息提示设置 子函数
563 *参 数:
564 *功 能:
565 *返回值:
566 *作 者:weishao2401 2009/4/29
567 *============================================*/
568
569 void TC35_AtCnmi(void) // TC35新消息提示设置
570 {
571 1 while(1)
572 1 {
573 2 TI=0;
574 2 RI=0;
575 2 uart_send(Command_Cnmi,12); // AT+CNMI=2,1
576 2 deal_with_attention();
577 2
578 2 DelayMs(250); //延时,等待TC35的反馈信息
579 2 DelayMs(250);
580 2 DelayMs(250);
581 2 DelayMs(250);
582 2
583 2 if(flag == 1 && count == 18)
584 2 {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -