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

📄 isr.p1

📁 PSOC 电动自行车代码 器件采用CYPRESS新电动自行车器件CY8C245
💻 P1
📖 第 1 页 / 共 5 页
字号:

"507
[e ( _motor_ctrlout (2
 , _ppc _st ]
"508
[; ;isr.c: 508: }

[e $U 94  ]
"509
[e :U 93 ]
[; ;isr.c: 509: else

[; ;isr.c: 510: {

[; ;isr.c: 511: ppc->msg.abs_delaycount++;

"511
[e ++ . . *U _ppc 0 30 -> -> 1 `i `ui ]
[; ;isr.c: 512: if((ppc->msg.abs_delaycount&0x3f)==0)

"512
[e $ ! == & . . *U _ppc 0 30 -> -> 63 `i `ui -> -> 0 `i `ui 95  ]
[; ;isr.c: 513: {

[; ;isr.c: 514: if(adr->msg.bus_current>ppc->msg.LEBMF_CURRENT)

"514
[e $ ! > -> . . *U _adr 0 1 `i -> . . *U _ppc 0 24 `i 96  ]
[; ;isr.c: 515: ppc->msg.duty_cycle=ppc->msg.duty_cycle<0xf8? ppc->msg.duty_cycle+2:0xf8;

"515
[e = . . *U _ppc 0 2 -> ? < -> . . *U _ppc 0 2 `i -> 248 `i : + -> . . *U _ppc 0 2 `i -> 2 `i -> 248 `i `uc ]
[e $U 97  ]
"516
[e :U 96 ]
[; ;isr.c: 516: else if((ppc->msg.LEBMF_CURRENT-adr->msg.bus_current)<8)

[e $ ! < - -> . . *U _ppc 0 24 `i -> . . *U _adr 0 1 `i -> 8 `i 98  ]
[; ;isr.c: 517: ppc->msg.duty_cycle=ppc->msg.duty_cycle<0xf8? ppc->msg.duty_cycle++:0xf8;

"517
[e = . . *U _ppc 0 2 -> ? < -> . . *U _ppc 0 2 `i -> 248 `i : -> ++ . . *U _ppc 0 2 -> -> 1 `i `uc `i -> 248 `i `uc ]
[e $U 99  ]
"518
[e :U 98 ]
[; ;isr.c: 518: else if(ppc->msg.HEBMF_CURRENT>adr->msg.bus_current)

[e $ ! > -> . . *U _ppc 0 23 `i -> . . *U _adr 0 1 `i 100  ]
[; ;isr.c: 519: ppc->msg.duty_cycle=ppc->msg.duty_cycle>0x10? ppc->msg.duty_cycle--:0x10;

"519
[e = . . *U _ppc 0 2 -> ? > -> . . *U _ppc 0 2 `i -> 16 `i : -> -- . . *U _ppc 0 2 -> -> 1 `i `uc `i -> 16 `i `uc ]
[e :U 100 ]
"521
[e :U 99 ]
[e :U 97 ]
[e :U 95 ]
"523
[e :U 94 ]
[; ;isr.c: 521: }

[; ;isr.c: 523: }

[; ;isr.c: 524: PWM_WritePulseWidth(ppc->msg.duty_cycle);

"524
[e ( _PWM_WritePulseWidth (1
 . . *U _ppc 0 2 ]
"525
[; ;isr.c: 525: }

[e $U 101  ]
"526
[e :U 88 ]
[; ;isr.c: 526: else

[; ;isr.c: 527: {

[; ;isr.c: 528: st->msg.st0|=0x80;

"528
[e =| . . *U _st 0 0 -> -> 128 `i `uc ]
[; ;isr.c: 530: ppc->msg.portena=0;

"530
[e = . . *U _ppc 0 1 -> -> 0 `i `uc ]
[; ;isr.c: 531: ppc->msg.pwmena=0;

"531
[e = . . *U _ppc 0 0 -> -> 0 `i `uc ]
[; ;isr.c: 532: st->msg.st3&=~0x80;

"532
[e =& . . *U _st 0 3 -> ~ -> 128 `i `uc ]
[; ;isr.c: 533: ppc->msg.speed_profile=0;

"533
[e = . . *U _ppc 0 7 -> -> 0 `i `uc ]
[; ;isr.c: 535: motor_ctrlout(ppc,st);

"535
[e ( _motor_ctrlout (2
 , _ppc _st ]
[; ;isr.c: 536: ppc->msg.duty_cycle=ppc->msg.speed_profile;

"536
[e = . . *U _ppc 0 2 . . *U _ppc 0 7 ]
[; ;isr.c: 537: PWM_WritePulseWidth(ppc->msg.duty_cycle);

"537
[e ( _PWM_WritePulseWidth (1
 . . *U _ppc 0 2 ]
"538
[e :U 101 ]
"539
[; ;isr.c: 538: }

[; ;isr.c: 539: }

[e $U 102  ]
"540
[e :U 87 ]
[; ;isr.c: 540: else

[; ;isr.c: 541: {

[; ;isr.c: 542: if(st->msg.st0&0x20)

"542
[e $ ! != & -> . . *U _st 0 0 `i -> 32 `i -> 0 `i 103  ]
[; ;isr.c: 543: {

[; ;isr.c: 544: ppc->msg.speed_profile=ppc->msg.speed_profile>4? ppc->msg.speed_profile-4:0;

"544
[e = . . *U _ppc 0 7 -> ? > -> . . *U _ppc 0 7 `i -> 4 `i : - -> . . *U _ppc 0 7 `i -> 4 `i -> 0 `i `uc ]
"545
[; ;isr.c: 545: }

[e $U 104  ]
"546
[e :U 103 ]
[; ;isr.c: 546: else

[; ;isr.c: 547: {

[; ;isr.c: 548: if(ppc->msg.duty_cycle==0)

"548
[e $ ! == -> . . *U _ppc 0 2 `i -> 0 `i 105  ]
[; ;isr.c: 549: {

[; ;isr.c: 550: ppc->msg.speed_profile=0;

"550
[e = . . *U _ppc 0 7 -> -> 0 `i `uc ]
[; ;isr.c: 551: if(get_ctrlout_setni(ppc,st))

"551
[e $ ! != -> ( _get_ctrlout_setni (2
 , _ppc _st `i -> -> -> 0 `i `uc `i 106  ]
[; ;isr.c: 552: { st->msg.st1|=0x20;

"552
[e =| . . *U _st 0 1 -> -> 32 `i `uc ]
[; ;isr.c: 553: st->msg.st0|=0x80;

"553
[e =| . . *U _st 0 0 -> -> 128 `i `uc ]
[; ;isr.c: 554: ppc->msg.portena=0;

"554
[e = . . *U _ppc 0 1 -> -> 0 `i `uc ]
[; ;isr.c: 555: ppc->msg.pwmena=0;

"555
[e = . . *U _ppc 0 0 -> -> 0 `i `uc ]
[; ;isr.c: 556: ppc->msg.speed_profile=0;

"556
[e = . . *U _ppc 0 7 -> -> 0 `i `uc ]
[; ;isr.c: 557: motor_ctrlout(ppc,st);

"557
[e ( _motor_ctrlout (2
 , _ppc _st ]
"559
[; ;isr.c: 559: }

[e $U 107  ]
"560
[e :U 106 ]
[; ;isr.c: 560: else

[; ;isr.c: 561: {

[; ;isr.c: 562: ppc->msg.portena=0;

"562
[e = . . *U _ppc 0 1 -> -> 0 `i `uc ]
[; ;isr.c: 563: motor_ctrlout(ppc,st);

"563
[e ( _motor_ctrlout (2
 , _ppc _st ]
[; ;isr.c: 564: set_next_ctrlseq(st,ppc);

"564
[e ( _set_next_ctrlseq (2
 , _st _ppc ]
"565
[e :U 107 ]
"566
[; ;isr.c: 565: }

[; ;isr.c: 566: }

[e $U 108  ]
"567
[e :U 105 ]
[; ;isr.c: 567: else if(st->msg.st0&0x80)

[e $ ! != & -> . . *U _st 0 0 `i -> 128 `i -> 0 `i 109  ]
[; ;isr.c: 568: {

[; ;isr.c: 569: if(get_ctrlout_setni(ppc,st))

"569
[e $ ! != -> ( _get_ctrlout_setni (2
 , _ppc _st `i -> -> -> 0 `i `uc `i 110  ]
[; ;isr.c: 570: { st->msg.st1|=0x20;

"570
[e =| . . *U _st 0 1 -> -> 32 `i `uc ]
[; ;isr.c: 571: ppc->msg.portena=0;

"571
[e = . . *U _ppc 0 1 -> -> 0 `i `uc ]
[; ;isr.c: 572: ppc->msg.pwmena=0;

"572
[e = . . *U _ppc 0 0 -> -> 0 `i `uc ]
[; ;isr.c: 573: ppc->msg.speed_profile=0;

"573
[e = . . *U _ppc 0 7 -> -> 0 `i `uc ]
[; ;isr.c: 574: motor_ctrlout(ppc,st);

"574
[e ( _motor_ctrlout (2
 , _ppc _st ]
"575
[; ;isr.c: 575: }

[e $U 111  ]
"576
[e :U 110 ]
[; ;isr.c: 576: else

[; ;isr.c: 577: { st->msg.st0&=~0x80;

"577
[e =& . . *U _st 0 0 -> ~ -> 128 `i `uc ]
[; ;isr.c: 578: ppc->msg.portena=ppc->msg.ctrlout_set;

"578
[e = . . *U _ppc 0 1 . . *U _ppc 0 5 ]
[; ;isr.c: 579: motor_ctrlout(ppc,st);

"579
[e ( _motor_ctrlout (2
 , _ppc _st ]
[; ;isr.c: 580: set_next_ctrlseq(st,ppc);

"580
[e ( _set_next_ctrlseq (2
 , _st _ppc ]
"581
[e :U 111 ]
"582
[e :U 109 ]
"583
[e :U 108 ]
[; ;isr.c: 581: }

[; ;isr.c: 582: }

[; ;isr.c: 583: if(!(st->msg.st1&0x20)){

[e $ ! ! != & -> . . *U _st 0 1 `i -> 32 `i -> 0 `i 112  ]
[; ;isr.c: 584: if(adr->msg.bus_current<ppc->msg.LSPWM_SWITCH_I)

"584
[e $ ! < -> . . *U _adr 0 1 `i -> . . *U _ppc 0 11 `i 113  ]
[; ;isr.c: 585: {

[; ;isr.c: 586: ppc->msg.pwmena&=~2;

"586
[e =& . . *U _ppc 0 0 -> ~ -> 2 `i `uc ]
[; ;isr.c: 587: ppc->msg.OV_MINRATEDI_ERR=0;

"587
[e = . . *U _ppc 0 16 -> -> 0 `i `uc ]
"588
[; ;isr.c: 588: }

[e $U 114  ]
"589
[e :U 113 ]
[; ;isr.c: 589: else

[; ;isr.c: 590: {

[; ;isr.c: 591: ppc->msg.OV_MINRATEDI_ERR=adr->msg.bus_current-ppc->msg.LSPWM_SWITCH_I;

"591
[e = . . *U _ppc 0 16 -> - -> . . *U _adr 0 1 `i -> . . *U _ppc 0 11 `i `uc ]
[; ;isr.c: 592: ppc->msg.pwmena|=2;

"592
[e =| . . *U _ppc 0 0 -> -> 2 `i `uc ]
"593
[e :U 114 ]
[; ;isr.c: 593: }

[; ;isr.c: 595: if(adr->msg.bus_current<ppc->msg.RATED_CURRENT)

"595
[e $ ! < -> . . *U _adr 0 1 `i -> . . *U _ppc 0 13 `i 115  ]
[; ;isr.c: 596: {

[; ;isr.c: 597: ppc->msg.countgtr=0;

"597
[e = . . *U _ppc 0 32 -> -> 0 `i `uc ]
[; ;isr.c: 598: if(ppc->msg.speed_command>ppc->msg.speed_profile)

"598
[e $ ! > -> . . *U _ppc 0 6 `i -> . . *U _ppc 0 7 `i 116  ]
[; ;isr.c: 599: {

[; ;isr.c: 600: if((ppc->msg.RATED_CURRENT-adr->msg.bus_current)<6)

"600
[e $ ! < - -> . . *U _ppc 0 13 `i -> . . *U _adr 0 1 `i -> 6 `i 117  ]
[; ;isr.c: 601: {

[; ;isr.c: 602: ppc->msg.count++;

"602
[e ++ . . *U _ppc 0 21 -> -> 1 `i `uc ]
[; ;isr.c: 603: if(ppc->msg.count>0x40)

"603
[e $ ! > -> . . *U _ppc 0 21 `i -> 64 `i 118  ]
[; ;isr.c: 604: {

[; ;isr.c: 605: ppc->msg.count=0;

"605
[e = . . *U _ppc 0 21 -> -> 0 `i `uc ]
[; ;isr.c: 606: ppc->msg.speed_profile++;

"606
[e ++ . . *U _ppc 0 7 -> -> 1 `i `uc ]
"607
[e :U 118 ]
"608
[; ;isr.c: 607: }

[; ;isr.c: 608: }

[e $U 119  ]
"609
[e :U 117 ]
[; ;isr.c: 609: else{

[; ;isr.c: 610: ppc->msg.count++;

"610
[e ++ . . *U _ppc 0 21 -> -> 1 `i `uc ]
[; ;isr.c: 611: if(ppc->msg.count>32)

"611
[e $ ! > -> . . *U _ppc 0 21 `i -> 32 `i 120  ]
[; ;isr.c: 612: {

[; ;isr.c: 613: ppc->msg.count=0;

"613
[e = . . *U _ppc 0 21 -> -> 0 `i `uc ]
[; ;isr.c: 614: ppc->msg.speed_profile++;

"614
[e ++ . . *U _ppc 0 7 -> -> 1 `i `uc ]
"615
[e :U 120 ]
[; ;isr.c: 615: }

[; ;isr.c: 617: if(ppc->msg.speed_profile<0x8) ppc->msg.speed_profile=0x8;

"617
[e $ ! < -> . . *U _ppc 0 7 `i -> 8 `i 121  ]
[e = . . *U _ppc 0 7 -> -> 8 `i `uc ]
[e :U 121 ]
[; ;isr.c: 618: ppc->msg.portena=ppc->msg.ctrlout_set;

"618
[e = . . *U _ppc 0 1 . . *U _ppc 0 5 ]
"619
[e :U 119 ]
"620
[; ;isr.c: 619: }

[; ;isr.c: 620: }

[e $U 122  ]
"621
[e :U 116 ]
[; ;isr.c: 621: else

[; ;isr.c: 622: {

[; ;isr.c: 623: if(ppc->msg.speed_command<(ppc->msg.speed_profile-1))

"623
[e $ ! < -> . . *U _ppc 0 6 `i - -> . . *U _ppc 0 7 `i -> 1 `i 123  ]
[; ;isr.c: 624: {

[; ;isr.c: 625: ppc->msg.count++;

"625
[e ++ . . *U _ppc 0 21 -> -> 1 `i `uc ]
[; ;isr.c: 626: if(ppc->msg.count>32)

"626
[e $ ! > -> . . *U _ppc 0 21 `i -> 32 `i 124  ]
[; ;isr.c: 627: {

[; ;isr.c: 628: ppc->msg.count=0;

"628
[e = . . *U _ppc 0 21 -> -> 0 `i `uc ]
[; ;isr.c: 629: ppc->msg.speed_profile--;

"629
[e -- . . *U _ppc 0 7 -> -> 1 `i `uc ]
"630
[e :U 124 ]
"632
[; ;isr.c: 630: }

[; ;isr.c: 632: }

[e $U 125  ]
"633
[e :U 123 ]
[; ;isr.c: 633: else

[; ;isr.c: 634: ppc->msg.speed_profile=ppc->msg.speed_command;

"634
[e = . . *U _ppc 0 7 . . *U _ppc 0 6 ]
[e :U 125 ]
"635
[e :U 122 ]
"637
[; ;isr.c: 635: }

[; ;isr.c: 637: }

[e $U 126  ]
"638
[e :U 115 ]
[; ;isr.c: 638: else

[; ;isr.c: 639: {

[; ;isr.c: 640: ppc->msg.count=0;

"640
[e = . . *U _ppc 0 21 -> -> 0 `i `uc ]
[; ;isr.c: 641: ppc->msg.OV_RATEDT_ERR=adr->msg.bus_current-ppc->msg.RATED_CURRENT;

"641
[e = . . *U _ppc 0 17 -> - -> . . *U _adr 0 1 `i -> . . *U _ppc 0 13 `i `uc ]
[; ;isr.c: 642: adr->msg.bus_current=ppc->msg.RATED_CURRENT;

"642
[e = . . *U _adr 0 1 . . *U _ppc 0 13 ]
[; ;isr.c: 643: if(ppc->msg.OV_RATEDT_ERR>6)

"643
[e $ ! > -> . . *U _ppc 0 17 `i -> 6 `i 127  ]
[; ;isr.c: 644: {

[; ;isr.c: 645: ppc->msg.speed_profile=ppc->msg.speed_profile>3? ppc->msg.speed_profile-3:0;

"645
[e = . . *U _ppc 0 7 -> ? > -> . . *U _ppc 0 7 `i -> 3 `i : - -> . . *U _ppc 0 7 `i -> 3 `i -> 0 `i `uc ]
[; ;isr.c: 646: ppc->msg.countgtr=0;

"646
[e = . . *U _ppc 0 32 -> -> 0 `i `uc ]
"647
[; ;isr.c: 647: }

[e $U 128  ]
"648
[e :U 127 ]
[; ;isr.c: 648: else

[; ;isr.c: 649: {

[; ;isr.c: 650: ppc->msg.countgtr++;

"650
[e ++ . . *U _ppc 0 32 -> -> 1 `i `uc ]
[; ;isr.c: 652: { ppc->msg.speed_profile=ppc->msg.speed_profile>0? ppc->msg.speed_profile-1:0;

"652
[e = . . *U _ppc 0 7 -> ? > -> . . *U _ppc 0 7 `i -> 0 `i : - -> . . *U _ppc 0 7 `i -> 1 `i -> 0 `i `uc ]
[; ;isr.c: 653: ppc->msg.countgtr=0;

"653
[e = . . *U _ppc 0 32 -> -> 0 `i `uc ]
"655
[e :U 128 ]
"656
[e :U 126 ]
"657
[e :U 112 ]
[; ;isr.c: 654: }

[; ;isr.c: 655: }

[; ;isr.c: 656: }

[; ;isr.c: 657: }

[; ;isr.c: 659: if(adr->msg.bus_current<ppc->msg.LSPWM_SWITCH_I)

"659
[e $ ! < -> . . *U _adr 0 1 `i -> . . *U _ppc 0 11 `i 129  ]
[; ;isr.c: 660: {

[; ;isr.c: 661: ppc->msg.pwmena&=~2;

"661
[e =& . . *U _ppc 0 0 -> ~ -> 2 `i `uc ]
"662
[e :U 129 ]
[; ;isr.c: 662: }

[; ;isr.c: 665: ppc->msg.duty_cycle=ppc->msg.speed_profile;

"665
[e = . . *U _ppc 0 2 . . *U _ppc 0 7 ]
[; ;isr.c: 666: ppc->msg.pwmena|=1;

"666
[e =| . . *U _ppc 0 0 -> -> 1 `i `uc ]
[; ;isr.c: 667: PWM_WritePulseWidth(ppc->msg.duty_cycle);

"667
[e ( _PWM_WritePulseWidth (1
 . . *U _ppc 0 2 ]
[; ;isr.c: 668: if(ppc->msg.duty_cycle==0xff) ppc->msg.pwmena=0;

"668
[e $ ! == -> . . *U _ppc 0 2 `i -> 255 `i 130  ]
[e = . . *U _ppc 0 0 -> -> 0 `i `uc ]
[e :U 130 ]
[; ;isr.c: 669: motor_ctrlout(ppc,st); }

"669
[e ( _motor_ctrlout (2
 , _ppc _st ]
[e :U 104 ]
"670
[e :U 102 ]
[e :U 86 ]
[e :U 84 ]
[e :U 82 ]
"671
[; ;isr.c: 670: }

[; ;isr.c: 671: }

[e $U 131  ]
"672
[e :U 77 ]
[; ;isr.c: 672: else if(adr->msg.samplechannel==2)

[e $ ! == -> . . *U _adr 0 0 `i -> 2 `i 132  ]
[; ;isr.c: 673: {

[; ;isr.c: 674: while(ADC_CR0&(0x02)){};

"674
[e $U 133  ]
[e :U 134 ]
[e :U 133 ]
[e $ != & -> _ADC_CR0 `i -> 2 `i -> 0 `i 134  ]
[e :U 135 ]
[; ;isr.c: 675: adr->msg.battery_voltage=(adr->msg.battery_voltage+ADC_DL)>>1;

"675
[e = . . *U _adr 0 2 -> >> + -> . . *U _adr 0 2 `i -> _ADC_DL `i -> 1 `i `uc ]
"676
[; ;isr.c: 676: }

[e $U 136  ]
"677
[e :U 132 ]
[; ;isr.c: 677: else if(adr->msg.samplechannel==4)

[e $ ! == -> . . *U _adr 0 0 `i -> 4 `i 137  ]
[; ;isr.c: 678: {

[; ;isr.c: 679: while(ADC_CR0&(0x02)){};

"679
[e $U 138  ]
[e :U 139 ]
[e :U 138 ]
[e $ != & -> _ADC_CR0 `i -> 2 `i -> 0 `i 139  ]
[e :U 140 ]
[; ;isr.c: 680: adr->msg.ts_voltage=(adr->msg.ts_voltage+ADC_DL)>>1;

"680
[e = . . *U _adr 0 3 -> >> + -> . . *U _adr 0 3 `i -> _ADC_DL `i -> 1 `i `uc ]
"681
[; ;isr.c: 681: }

[e $U 141  ]
"682
[e :U 137 ]
[; ;isr.c: 682: else if(adr->msg.samplechannel==1)

[e $ ! == -> . . *U _adr 0 0 `i -> 1 `i 142  ]
[; ;isr.c: 683: {

[; ;isr.c: 684: while(ADC_CR0&(0x02)){};

"684
[e $U 143 

⌨️ 快捷键说明

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