📄 osc1.lst
字号:
458 2 S1DAT=COMM;
459 2 S1CON=0xC5; //STA=0 STO=0 SI=0 AA=1
460 2 }
461 1 if (S1STA==0x20)
462 1 {
463 2 FF=1;
464 2 S1CON=0xD5; //STA=0 STO=1 SI=0 AA=1
465 2 }
466 1 if (S1STA==0x28)
467 1 {
468 2 S1CON=0xD5; //STA=0 STO=1 SI=0 AA=1
469 2 FF=1;
470 2 }
471 1 if (S1STA==0x30)
472 1 {
473 2 FF=1;
474 2 S1CON=0xD5; //STA=0 STO=1 SI=0 AA=1
475 2 }
476 1 if (S1STA==0x38)
477 1 {
478 2 S1CON=0xE5; //STA=1 STO=0 SI=0 AA=1
479 2 }
480 1 if (S1STA==0x40)
481 1 {
482 2 S1CON=0xC5; //STA=0 STO=0 SI=0 AA=1
483 2 }
484 1 if (S1STA==0x48)
485 1 {
486 2 FF=1;
487 2 S1CON=0xD5; //STA=0 STO=1 SI=0 AA=1
488 2 }
489 1 if (S1STA==0x50)
C51 COMPILER V7.06 OSC1 06/23/2005 10:56:30 PAGE 9
490 1 {
491 2 GET=S1DAT;
492 2 S1CON=0xC1; //STA=0 STO=0 SI=0 AA=0
493 2 }
494 1 if (S1STA==0x58)
495 1 {
496 2 FF=1;
497 2 S1CON=0xD5; //STA=0 STO=1 SI=0 AA=1
498 2 }
499 1 }
500
501 void CT0_int (void) interrupt 6 //横摆中心
502 {
503 1 CTI0=0;
504 1 CTCON=CTCON&0xFC;
505 1 if(center_change==1)
506 1 {
507 2 IEN1=IEN1&0XFE;
508 2 gate=0;
509 2 osc_enable=1;
510 2 center_excursion=0;
511 2 center_change=0;
512 2 }
513 1 else
514 1 {
515 2 if(decrease==1)
516 2 {
517 3 gate=0;
518 3 if(pp.v41>800)
519 3 delay(3);
520 3 temp_c++;
521 3
522 3 if(share+1+osc_adjudge<c_decrease)
523 3 {
524 4 CTCON=CTCON|0x08; //CT1下降沿
525 4 if(temp_c%2==0||first_center==1)
526 4 {
527 5 share++;
528 5 c_t42_l=pp.t42_l*5*(c_decrease-share)/c_decrease;
529 5 c_t42_r=pp.t42_r*5*(c_decrease-share)/c_decrease;
530 5 out1=last_out1*(c_decrease-share)/c_decrease;
531 5 out2=out1;
532 5
533 5 COM=0X76;
534 5 COUNT1=out1%256;
535 5 COUNT1=out1/256;
536 5 COM=0XB6;
537 5 COUNT2=out2%256;
538 5 COUNT2=out2/256;
539 5 IEN1=IEN1|0X02;
540 5 gate=1;
541 5 temp_c=0;
542 5 if(first_center==1)
543 5 first_center=0;
544 5 }
545 4 else
546 4 {
547 5 IEN1=IEN1|0x02;
548 5 gate=1;
549 5 }
550 4 }
551 3 else
C51 COMPILER V7.06 OSC1 06/23/2005 10:56:30 PAGE 10
552 3 {
553 4 if(temp_c!=2)
554 4 {
555 5 CTCON=CTCON|0x08; //CT1下降沿
556 5 COM=0X76;
557 5 COUNT1=out1%256;
558 5 COUNT1=out1/256;
559 5 COM=0XB6;
560 5 COUNT2=out2%256;
561 5 COUNT2=out2/256;
562 5 IEN1=IEN1|0X02;
563 5 gate=1;
564 5 }
565 4 else
566 4 {
567 5 gate=0; //关8254门控信号
568 5 CTCON=CTCON&0XF0;
569 5 IEN1=IEN1&0XFC; //禁止CT0,CT1
570 5 decrease_ok=1;
571 5 }
572 4 }
573 3 if(decreased==0)
574 3 decreased=1;
575 3 }
576 2 else
577 2 {
578 3 if(osc==1)
579 3 {
580 4 gate=0; //关8254门控信号
581 4 delay(15);
582 4 if(osc_change==1)
583 4 {
584 5 out1=out1+pp.da41*10;
585 5 osc_add++;
586 5 }
587 4 else
588 4 {
589 5 out1=out1-pp.da41*10;
590 5 osc_dec++;
591 5 }
592 4 out2=out1;
593 4 CTCON=CTCON|0X08;
594 4 COM=0X76;
595 4 COUNT1=out1%256;
596 4 COUNT1=out1/256;
597 4 COM=0XB6;
598 4 COUNT2=out2%256;
599 4 COUNT2=out2/256;
600 4 IEN1=IEN1|0X02;
601 4 gate=1;
602 4 osc=0;
603 4 }
604 3 if(in_sector==1&&new_sector==1)
605 3 {
606 4 if(K4==ON&&osc_ok==1)
607 4 {
608 5 out0=2400000/pp.x[nonce_sec][3]; //横摆脉冲, 时钟4M,4*60*0.01*1000000
609 5 out1=10*pp.x[nonce_sec][4]; //横摆半宽脉冲,时钟1K,(A41/10)/(v41/60)*1000
610 5 out2=2*out1; //横摆整宽脉冲
611 5 c_t42_l=pp.x[nonce_sec][1]*5; //pp.t42_l/10*1000/50
612 5 c_t42_r=pp.x[nonce_sec][2]*5;
613 5 COM=0X36;
C51 COMPILER V7.06 OSC1 06/23/2005 10:56:30 PAGE 11
614 5 COUNT0=out0%256;
615 5 COUNT0=out0/256;
616 5 COM=0X76;
617 5 COUNT1=out1%256;
618 5 COUNT1=out1/256; //半个摆宽
619 5 COM=0XB6;
620 5 COUNT2=out1%256;
621 5 COUNT2=out1/256; //整个摆宽
622 5 const0=pp.x[nonce_sec][3]*(pp.x[nonce_sec][1]+pp.x[nonce_sec][2])/2;
623 5 const0=const0+pp.x[nonce_sec][4]*60;
624 5 const1=(unsigned long)(pp.x[nonce_sec][3])*(unsigned long)(pp.t17);
625 5 osc_add=0;
626 5 osc_dec=0;
627 5 sec_center=1;
628 5 }
629 4 else
630 4 {
631 5 gate=0;
632 5 CTCON=CTCON&0xF3;
633 5 osc_ok=0;
634 5 }
635 4 }
636 3 CTCON=CTCON|0x08;
637 3 IEN1=IEN1|0x02;
638 3 }
639 2 }
640 1 }
641
642 void CT1_int (void) interrupt 7 //整个摆宽
643 {
644 1 CTI1=0;
645 1 gate=0; //out1、out2门控信号
646 1 CTCON=CTCON&0xF3;
647 1 if(sec_center==1)
648 1 {
649 2 COM=0XB6;
650 2 COUNT2=out2%256;
651 2 COUNT2=out2/256;
652 2 sec_center=0;
653 2 if(new_sector==1)
654 2 new_sector=0;
655 2 }
656 1 osc_dir=~osc_dir; //换横摆方向
657 1 t_edge=~t_edge; //换边缘标志
658 1 osc_out=~osc_out; //横摆输出
659 1 if(decreased==1)
660 1 {
661 2 if(c_t42_l<1)
662 2 c_t42_l=1;
663 2 if(c_t42_r<1)
664 2 c_t42_r=1;
665 2 IEN1=IEN1|0X10;
666 2 }
667 1 else
668 1 {
669 2 if(center_excursion==1&&judge_ok==0)
670 2 {
671 3 if(center_excursion==1&&judge_ok==0)
672 3 {
673 4 if(t_edge==0&&excursion_dir==1||t_edge==1&&excursion_dir==0)//左边缘、向右偏或右边缘、向左偏
674 4 {
675 5 out1=out1+pp.dc41*10;
C51 COMPILER V7.06 OSC1 06/23/2005 10:56:30 PAGE 12
676 5 judge_ok=1;
677 5 center_excursion=0;
678 5 }
679 4 }
680 3 else if(judge_ok==1)
681 3 {
682 4 out1=out1-pp.dc41*10;
683 4 judge_ok=0;
684 4 }
685 3 out2=2*out1;
686 3 COM=0X76;
687 3 COUNT1=out1%256;
688 3 COUNT1=out1/256;
689 3 COM=0XB6;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -