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

📄 isr.p1

📁 PSOC 电动自行车代码 器件采用CYPRESS新电动自行车器件CY8C245
💻 P1
📖 第 1 页 / 共 5 页
字号:
[; ;lib\PWM.h: 86: BYTE PWM_OUTPUT_REG;

[; ;lib\PWM.h: 88: BYTE PWM_INT_REG;

[; ;lib\SAR8.h: 91: extern void SAR8_Start(void);

[; ;lib\SAR8.h: 92: extern void SAR8_Stop(void);

[; ;lib\SAR8.h: 93: extern void SAR8_EnableInt(void);

[; ;lib\SAR8.h: 94: extern void SAR8_DisableInt(void);

[; ;lib\SAR8.h: 95: extern void SAR8_Trigger(void);

[; ;lib\SAR8.h: 96: extern BYTE SAR8_fIsDataAvailable(void);

[; ;lib\SAR8.h: 97: extern BYTE SAR8_bGetData(void);

[; ;lib\SAR8.h: 98: extern void SAR8_SelectADCChannel(BYTE bChannel);

[; ;lib\SAR8.h: 99: extern void SAR8_AutoAlign(BYTE bAlignMode);

[; ;lib\SAR8.h: 100: extern void SAR8_SetAlignPath(BYTE bAlignPath);

[; ;lib\SAR8.h: 101: extern void SAR8_SetHighAlignSrc(BYTE bAlignSrc);

[; ;lib\SAR8.h: 102: extern void SAR8_SetLowAlignSrc(BYTE bAlignSrc);

[; ;lib\SAR8.h: 103: extern void SAR8_SetCmpL(BYTE bValue);

[; ;lib\SAR8.h: 104: extern void SAR8_SetCmpH(BYTE bValue);

[; ;lib\SAR8.h: 105: extern void SAR8_SetScale(BYTE bScaleMode);

[; ;lib\SAR8.h: 106: extern void SAR8_SetRunMode(BYTE bRunMode);

[; ;lib\SAR8.h: 112: BYTE SAR8_INT_REG;

[; ;lib\SAR8.h: 115: BYTE SAR8_CONTROL_0_REG;

[; ;lib\SAR8.h: 118: BYTE SAR8_CONTROL_1_REG;

[; ;lib\SAR8.h: 121: BYTE SAR8_CONTROL_2_REG;

[; ;lib\SAR8.h: 124: BYTE SAR8_TRIGGER_SRC_REG;

[; ;lib\SAR8.h: 127: BYTE SAR8_COMPARE_LO_REG;

[; ;lib\SAR8.h: 130: BYTE SAR8_COMPARE_HI_REG;

[; ;lib\SAR8.h: 133: BYTE SAR8_DATA_LO_REG;

"40 ./i2c.h
[s S11 `uc -> 10 `i ]
[n S11 . b ]
[v _TYPE_I2CS_STRUCT `S11 1 t ]
[; ;i2c.h: 35: typedef struct

[; ;i2c.h: 36: {

[; ;i2c.h: 38: BYTE b[10];

[; ;i2c.h: 40: }TYPE_I2CS_STRUCT;

[; ;i2c.h: 42: extern TYPE_I2CS_STRUCT I2CSBuff;

[; ;i2c.h: 45: void vI2CInit(void);

[; ;isr.c: 9: unsigned char get_motor_position(unsigned char count);

[; ;isr.c: 10: void hall_position_check(PROC_PROCESS *ppc,SYSSTAT *st);

"14 ./isr.c
[v _get_motor_position `(uc 1 ef1`uc ]
{
[; ;isr.c: 13: unsigned char get_motor_position(unsigned char count)

[; ;isr.c: 14: {

[e :U _get_motor_position ]
[v _count `uc 1 r1 ]
[f ]
"15
[v _i `ui 1 a ]
[v _j `ui 1 a ]
[v _k `ui 1 a ]
[; ;isr.c: 15: unsigned i,j,k;

[; ;isr.c: 16: k=0;

"16
[e = _k -> -> 0 `i `ui ]
[; ;isr.c: 17: i=count;

"17
[e = _i -> _count `ui ]
[; ;isr.c: 18: while(i)

"18
[e $U 13  ]
[e :U 14 ]
[; ;isr.c: 19: {

[; ;isr.c: 20: j=(PRT2DR&0x7);

"20
[e = _j -> & -> _PRT2DR `i -> 7 `i `ui ]
[; ;isr.c: 21: if(j==k)

"21
[e $ ! == _j _k 16  ]
[; ;isr.c: 22: i--;

"22
[e -- _i -> -> 1 `i `ui ]
[e $U 17  ]
"23
[e :U 16 ]
[; ;isr.c: 23: else

[; ;isr.c: 24: {

[; ;isr.c: 25: k=j;

"25
[e = _k _j ]
[; ;isr.c: 26: i=count;

"26
[e = _i -> _count `ui ]
"27
[e :U 17 ]
"28
[e :U 13 ]
"18
[e $ != _i -> -> 0 `i `ui 14  ]
[e :U 15 ]
[; ;isr.c: 27: }

[; ;isr.c: 28: }

[; ;isr.c: 29: return(k);

"29
[e ) -> _k `uc ]
[e $UE 12  ]
"30
[; ;isr.c: 30: }

[e :UE 12 ]
}
"33
[v _hall_position_check `(v 1 ef2`*S5`*S3 ]
{
[; ;isr.c: 32: void hall_position_check(PROC_PROCESS *ppc,SYSSTAT *st)

[; ;isr.c: 33: {

[e :U _hall_position_check ]
[v _ppc `*S5 1 r1 ]
[v _st `*S3 1 r2 ]
[f ]
"34
[v _i `uc 1 a ]
[v _j `uc 1 a ]
[v _k `uc 1 a ]
[v _l `uc 1 a ]
"35
[v _temp_pos `uc 1 a ]
[; ;isr.c: 34: unsigned char i,j,k,l;

[; ;isr.c: 35: unsigned char temp_pos;

[; ;isr.c: 36: temp_pos=get_motor_position(6);

"36
[e = _temp_pos ( _get_motor_position (1
 -> -> 6 `i `uc ]
[; ;isr.c: 37: if(temp_pos!=ppc->msg.position_prev)

"37
[e $ ! != -> _temp_pos `i -> . . *U _ppc 0 3 `i 19  ]
[; ;isr.c: 38: { i=temp_pos;

"38
[e = _i _temp_pos ]
[; ;isr.c: 39: temp_pos=get_motor_position(6);

"39
[e = _temp_pos ( _get_motor_position (1
 -> -> 6 `i `uc ]
[; ;isr.c: 40: if(temp_pos!=i)

"40
[e $ ! != -> _temp_pos `i -> _i `i 20  ]
[; ;isr.c: 41: { if(temp_pos!=ppc->msg.position_prev)

"41
[e $ ! != -> _temp_pos `i -> . . *U _ppc 0 3 `i 21  ]
[; ;isr.c: 42: {

[; ;isr.c: 43: i=temp_pos;

"43
[e = _i _temp_pos ]
[; ;isr.c: 44: temp_pos=get_motor_position(6);

"44
[e = _temp_pos ( _get_motor_position (1
 -> -> 6 `i `uc ]
[; ;isr.c: 45: if(temp_pos==i)

"45
[e $ ! == -> _temp_pos `i -> _i `i 22  ]
[; ;isr.c: 46: {

[; ;isr.c: 47: ppc->msg.position_prev=temp_pos;

"47
[e = . . *U _ppc 0 3 _temp_pos ]
[; ;isr.c: 48: st->msg.st2|=1;

"48
[e =| . . *U _st 0 2 -> -> 1 `i `uc ]
"49
[e :U 22 ]
"50
[e :U 21 ]
"51
[; ;isr.c: 49: }

[; ;isr.c: 50: }

[; ;isr.c: 51: }

[e $U 23  ]
"52
[e :U 20 ]
[; ;isr.c: 52: else

[; ;isr.c: 53: { ppc->msg.position_prev=temp_pos;

"53
[e = . . *U _ppc 0 3 _temp_pos ]
[; ;isr.c: 54: st->msg.st2|=1;

"54
[e =| . . *U _st 0 2 -> -> 1 `i `uc ]
"55
[e :U 23 ]
"56
[e :U 19 ]
"57
[; ;isr.c: 55: }

[; ;isr.c: 56: }

[; ;isr.c: 57: }

[e :UE 18 ]
}
"60
[v _set_next_ctrlseq `(v 1 ef2`*S3`*S5 ]
{
[; ;isr.c: 59: void set_next_ctrlseq(SYSSTAT *st,PROC_PROCESS *ppc)

[; ;isr.c: 60: {

[e :U _set_next_ctrlseq ]
[v _st `*S3 1 r1 ]
[v _ppc `*S5 1 r2 ]
[f ]
[; ;isr.c: 61: if((st->msg.st2&0x40))

"61
[e $ ! != & -> . . *U _st 0 2 `i -> 64 `i -> 0 `i 25  ]
[; ;isr.c: 62: {

[; ;isr.c: 63: if(!(st->msg.st0&4))

"63
[e $ ! ! != & -> . . *U _st 0 0 `i -> 4 `i -> 0 `i 26  ]
[; ;isr.c: 64: {

[; ;isr.c: 65: switch(ppc->msg.position_prev)

"65
[e $U 28  ]
[; ;isr.c: 66: {

[; ;isr.c: 67: case 0x1:{

"67
[e :U 29 ]
[; ;isr.c: 68: ppc->msg.ctrlout_set=0x40+0x08;

"68
[e = . . *U _ppc 0 5 -> + -> 64 `i -> 8 `i `uc ]
[; ;isr.c: 69: ppc->msg.position_next=0x5;

"69
[e = . . *U _ppc 0 4 -> -> 5 `i `uc ]
[; ;isr.c: 70: break;

"70
[e $U 27  ]
[; ;isr.c: 71: }

[; ;isr.c: 72: case 0x5:{

"72
[e :U 30 ]
[; ;isr.c: 73: ppc->msg.ctrlout_set=0x20+0x08;

"73
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 8 `i `uc ]
[; ;isr.c: 74: ppc->msg.position_next=0x4;

"74
[e = . . *U _ppc 0 4 -> -> 4 `i `uc ]
[; ;isr.c: 76: break;

"76
[e $U 27  ]
[; ;isr.c: 77: }

[; ;isr.c: 78: case 0x4:{

"78
[e :U 31 ]
[; ;isr.c: 79: ppc->msg.ctrlout_set=0x20+0x80;

"79
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 128 `i `uc ]
[; ;isr.c: 80: ppc->msg.position_next=0x6;

"80
[e = . . *U _ppc 0 4 -> -> 6 `i `uc ]
[; ;isr.c: 82: break;

"82
[e $U 27  ]
[; ;isr.c: 83: }

[; ;isr.c: 84: case 0x6:{

"84
[e :U 32 ]
[; ;isr.c: 85: ppc->msg.ctrlout_set=0x04+0x80;

"85
[e = . . *U _ppc 0 5 -> + -> 4 `i -> 128 `i `uc ]
[; ;isr.c: 86: ppc->msg.position_next=0x2;

"86
[e = . . *U _ppc 0 4 -> -> 2 `i `uc ]
[; ;isr.c: 88: break;

"88
[e $U 27  ]
[; ;isr.c: 89: }

[; ;isr.c: 90: case 0x2:{

"90
[e :U 33 ]
[; ;isr.c: 91: ppc->msg.ctrlout_set=0x04+0x10;

"91
[e = . . *U _ppc 0 5 -> + -> 4 `i -> 16 `i `uc ]
[; ;isr.c: 92: ppc->msg.position_next=0x3;

"92
[e = . . *U _ppc 0 4 -> -> 3 `i `uc ]
[; ;isr.c: 93: break;

"93
[e $U 27  ]
[; ;isr.c: 94: }

[; ;isr.c: 95: default:{

"95
[e :U 34 ]
[; ;isr.c: 96: ppc->msg.ctrlout_set=0x40+0x10;

"96
[e = . . *U _ppc 0 5 -> + -> 64 `i -> 16 `i `uc ]
[; ;isr.c: 97: ppc->msg.position_next=0x1;

"97
[e = . . *U _ppc 0 4 -> -> 1 `i `uc ]
[; ;isr.c: 98: break;

"98
[e $U 27  ]
"100
[; ;isr.c: 99: }

[; ;isr.c: 100: }

[e $U 27  ]
"65
[e :U 28 ]
[e [\ . . *U _ppc 0 3 , $ -> -> 1 `i `uc 29
 , $ -> -> 5 `i `uc 30
 , $ -> -> 4 `i `uc 31
 , $ -> -> 6 `i `uc 32
 , $ -> -> 2 `i `uc 33
 34 ]
"100
[e :U 27 ]
"101
[; ;isr.c: 101: }

[e $U 35  ]
"102
[e :U 26 ]
[; ;isr.c: 102: else

[; ;isr.c: 103: {

[; ;isr.c: 104: switch(ppc->msg.position_prev)

"104
[e $U 37  ]
[; ;isr.c: 105: {

[; ;isr.c: 106: case 0x1:{

"106
[e :U 38 ]
[; ;isr.c: 107: ppc->msg.position_next=0x3;

"107
[e = . . *U _ppc 0 4 -> -> 3 `i `uc ]
[; ;isr.c: 108: ppc->msg.ctrlout_set=0x40+0x10;

"108
[e = . . *U _ppc 0 5 -> + -> 64 `i -> 16 `i `uc ]
[; ;isr.c: 109: break;

"109
[e $U 36  ]
[; ;isr.c: 110: }

[; ;isr.c: 111: case 0x0:{

"111
[e :U 39 ]
[; ;isr.c: 112: ppc->msg.ctrlout_set=0x04+0x10;

"112
[e = . . *U _ppc 0 5 -> + -> 4 `i -> 16 `i `uc ]
[; ;isr.c: 113: ppc->msg.position_next=0x1;

"113
[e = . . *U _ppc 0 4 -> -> 1 `i `uc ]
[; ;isr.c: 115: break;

"115
[e $U 36  ]
[; ;isr.c: 116: }

[; ;isr.c: 117: case 0x4:{

"117
[e :U 40 ]
[; ;isr.c: 118: ppc->msg.ctrlout_set=0x04+0x80;

"118
[e = . . *U _ppc 0 5 -> + -> 4 `i -> 128 `i `uc ]
[; ;isr.c: 119: ppc->msg.position_next=0x0;

"119
[e = . . *U _ppc 0 4 -> -> 0 `i `uc ]
[; ;isr.c: 121: break;

"121
[e $U 36  ]
[; ;isr.c: 122: }

[; ;isr.c: 123: case 0x6:{

"123
[e :U 41 ]
[; ;isr.c: 124: ppc->msg.ctrlout_set=0x20+0x80;

"124
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 128 `i `uc ]
[; ;isr.c: 125: ppc->msg.position_next=0x4;

"125
[e = . . *U _ppc 0 4 -> -> 4 `i `uc ]
[; ;isr.c: 127: break;

"127
[e $U 36  ]
[; ;isr.c: 128: }

[; ;isr.c: 129: case 0x7:{

"129
[e :U 42 ]
[; ;isr.c: 130: ppc->msg.ctrlout_set=0x20+0x08;

"130
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 8 `i `uc ]
[; ;isr.c: 131: ppc->msg.position_next=0x6;

"131
[e = . . *U _ppc 0 4 -> -> 6 `i `uc ]
[; ;isr.c: 133: break;

"133
[e $U 36  ]
[; ;isr.c: 134: }

[; ;isr.c: 135: default:{

"135
[e :U 43 ]
[; ;isr.c: 136: ppc->msg.ctrlout_set=0x40+0x08;

"136
[e = . . *U _ppc 0 5 -> + -> 64 `i -> 8 `i `uc ]
[; ;isr.c: 137: ppc->msg.position_next=0x7;

"137
[e = . . *U _ppc 0 4 -> -> 7 `i `uc ]
[; ;isr.c: 139: break;

"139
[e $U 36  ]
"141
[; ;isr.c: 140: }

[; ;isr.c: 141: }

[e $U 36  ]
"104
[e :U 37 ]
[e [\ . . *U _ppc 0 3 , $ -> -> 1 `i `uc 38
 , $ -> -> 0 `i `uc 39
 , $ -> -> 4 `i `uc 40
 , $ -> -> 6 `i `uc 41
 , $ -> -> 7 `i `uc 42
 43 ]
"141
[e :U 36 ]
"142
[e :U 35 ]
"143
[; ;isr.c: 142: }

[; ;isr.c: 143: }

[e $U 44  ]
"144
[e :U 25 ]
[; ;isr.c: 144: else

[; ;isr.c: 145: {

[; ;isr.c: 146: if(!(st->msg.st0&4))

"146
[e $ ! ! != & -> . . *U _st 0 0 `i -> 4 `i -> 0 `i 45  ]
[; ;isr.c: 147: {

[; ;isr.c: 148: switch(ppc->msg.position_prev)

"148
[e $U 47  ]
[; ;isr.c: 149: {

[; ;isr.c: 150: case 0x2:{

"150
[e :U 48 ]
[; ;isr.c: 151: ppc->msg.position_next=0x3;

"151
[e = . . *U _ppc 0 4 -> -> 3 `i `uc ]
[; ;isr.c: 152: ppc->msg.ctrlout_set=0x04+0x80;

"152
[e = . . *U _ppc 0 5 -> + -> 4 `i -> 128 `i `uc ]
[; ;isr.c: 153: break;

"153
[e $U 46  ]
[; ;isr.c: 154: }

[; ;isr.c: 155: case 0x6:{

"155
[e :U 49 ]
[; ;isr.c: 156: ppc->msg.ctrlout_set=0x20+0x80;

"156
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 128 `i `uc ]
[; ;isr.c: 157: ppc->msg.position_next=0x2;

"157
[e = . . *U _ppc 0 4 -> -> 2 `i `uc ]
[; ;isr.c: 158: break;

"158
[e $U 46  ]
[; ;isr.c: 159: }

[; ;isr.c: 160: case 0x4:{

"160
[e :U 50 ]
[; ;isr.c: 161: ppc->msg.ctrlout_set=0x20+0x08;

"161
[e = . . *U _ppc 0 5 -> + -> 32 `i -> 8 `i `uc ]
[; ;isr.c: 162: ppc->msg.position_next=0x6;

"162
[e = . . *U _ppc 0 4 -> -> 6 `i `uc ]
[; ;isr.c: 164: break;

"164
[e $U 46  ]
[; ;isr.c: 165: }

[; ;isr.c: 166: case 0x5:{

"166
[e :U 51 ]
[; ;isr.c: 167: ppc->msg.ctrlout_set=0x40+0x08;

"167
[e = . . *U _ppc 0 5 -> + -> 64 `i -> 8 `i `uc ]
[; ;isr.c: 168: ppc->msg.position_next=0x4;

"168
[e = . . *U _ppc 0 4 -> -> 4 `i `uc ]
[; ;isr.c: 170: break;

"170
[e $U 46  ]
[; ;isr.c: 171: }

⌨️ 快捷键说明

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