![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
Command.c@213:9953db9543d6, 2017-07-26 (annotated)
- Committer:
- Kovalev_D
- Date:
- Wed Jul 26 13:24:39 2017 +0000
- Revision:
- 213:9953db9543d6
- Parent:
- 211:ac8251b067d2
- Child:
- 214:4c70e452c491
work
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 0:8ad47e2b6f00 | 1 | #include "stdlib.h" |
Kovalev_D | 197:7a05523bf588 | 2 | //#include "math.h" |
igor_v | 0:8ad47e2b6f00 | 3 | #include "LPC17xx.h" |
igor_v | 0:8ad47e2b6f00 | 4 | #include "Global.h" |
Kovalev_D | 106:250ddd8629c6 | 5 | int tempNH,tempNL; |
igor_v | 0:8ad47e2b6f00 | 6 | unsigned int Rate_Flag; |
igor_v | 0:8ad47e2b6f00 | 7 | unsigned int CountBuFFIn; |
igor_v | 21:bc8c1cec3da6 | 8 | unsigned int N=0,CRC_N; |
igor_v | 21:bc8c1cec3da6 | 9 | unsigned int Param1=0; |
igor_v | 21:bc8c1cec3da6 | 10 | unsigned int Param2=0; |
igor_v | 21:bc8c1cec3da6 | 11 | unsigned int Param3=0; |
igor_v | 21:bc8c1cec3da6 | 12 | unsigned int Param4=0; |
Kovalev_D | 209:224e7331a061 | 13 | ///unsigned int Consol=123; |
Kovalev_D | 121:bbae560cdd43 | 14 | unsigned int TempParam=1; |
Kovalev_D | 124:9ae09249f842 | 15 | unsigned int CountParam=0; |
Kovalev_D | 209:224e7331a061 | 16 | unsigned int OldCuruAngle; |
Kovalev_D | 209:224e7331a061 | 17 | unsigned int OldCaunPlus=0; |
Kovalev_D | 209:224e7331a061 | 18 | unsigned int OldCaunMin=0; |
Kovalev_D | 211:ac8251b067d2 | 19 | unsigned int OutDeltaPS; |
Kovalev_D | 211:ac8251b067d2 | 20 | int IntOutDeltaPS; |
Kovalev_D | 209:224e7331a061 | 21 | int ttemp,temp5=1; |
Kovalev_D | 197:7a05523bf588 | 22 | int OLDDAC=0; |
Kovalev_D | 205:775d54fdf646 | 23 | int rr = 123; |
Kovalev_D | 209:224e7331a061 | 24 | unsigned int pDestT; |
Kovalev_D | 136:19b9e6abb86f | 25 | GyroParam *Flash; |
Kovalev_D | 211:ac8251b067d2 | 26 | //int q; |
Kovalev_D | 147:1aed74f19a8f | 27 | ///////////////flah and boot/////////// |
Kovalev_D | 147:1aed74f19a8f | 28 | void GoBoot(void) |
Kovalev_D | 147:1aed74f19a8f | 29 | { |
Kovalev_D | 147:1aed74f19a8f | 30 | /* Prepare Sectors to be flashed */ |
Kovalev_D | 147:1aed74f19a8f | 31 | NVIC_DisableIRQ(TIMER1_IRQn); |
Kovalev_D | 147:1aed74f19a8f | 32 | NVIC_DisableIRQ(TIMER2_IRQn); |
Kovalev_D | 147:1aed74f19a8f | 33 | NVIC_DisableIRQ(TIMER3_IRQn); |
Kovalev_D | 147:1aed74f19a8f | 34 | NVIC_DisableIRQ(EINT3_IRQn); |
Kovalev_D | 147:1aed74f19a8f | 35 | SystemInitDef(); |
Kovalev_D | 147:1aed74f19a8f | 36 | vIAP_ReinvokeISP(); |
Kovalev_D | 147:1aed74f19a8f | 37 | } |
Kovalev_D | 181:0b022246c43c | 38 | |
Kovalev_D | 181:0b022246c43c | 39 | void DropDelay(void) |
Kovalev_D | 181:0b022246c43c | 40 | { |
Kovalev_D | 181:0b022246c43c | 41 | Gyro.DropDelayGLD = DropDelayGLD_0; |
Kovalev_D | 194:8f3cb37a5541 | 42 | switch(Gyro.My_Addres) { |
Kovalev_D | 194:8f3cb37a5541 | 43 | case 1: Gyro.DropDelayGLD = DropDelayGLD_1; break; |
Kovalev_D | 194:8f3cb37a5541 | 44 | case 2: Gyro.DropDelayGLD = DropDelayGLD_2; break; |
Kovalev_D | 194:8f3cb37a5541 | 45 | case 3: Gyro.DropDelayGLD = DropDelayGLD_3; break; |
Kovalev_D | 194:8f3cb37a5541 | 46 | } |
Kovalev_D | 194:8f3cb37a5541 | 47 | |
Kovalev_D | 181:0b022246c43c | 48 | } |
Kovalev_D | 205:775d54fdf646 | 49 | /* |
Kovalev_D | 147:1aed74f19a8f | 50 | void WriteFlash(void) |
Kovalev_D | 147:1aed74f19a8f | 51 | { |
Kovalev_D | 205:775d54fdf646 | 52 | |
Kovalev_D | 147:1aed74f19a8f | 53 | SystemInitDef(); |
Kovalev_D | 147:1aed74f19a8f | 54 | WriteCon("\r\n Start Prepare Sectors"); |
Kovalev_D | 205:775d54fdf646 | 55 | if(u32IAP_PrepareSectors(5, 5) == IAP_STA_CMD_SUCCESS) |
Kovalev_D | 147:1aed74f19a8f | 56 | { |
Kovalev_D | 147:1aed74f19a8f | 57 | WriteCon("\r\nPrepare Sectors OK"); |
Kovalev_D | 147:1aed74f19a8f | 58 | WriteCon("\r\n Start Erase"); |
Kovalev_D | 147:1aed74f19a8f | 59 | u32IAP_EraseSectors(IMG_START_SECTOR, IMG_END_SECTOR); |
Kovalev_D | 147:1aed74f19a8f | 60 | WriteCon("\r\n AND Erase"); |
Kovalev_D | 147:1aed74f19a8f | 61 | } |
Kovalev_D | 205:775d54fdf646 | 62 | else WriteCon("\r\nPrepare Sectors ERROR "); |
Kovalev_D | 147:1aed74f19a8f | 63 | SystemInit1(); |
Kovalev_D | 147:1aed74f19a8f | 64 | Gyro.FlashMod = 0; |
Kovalev_D | 169:140743e3bb96 | 65 | } |
Kovalev_D | 205:775d54fdf646 | 66 | */ |
Kovalev_D | 205:775d54fdf646 | 67 | void EraseFlash(void) |
Kovalev_D | 205:775d54fdf646 | 68 | { |
Kovalev_D | 207:d1ce992f5d17 | 69 | rr = u32IAP_PrepareSectors(19, 21); |
Kovalev_D | 209:224e7331a061 | 70 | /*sprintf((Time)," dffddfd <%07d> ",rr); |
Kovalev_D | 209:224e7331a061 | 71 | WriteCon(Time);*/ |
Kovalev_D | 207:d1ce992f5d17 | 72 | rr = u32IAP_EraseSectors(19, 21); |
Kovalev_D | 209:224e7331a061 | 73 | /* sprintf((Time)," dffddfd <%07d> ",rr); |
Kovalev_D | 209:224e7331a061 | 74 | WriteCon(Time);*/ |
Kovalev_D | 205:775d54fdf646 | 75 | } |
Kovalev_D | 205:775d54fdf646 | 76 | |
Kovalev_D | 205:775d54fdf646 | 77 | void WriteFlash(void) |
Kovalev_D | 205:775d54fdf646 | 78 | |
Kovalev_D | 208:19150d2b528f | 79 | { |
Kovalev_D | 208:19150d2b528f | 80 | Gyro.FlashMod = 0; |
Kovalev_D | 205:775d54fdf646 | 81 | |
Kovalev_D | 205:775d54fdf646 | 82 | //SystemInitDef(); |
Kovalev_D | 205:775d54fdf646 | 83 | NVIC_DisableIRQ(TIMER1_IRQn); |
Kovalev_D | 205:775d54fdf646 | 84 | NVIC_DisableIRQ(TIMER2_IRQn); |
Kovalev_D | 205:775d54fdf646 | 85 | NVIC_DisableIRQ(TIMER3_IRQn); |
Kovalev_D | 205:775d54fdf646 | 86 | NVIC_DisableIRQ(EINT3_IRQn); |
Kovalev_D | 205:775d54fdf646 | 87 | |
Kovalev_D | 208:19150d2b528f | 88 | // unsigned int start_address = (unsigned int) & GyroP; |
Kovalev_D | 207:d1ce992f5d17 | 89 | rr = u32IAP_PrepareSectors(19, 21); |
Kovalev_D | 208:19150d2b528f | 90 | rr = u32IAP_EraseSectors (19, 21); |
Kovalev_D | 207:d1ce992f5d17 | 91 | rr = u32IAP_PrepareSectors(19, 21); |
Kovalev_D | 208:19150d2b528f | 92 | rr = u32IAP_CopyRAMToFlash(0x030000, &GyroP , 1024); |
Kovalev_D | 205:775d54fdf646 | 93 | // SystemInit1(); // Инициализация контроллера: установка тактовых частот |
Kovalev_D | 205:775d54fdf646 | 94 | //SystemCoreClockUpdate1(); // расчет тактовой частоты процессора перед инициализацией UART - 103MHz |
Kovalev_D | 205:775d54fdf646 | 95 | |
Kovalev_D | 205:775d54fdf646 | 96 | NVIC_EnableIRQ(TIMER1_IRQn); |
Kovalev_D | 205:775d54fdf646 | 97 | NVIC_EnableIRQ(TIMER2_IRQn); |
Kovalev_D | 205:775d54fdf646 | 98 | NVIC_EnableIRQ(TIMER3_IRQn); |
Kovalev_D | 205:775d54fdf646 | 99 | NVIC_EnableIRQ(EINT3_IRQn); |
Kovalev_D | 208:19150d2b528f | 100 | //SystemCoreClockUpdate1(); |
Kovalev_D | 205:775d54fdf646 | 101 | |
Kovalev_D | 205:775d54fdf646 | 102 | } |
Kovalev_D | 136:19b9e6abb86f | 103 | void ReadFlash ( void) |
Kovalev_D | 136:19b9e6abb86f | 104 | { |
Kovalev_D | 205:775d54fdf646 | 105 | NVIC_DisableIRQ(TIMER1_IRQn); |
Kovalev_D | 205:775d54fdf646 | 106 | NVIC_DisableIRQ(TIMER2_IRQn); |
Kovalev_D | 205:775d54fdf646 | 107 | NVIC_DisableIRQ(TIMER3_IRQn); |
Kovalev_D | 205:775d54fdf646 | 108 | NVIC_DisableIRQ(EINT3_IRQn); |
Kovalev_D | 147:1aed74f19a8f | 109 | Gyro.FlashMod = 0; |
Kovalev_D | 136:19b9e6abb86f | 110 | WriteCon("\r\n Pirivet Flash"); |
Kovalev_D | 205:775d54fdf646 | 111 | |
Kovalev_D | 207:d1ce992f5d17 | 112 | pDestT= (unsigned int) (0x030000); |
Kovalev_D | 136:19b9e6abb86f | 113 | Flash = (GyroParam*) pDestT; |
Kovalev_D | 136:19b9e6abb86f | 114 | GyroP = *(Flash); |
Kovalev_D | 205:775d54fdf646 | 115 | |
Kovalev_D | 205:775d54fdf646 | 116 | NVIC_EnableIRQ(TIMER1_IRQn); |
Kovalev_D | 205:775d54fdf646 | 117 | NVIC_EnableIRQ(TIMER2_IRQn); |
Kovalev_D | 205:775d54fdf646 | 118 | NVIC_EnableIRQ(TIMER3_IRQn); |
Kovalev_D | 205:775d54fdf646 | 119 | NVIC_EnableIRQ(EINT3_IRQn); |
Kovalev_D | 208:19150d2b528f | 120 | } |
Kovalev_D | 169:140743e3bb96 | 121 | ///////////////end flah and boot/////////// |
Kovalev_D | 191:40028201ddad | 122 | void M_RateA(void) |
Kovalev_D | 193:a0fe8bfc97e4 | 123 | { |
Kovalev_D | 209:224e7331a061 | 124 | switch(Gyro.ModeOut) |
Kovalev_D | 209:224e7331a061 | 125 | { |
Kovalev_D | 211:ac8251b067d2 | 126 | case 1: if(Gyro.Rate1_Event ) CMD_Rate(); break; |
Kovalev_D | 211:ac8251b067d2 | 127 | case 2: if(Gyro.Reper_Event ) CMD_Rate2(); break; |
Kovalev_D | 211:ac8251b067d2 | 128 | case 3: if(Gyro.Event_500Hz ) CMD_Delta_PS(); break; |
Kovalev_D | 211:ac8251b067d2 | 129 | case 4: if(Gyro.EXT_Latch ) CMD_Delta_PS(); break; |
Kovalev_D | 211:ac8251b067d2 | 130 | case 5: if(Gyro.Event_500Hz ) CMD_Delta_Bins(); break; |
Kovalev_D | 211:ac8251b067d2 | 131 | case 6: if(Gyro.EXT_Latch ) CMD_B_Delta(); break; |
Kovalev_D | 211:ac8251b067d2 | 132 | case 7: if(Gyro.Event_500Hz ) CMD_B_Delta(); break; |
Kovalev_D | 211:ac8251b067d2 | 133 | case 8: if(Gyro.Rate3_Event ) CMD_Rate3(); break; |
Kovalev_D | 211:ac8251b067d2 | 134 | case 9: if(Gyro.Reper_Event ){ CMD_Rate2(); Gyro.ModeOut=0;} break; |
Kovalev_D | 196:f76dbc081e63 | 135 | } |
Kovalev_D | 191:40028201ddad | 136 | } |
Kovalev_D | 136:19b9e6abb86f | 137 | |
Kovalev_D | 129:406995a91322 | 138 | void CMD_M_Param_R(void) |
igor_v | 0:8ad47e2b6f00 | 139 | { |
Kovalev_D | 208:19150d2b528f | 140 | |
Kovalev_D | 208:19150d2b528f | 141 | unsigned int NP=0; |
Kovalev_D | 129:406995a91322 | 142 | unsigned int Param; |
Kovalev_D | 208:19150d2b528f | 143 | |
Kovalev_D | 208:19150d2b528f | 144 | NP = BuffTemp[3]; |
Kovalev_D | 208:19150d2b528f | 145 | |
Kovalev_D | 209:224e7331a061 | 146 | for (int i=0;i<8;i++) |
Kovalev_D | 209:224e7331a061 | 147 | {BuffTemp[i]=0;} |
Kovalev_D | 208:19150d2b528f | 148 | |
Kovalev_D | 208:19150d2b528f | 149 | |
Kovalev_D | 129:406995a91322 | 150 | BuffTemp[0] = Gyro.SOC_Out; |
Kovalev_D | 129:406995a91322 | 151 | BuffTemp[1] = Gyro.My_Addres; |
Kovalev_D | 129:406995a91322 | 152 | |
Kovalev_D | 208:19150d2b528f | 153 | |
Kovalev_D | 209:224e7331a061 | 154 | /* sprintf((Time),"%d = %d \r\n",NP, GyroP.Array[NP]); |
Kovalev_D | 209:224e7331a061 | 155 | WriteCon(Time);*/ |
Kovalev_D | 129:406995a91322 | 156 | Param = GyroP.Array[NP]; |
Kovalev_D | 208:19150d2b528f | 157 | BuffTemp[2] =(GyroP.Array[NP] >> 8) & 0xff;//старший байт требуемого параметра |
Kovalev_D | 208:19150d2b528f | 158 | BuffTemp[3] =(GyroP.Array[NP] >> 0) & 0xff;//младший байт требуемого параметра |
Kovalev_D | 129:406995a91322 | 159 | |
Kovalev_D | 129:406995a91322 | 160 | Check(BuffTemp, 6); |
Kovalev_D | 129:406995a91322 | 161 | WriteConN (BuffTemp,6); |
Kovalev_D | 205:775d54fdf646 | 162 | /*sprintf((Time),"READ Param = <%07d> GyroP.Array[NP] = <%07d> NP= <%07d> Gyro.CaunPlus+Gyro.CaunMin-5000 <%07d> \r\n",Param, GyroP.Array[NP], NP, GyroP.Str.PLC_Lern); |
Kovalev_D | 205:775d54fdf646 | 163 | WriteCon(Time);*/ |
Kovalev_D | 208:19150d2b528f | 164 | NP=0; |
Kovalev_D | 129:406995a91322 | 165 | } |
Kovalev_D | 129:406995a91322 | 166 | void CMD_M_Param_W(void) |
Kovalev_D | 129:406995a91322 | 167 | { |
Kovalev_D | 208:19150d2b528f | 168 | unsigned int NP=0; |
Kovalev_D | 208:19150d2b528f | 169 | unsigned int Param,temp,flash; |
Kovalev_D | 129:406995a91322 | 170 | |
Kovalev_D | 129:406995a91322 | 171 | NP = BuffTemp[3]; |
Kovalev_D | 129:406995a91322 | 172 | Param = (BuffTemp[4]<<8); |
Kovalev_D | 129:406995a91322 | 173 | Param |= BuffTemp[5]; |
Kovalev_D | 129:406995a91322 | 174 | |
Kovalev_D | 208:19150d2b528f | 175 | GyroP.Array[NP] = Param; |
Kovalev_D | 208:19150d2b528f | 176 | flash=GyroP.Array[5]; |
Kovalev_D | 209:224e7331a061 | 177 | |
Kovalev_D | 208:19150d2b528f | 178 | switch(NP) |
Kovalev_D | 208:19150d2b528f | 179 | { |
Kovalev_D | 211:ac8251b067d2 | 180 | case 0: Gyro.My_Addres = GyroP.Str.My_Addres; break; |
Kovalev_D | 211:ac8251b067d2 | 181 | case 1: Gyro.HFO_ref = /*GyroP.Str.HFO_ref>>1;*/(unsigned int)(GyroP.Str.HFO_ref)*0.82; break; |
Kovalev_D | 211:ac8251b067d2 | 182 | case 2: Gyro.HFO_Gain = GyroP.Str.HFO_Gain; break; |
Kovalev_D | 211:ac8251b067d2 | 183 | case 3: if(Gyro.LG_Type) Gyro.HFO_Max=((int)(GyroP.Str.DAC_current_Work*0.67)-2000); |
Kovalev_D | 211:ac8251b067d2 | 184 | else Spi.DAC_A = ((((int)(GyroP.Str.DAC_current_Work+ 0x7fff)&0xffff)+22544)*0.65); break; |
Kovalev_D | 211:ac8251b067d2 | 185 | |
Kovalev_D | 211:ac8251b067d2 | 186 | case 4: if(Gyro.LG_Type) Gyro.HFO_Min=((int)(GyroP.Str.DAC_current_Start*0.67)-2000); break; |
Kovalev_D | 208:19150d2b528f | 187 | |
Kovalev_D | 209:224e7331a061 | 188 | case 7: Gyro.PLC_Phase = GyroP.Str.PLC_Phase; break; |
Kovalev_D | 209:224e7331a061 | 189 | case 8: Gyro.PLC_Gain = GyroP.Str.PLC_Gain; break; |
Kovalev_D | 209:224e7331a061 | 190 | case 12: Gyro.FrqPhase = GyroP.Str.FrqPhase; break; |
Kovalev_D | 209:224e7331a061 | 191 | case 13: Gyro.FrqChengSpeed = GyroP.Str.FrqChengSpeed; break; |
Kovalev_D | 209:224e7331a061 | 192 | |
Kovalev_D | 209:224e7331a061 | 193 | case 14: Gyro.FrqHZ = (7680000 / GyroP.Str.FrqHZ); |
Kovalev_D | 209:224e7331a061 | 194 | Gyro.Frq = (7680000 / GyroP.Str.FrqHZ)<<16; |
Kovalev_D | 208:19150d2b528f | 195 | break; |
Kovalev_D | 208:19150d2b528f | 196 | |
Kovalev_D | 209:224e7331a061 | 197 | case 15: Gyro.FrqHZmin = (7680000 / GyroP.Str.FrqHZmin)<<16; break; |
Kovalev_D | 209:224e7331a061 | 198 | case 16: Gyro.FrqHZmax = (7680000 / GyroP.Str.FrqHZmax)<<16; break; |
Kovalev_D | 208:19150d2b528f | 199 | |
Kovalev_D | 208:19150d2b528f | 200 | case 18: temp=((GyroP.Str.VB_Fdf_Hi<<16) | GyroP.Str.VB_Fdf_Lo); |
Kovalev_D | 210:b02fa166315d | 201 | /*sprintf((Time),"%d \r\n", temp/32); |
Kovalev_D | 210:b02fa166315d | 202 | WriteCon(Time);*/ |
Kovalev_D | 210:b02fa166315d | 203 | temp=temp*20; |
Kovalev_D | 208:19150d2b528f | 204 | Gyro.AmpTarget=(unsigned int)(temp); |
Kovalev_D | 208:19150d2b528f | 205 | break; |
Kovalev_D | 208:19150d2b528f | 206 | |
Kovalev_D | 209:224e7331a061 | 207 | case 19: Gyro.AmpSpeed = GyroP.Str.AmpSpeed; break; |
Kovalev_D | 209:224e7331a061 | 208 | case 20: Gyro.AmpPerMin = GyroP.Str.AmpPerMin; break; |
Kovalev_D | 209:224e7331a061 | 209 | case 21: Gyro.AmpPerMax = GyroP.Str.AmpPerMax; break; |
Kovalev_D | 208:19150d2b528f | 210 | |
Kovalev_D | 208:19150d2b528f | 211 | case 22: Gyro.AmpPer = GyroP.Str.AmpPer; |
Kovalev_D | 208:19150d2b528f | 212 | Gyro.Amp = GyroP.Str.AmpPer<<16; |
Kovalev_D | 208:19150d2b528f | 213 | break; |
Kovalev_D | 208:19150d2b528f | 214 | |
Kovalev_D | 209:224e7331a061 | 215 | case 23: Gyro.AmpMin = GyroP.Str.AmpMin; break; |
Kovalev_D | 209:224e7331a061 | 216 | case 24: Gyro.AmpTD = GyroP.Str.AmpTD; break; |
Kovalev_D | 209:224e7331a061 | 217 | case 25: Gyro.AmpPerDel = GyroP.Str.AmpPerDel; break; |
Kovalev_D | 209:224e7331a061 | 218 | case 34: Gyro.ModAmp = GyroP.Str.ModAmp; break; |
Kovalev_D | 208:19150d2b528f | 219 | case 56: Gyro.Gain_Sin = GyroP.Str.Gain_Sin; |
Kovalev_D | 208:19150d2b528f | 220 | Out_G_photo(Gyro.Gain_Sin, Gyro.Gain_Cos); |
Kovalev_D | 208:19150d2b528f | 221 | break; |
Kovalev_D | 208:19150d2b528f | 222 | case 57: Gyro.Gain_Cos = GyroP.Str.Gain_Cos; |
Kovalev_D | 208:19150d2b528f | 223 | Out_G_photo(Gyro.Gain_Sin, Gyro.Gain_Cos); |
Kovalev_D | 208:19150d2b528f | 224 | break; |
Kovalev_D | 209:224e7331a061 | 225 | case 60: Gyro.GLD_Serial = GyroP.Str.GLD_Serial; break; |
Kovalev_D | 211:ac8251b067d2 | 226 | |
Kovalev_D | 211:ac8251b067d2 | 227 | |
Kovalev_D | 211:ac8251b067d2 | 228 | case 10: Gyro.DownTreshold =0x7fff+GyroP.Str.DownTreshold; break; |
Kovalev_D | 211:ac8251b067d2 | 229 | case 11: Gyro.HighTreshold =0x7fff+GyroP.Str.HighTreshold; break; |
Kovalev_D | 211:ac8251b067d2 | 230 | case 9: Gyro.PLCDelay = GyroP.Str.PLCDelay/10; break; |
Kovalev_D | 211:ac8251b067d2 | 231 | /*case 105: Gyro.ResetLevelCool = GyroP.Str.ResetLevelCool; break; |
Kovalev_D | 211:ac8251b067d2 | 232 | case 55: Gyro.ResetLevelHeat = GyroP.Str.ResetLevelHeat; break;*/ |
Kovalev_D | 211:ac8251b067d2 | 233 | case 39: Gyro.ResetLevelCool = 0x7fff+GyroP.Str.ResetLevelCool; break; |
Kovalev_D | 211:ac8251b067d2 | 234 | case 31: Gyro.ResetLevelHeat = 0x7fff+GyroP.Str.ResetLevelHeat; break; //27 |
Kovalev_D | 211:ac8251b067d2 | 235 | |
Kovalev_D | 211:ac8251b067d2 | 236 | |
Kovalev_D | 211:ac8251b067d2 | 237 | //105 |
Kovalev_D | 211:ac8251b067d2 | 238 | |
Kovalev_D | 208:19150d2b528f | 239 | } |
Kovalev_D | 208:19150d2b528f | 240 | |
Kovalev_D | 208:19150d2b528f | 241 | NP=0; |
Kovalev_D | 129:406995a91322 | 242 | |
Kovalev_D | 129:406995a91322 | 243 | BuffTemp[0] = Gyro.SOC_Out; |
Kovalev_D | 129:406995a91322 | 244 | BuffTemp[1] = Gyro.My_Addres; |
Kovalev_D | 129:406995a91322 | 245 | BuffTemp[2] = Gyro.CMD_In; |
Kovalev_D | 208:19150d2b528f | 246 | BuffTemp[3] =0; //(//GyroP.Array[NP]>> 8) & 0xff;//старший байт требуемого параметра |
Kovalev_D | 129:406995a91322 | 247 | |
Kovalev_D | 129:406995a91322 | 248 | Check(BuffTemp, 6); |
Kovalev_D | 129:406995a91322 | 249 | WriteConN (BuffTemp,6); |
Kovalev_D | 208:19150d2b528f | 250 | if(flash){GyroP.Array[5]=0; flash=0; WriteFlash(); ReadFlash ();} |
Kovalev_D | 208:19150d2b528f | 251 | |
Kovalev_D | 208:19150d2b528f | 252 | |
Kovalev_D | 129:406995a91322 | 253 | } |
igor_v | 0:8ad47e2b6f00 | 254 | void CMD_Maintenance(void) |
igor_v | 0:8ad47e2b6f00 | 255 | { |
Kovalev_D | 209:224e7331a061 | 256 | Gyro.ModeOut=0; |
Kovalev_D | 208:19150d2b528f | 257 | //Gyro.DropDelayGLD = DropDelayGLD_0;//задержка на выдачу 45 микросекунд для любого адреса ГЛД |
Kovalev_D | 122:fbacb932a30b | 258 | BuffTemp[0] = Gyro.SOC_Out; |
Kovalev_D | 209:224e7331a061 | 259 | |
Kovalev_D | 124:9ae09249f842 | 260 | BuffTemp[1] = Gyro.My_Addres; |
Kovalev_D | 209:224e7331a061 | 261 | |
Kovalev_D | 124:9ae09249f842 | 262 | BuffTemp[2] = Gyro.Firmware_Version; |
Kovalev_D | 209:224e7331a061 | 263 | /* sprintf((Time),"%d \r\n", Gyro.Firmware_Version); |
Kovalev_D | 209:224e7331a061 | 264 | WriteCon(Time);*/ |
Kovalev_D | 169:140743e3bb96 | 265 | BuffTemp[3] = Gyro.GLD_Serial; |
Kovalev_D | 209:224e7331a061 | 266 | |
igor_v | 21:bc8c1cec3da6 | 267 | BuffTemp[4]=0x00; |
Kovalev_D | 209:224e7331a061 | 268 | |
igor_v | 21:bc8c1cec3da6 | 269 | BuffTemp[5]=0x00; |
Kovalev_D | 209:224e7331a061 | 270 | |
igor_v | 21:bc8c1cec3da6 | 271 | Check(BuffTemp, 8); |
Kovalev_D | 209:224e7331a061 | 272 | /* sprintf((Time),"%d %d %d %d %d %d %d %d\r\n",BuffTemp[0], BuffTemp[1],BuffTemp[2],BuffTemp[3],BuffTemp[4],BuffTemp[5],BuffTemp[6],BuffTemp[7]); |
Kovalev_D | 209:224e7331a061 | 273 | WriteCon(Time);*/ |
igor_v | 21:bc8c1cec3da6 | 274 | WriteConN (BuffTemp,8); |
Kovalev_D | 121:bbae560cdd43 | 275 | |
igor_v | 0:8ad47e2b6f00 | 276 | } |
Kovalev_D | 193:a0fe8bfc97e4 | 277 | void CMD_B_Delta(void) |
Kovalev_D | 193:a0fe8bfc97e4 | 278 | { |
Kovalev_D | 196:f76dbc081e63 | 279 | Gyro.Event_500Hz=0; |
Kovalev_D | 205:775d54fdf646 | 280 | Gyro.EXT_Latch=0; |
Kovalev_D | 193:a0fe8bfc97e4 | 281 | unsigned int Temp; |
Kovalev_D | 193:a0fe8bfc97e4 | 282 | BuffTemp[ 0] = Gyro.SOC_Out; |
Kovalev_D | 193:a0fe8bfc97e4 | 283 | BuffTemp[ 1] = Gyro.My_Addres; |
Kovalev_D | 193:a0fe8bfc97e4 | 284 | |
Kovalev_D | 193:a0fe8bfc97e4 | 285 | Temp = Gyro.CuruAngle; |
Kovalev_D | 193:a0fe8bfc97e4 | 286 | Gyro.CuruAngle = 0; |
Kovalev_D | 193:a0fe8bfc97e4 | 287 | BuffTemp[ 2] =(Temp >> 16) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 288 | BuffTemp[ 3] =(Temp >> 8) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 289 | BuffTemp[ 4] =(Temp >> 0) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 290 | BuffTemp[ 5] = 0x00000000; |
Kovalev_D | 193:a0fe8bfc97e4 | 291 | Check(BuffTemp, 8); |
Kovalev_D | 193:a0fe8bfc97e4 | 292 | WriteConN (BuffTemp,8); |
Kovalev_D | 193:a0fe8bfc97e4 | 293 | } |
Kovalev_D | 165:b2bd0c810a4f | 294 | |
Kovalev_D | 193:a0fe8bfc97e4 | 295 | void CMD_Delta_Bins(void) |
Kovalev_D | 196:f76dbc081e63 | 296 | { Gyro.Event_500Hz=0; |
Kovalev_D | 193:a0fe8bfc97e4 | 297 | unsigned int Temp; |
Kovalev_D | 193:a0fe8bfc97e4 | 298 | BuffTemp[ 0] = Gyro.SOC_Out; |
Kovalev_D | 193:a0fe8bfc97e4 | 299 | BuffTemp[ 1] = Gyro.My_Addres; |
Kovalev_D | 193:a0fe8bfc97e4 | 300 | |
Kovalev_D | 193:a0fe8bfc97e4 | 301 | Temp = Gyro.CuruAngle; |
Kovalev_D | 193:a0fe8bfc97e4 | 302 | Gyro.CuruAngle = 0; |
Kovalev_D | 193:a0fe8bfc97e4 | 303 | |
Kovalev_D | 193:a0fe8bfc97e4 | 304 | BuffTemp[ 2] =(Temp >> 24) & 0xff;//старший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 305 | BuffTemp[ 3] =(Temp >> 16) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 306 | BuffTemp[ 4] =(Temp >> 8) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 307 | BuffTemp[ 5] =(Temp >> 0) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 193:a0fe8bfc97e4 | 308 | BuffTemp[ 6] = 0x0000; |
Kovalev_D | 193:a0fe8bfc97e4 | 309 | Check(BuffTemp, 9); |
Kovalev_D | 193:a0fe8bfc97e4 | 310 | WriteConN (BuffTemp,9); |
Kovalev_D | 193:a0fe8bfc97e4 | 311 | } |
Kovalev_D | 193:a0fe8bfc97e4 | 312 | void CMD_Delta_PS(void) |
Kovalev_D | 210:b02fa166315d | 313 | { int drob,Temp1; |
Kovalev_D | 210:b02fa166315d | 314 | float Temp2=0; |
Kovalev_D | 193:a0fe8bfc97e4 | 315 | Gyro.EXT_Latch=0; |
Kovalev_D | 196:f76dbc081e63 | 316 | Gyro.Event_500Hz=0; |
Kovalev_D | 122:fbacb932a30b | 317 | unsigned int Temp; |
Kovalev_D | 124:9ae09249f842 | 318 | BuffTemp[ 0] = Gyro.SOC_Out; |
Kovalev_D | 122:fbacb932a30b | 319 | BuffTemp[ 1] = Gyro.My_Addres; |
Kovalev_D | 208:19150d2b528f | 320 | |
Kovalev_D | 209:224e7331a061 | 321 | Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle; //(72 град/с) |
Kovalev_D | 209:224e7331a061 | 322 | |
Kovalev_D | 210:b02fa166315d | 323 | OldCuruAngle=Gyro.CuruAngle & 0x7; //сохраняем 3 бит для след измирений |
Kovalev_D | 209:224e7331a061 | 324 | Temp=Gyro.CuruAngle>>3; //приводим к форме вывода |
Kovalev_D | 209:224e7331a061 | 325 | Gyro.CuruAngle = 0; |
Kovalev_D | 124:9ae09249f842 | 326 | |
Kovalev_D | 124:9ae09249f842 | 327 | BuffTemp[ 2] =(Temp >> 8) & 0xff;//старший байт разности счетчиков |
Kovalev_D | 124:9ae09249f842 | 328 | BuffTemp[ 3] =(Temp >> 0) & 0xff;//младший байт разности счетчиков |
Kovalev_D | 124:9ae09249f842 | 329 | |
Kovalev_D | 124:9ae09249f842 | 330 | BuffTemp[ 4] = CountParam; |
Kovalev_D | 124:9ae09249f842 | 331 | switch(CountParam) { |
Kovalev_D | 182:ebcd2bc3be8f | 332 | |
Kovalev_D | 124:9ae09249f842 | 333 | //F_ras |
Kovalev_D | 124:9ae09249f842 | 334 | case 0: |
Kovalev_D | 211:ac8251b067d2 | 335 | OutDeltaPS = Gyro.F_ras; |
Kovalev_D | 211:ac8251b067d2 | 336 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 337 | break; |
Kovalev_D | 124:9ae09249f842 | 338 | |
Kovalev_D | 124:9ae09249f842 | 339 | case 1: |
Kovalev_D | 211:ac8251b067d2 | 340 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 341 | break; |
Kovalev_D | 208:19150d2b528f | 342 | |
Kovalev_D | 124:9ae09249f842 | 343 | |
Kovalev_D | 124:9ae09249f842 | 344 | //HFO |
Kovalev_D | 124:9ae09249f842 | 345 | case 2: |
Kovalev_D | 211:ac8251b067d2 | 346 | /* Temp2 = ((Spi.DAC_A/0.65)-22544)-0x7fff; |
Kovalev_D | 211:ac8251b067d2 | 347 | Temp1= (int)Temp2;*/ |
Kovalev_D | 211:ac8251b067d2 | 348 | |
Kovalev_D | 211:ac8251b067d2 | 349 | if(Gyro.LG_Type) {OutDeltaPS =(int)(((Spi.DAC_A/0.6667)-30000)-0x7fff);} |
Kovalev_D | 211:ac8251b067d2 | 350 | else {OutDeltaPS =(unsigned int)(0x7fff-Spi.ADC5)*0.79;} |
Kovalev_D | 210:b02fa166315d | 351 | // Temp = Spi.DAC_A-0x7fff; |
Kovalev_D | 211:ac8251b067d2 | 352 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 353 | break; |
Kovalev_D | 124:9ae09249f842 | 354 | |
Kovalev_D | 124:9ae09249f842 | 355 | case 3: |
Kovalev_D | 211:ac8251b067d2 | 356 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 357 | break; |
Kovalev_D | 124:9ae09249f842 | 358 | |
Kovalev_D | 124:9ae09249f842 | 359 | |
Kovalev_D | 124:9ae09249f842 | 360 | |
Kovalev_D | 124:9ae09249f842 | 361 | //T_Vibro |
Kovalev_D | 124:9ae09249f842 | 362 | case 4: |
Kovalev_D | 211:ac8251b067d2 | 363 | OutDeltaPS = (unsigned int)(7680000/(Gyro.Frq>>16)); |
Kovalev_D | 211:ac8251b067d2 | 364 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 365 | break; |
Kovalev_D | 124:9ae09249f842 | 366 | |
Kovalev_D | 124:9ae09249f842 | 367 | case 5: |
Kovalev_D | 211:ac8251b067d2 | 368 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 369 | break; |
Kovalev_D | 124:9ae09249f842 | 370 | |
Kovalev_D | 124:9ae09249f842 | 371 | |
Kovalev_D | 124:9ae09249f842 | 372 | |
Kovalev_D | 124:9ae09249f842 | 373 | //L_Vibro |
Kovalev_D | 124:9ae09249f842 | 374 | case 6: |
Kovalev_D | 210:b02fa166315d | 375 | //Temp = Gyro.L_vibro>>1; |
Kovalev_D | 211:ac8251b067d2 | 376 | OutDeltaPS = Gyro.L_vibro; |
Kovalev_D | 211:ac8251b067d2 | 377 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 378 | |
Kovalev_D | 124:9ae09249f842 | 379 | break; |
Kovalev_D | 124:9ae09249f842 | 380 | |
Kovalev_D | 124:9ae09249f842 | 381 | case 7: |
Kovalev_D | 211:ac8251b067d2 | 382 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 383 | break; |
Kovalev_D | 124:9ae09249f842 | 384 | |
Kovalev_D | 124:9ae09249f842 | 385 | |
Kovalev_D | 124:9ae09249f842 | 386 | |
Kovalev_D | 124:9ae09249f842 | 387 | //Напряжение на регуляторе периметра |
Kovalev_D | 124:9ae09249f842 | 388 | case 8: |
Kovalev_D | 211:ac8251b067d2 | 389 | OutDeltaPS = (Spi.DAC_B - 0x7fff); |
Kovalev_D | 211:ac8251b067d2 | 390 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 391 | |
Kovalev_D | 124:9ae09249f842 | 392 | break; |
Kovalev_D | 124:9ae09249f842 | 393 | |
Kovalev_D | 124:9ae09249f842 | 394 | case 9: |
Kovalev_D | 211:ac8251b067d2 | 395 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 396 | break; |
Kovalev_D | 124:9ae09249f842 | 397 | |
Kovalev_D | 124:9ae09249f842 | 398 | |
Kovalev_D | 124:9ae09249f842 | 399 | |
Kovalev_D | 124:9ae09249f842 | 400 | //темпкратурный канал 0 |
Kovalev_D | 124:9ae09249f842 | 401 | case 10: |
Kovalev_D | 211:ac8251b067d2 | 402 | OutDeltaPS = 0; |
Kovalev_D | 211:ac8251b067d2 | 403 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
igor_v | 0:8ad47e2b6f00 | 404 | |
Kovalev_D | 124:9ae09249f842 | 405 | break; |
Kovalev_D | 124:9ae09249f842 | 406 | |
Kovalev_D | 124:9ae09249f842 | 407 | case 11: |
Kovalev_D | 211:ac8251b067d2 | 408 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 409 | break; |
Kovalev_D | 124:9ae09249f842 | 410 | |
Kovalev_D | 124:9ae09249f842 | 411 | |
Kovalev_D | 124:9ae09249f842 | 412 | |
Kovalev_D | 177:1666a83d88a5 | 413 | //f |
Kovalev_D | 124:9ae09249f842 | 414 | case 12: |
Kovalev_D | 211:ac8251b067d2 | 415 | OutDeltaPS =0;//(unsigned int)(0x7fff-Spi.ADC5)*0.79; |
Kovalev_D | 210:b02fa166315d | 416 | // Temp = Gyro.AD_Slow >> 16; |
Kovalev_D | 211:ac8251b067d2 | 417 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 418 | |
Kovalev_D | 124:9ae09249f842 | 419 | break; |
Kovalev_D | 124:9ae09249f842 | 420 | |
Kovalev_D | 124:9ae09249f842 | 421 | case 13: |
Kovalev_D | 211:ac8251b067d2 | 422 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 423 | break; |
Kovalev_D | 124:9ae09249f842 | 424 | |
Kovalev_D | 124:9ae09249f842 | 425 | |
Kovalev_D | 124:9ae09249f842 | 426 | |
Kovalev_D | 124:9ae09249f842 | 427 | //ток 1 |
Kovalev_D | 124:9ae09249f842 | 428 | case 14: |
Kovalev_D | 210:b02fa166315d | 429 | //Temp = Gyro.In1; |
Kovalev_D | 211:ac8251b067d2 | 430 | IntOutDeltaPS = ((Gyro.In1>>1)*0.800875)-0x3e0b; |
Kovalev_D | 211:ac8251b067d2 | 431 | BuffTemp[5] = (IntOutDeltaPS >> 8) & 0xff;//in1//2 |
Kovalev_D | 124:9ae09249f842 | 432 | |
Kovalev_D | 124:9ae09249f842 | 433 | break; |
Kovalev_D | 124:9ae09249f842 | 434 | |
Kovalev_D | 124:9ae09249f842 | 435 | case 15: |
Kovalev_D | 211:ac8251b067d2 | 436 | BuffTemp[5] = (IntOutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 437 | break; |
Kovalev_D | 124:9ae09249f842 | 438 | |
Kovalev_D | 124:9ae09249f842 | 439 | |
Kovalev_D | 124:9ae09249f842 | 440 | |
Kovalev_D | 124:9ae09249f842 | 441 | //ток 2 |
Kovalev_D | 124:9ae09249f842 | 442 | case 16: |
Kovalev_D | 210:b02fa166315d | 443 | // Temp = Gyro.In2; |
Kovalev_D | 211:ac8251b067d2 | 444 | IntOutDeltaPS = ((Gyro.In2>>1)*0.800875)-0x3e0b; |
Kovalev_D | 211:ac8251b067d2 | 445 | BuffTemp[5] = (IntOutDeltaPS >> 8) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 446 | break; |
Kovalev_D | 124:9ae09249f842 | 447 | |
Kovalev_D | 124:9ae09249f842 | 448 | case 17: |
Kovalev_D | 211:ac8251b067d2 | 449 | BuffTemp[5] = (IntOutDeltaPS >> 0) & 0xff;//in2//3 |
Kovalev_D | 124:9ae09249f842 | 450 | break; |
Kovalev_D | 124:9ae09249f842 | 451 | |
Kovalev_D | 124:9ae09249f842 | 452 | |
Kovalev_D | 124:9ae09249f842 | 453 | |
Kovalev_D | 124:9ae09249f842 | 454 | //разностный температурный канал Delta Temp |
Kovalev_D | 124:9ae09249f842 | 455 | case 18: |
Kovalev_D | 211:ac8251b067d2 | 456 | OutDeltaPS = 0; |
Kovalev_D | 211:ac8251b067d2 | 457 | OutDeltaPS = Gyro.DeltaT; |
Kovalev_D | 211:ac8251b067d2 | 458 | BuffTemp[5] = (OutDeltaPS >> 8) & 0xff;//дельта |
Kovalev_D | 124:9ae09249f842 | 459 | break; |
Kovalev_D | 124:9ae09249f842 | 460 | |
Kovalev_D | 124:9ae09249f842 | 461 | case 19: |
Kovalev_D | 211:ac8251b067d2 | 462 | BuffTemp[5] = (OutDeltaPS >> 0) & 0xff; |
Kovalev_D | 124:9ae09249f842 | 463 | break; |
Kovalev_D | 124:9ae09249f842 | 464 | |
Kovalev_D | 124:9ae09249f842 | 465 | |
Kovalev_D | 124:9ae09249f842 | 466 | |
Kovalev_D | 124:9ae09249f842 | 467 | //температурный канал 5 |
Kovalev_D | 124:9ae09249f842 | 468 | case 20: |
Kovalev_D | 211:ac8251b067d2 | 469 | OutDeltaPS = 0; |
Kovalev_D | 211:ac8251b067d2 | 470 | OutDeltaPS = Gyro.TermLM;//Spi.ADC1;// //Gyro.Termo;//0xa4=164 |
Kovalev_D | 211:ac8251b067d2 | 471 | BuffTemp[5] =(OutDeltaPS >> 8) & 0xff;//температура |
Kovalev_D | 124:9ae09249f842 | 472 | break; |
Kovalev_D | 124:9ae09249f842 | 473 | |
Kovalev_D | 124:9ae09249f842 | 474 | case 21: |
Kovalev_D | 211:ac8251b067d2 | 475 | BuffTemp[5] =(OutDeltaPS >> 0) & 0xff;//ADC6 sesnsor 5 |
Kovalev_D | 211:ac8251b067d2 | 476 | /* sprintf((Time),"%d %d \r\n", Spi.ADC1, Spi.ADC5 ); |
Kovalev_D | 211:ac8251b067d2 | 477 | WriteCon(Time);*/ |
Kovalev_D | 124:9ae09249f842 | 478 | break; |
Kovalev_D | 124:9ae09249f842 | 479 | } |
Kovalev_D | 162:44e4ded32c6a | 480 | Check(BuffTemp, CRC_N); |
Kovalev_D | 162:44e4ded32c6a | 481 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 128:1e4675a36c93 | 482 | |
Kovalev_D | 165:b2bd0c810a4f | 483 | |
Kovalev_D | 165:b2bd0c810a4f | 484 | if(CountParam>20)CountParam=0;//зацикливания буфера от 0 до 21 |
Kovalev_D | 165:b2bd0c810a4f | 485 | else CountParam++; |
Kovalev_D | 124:9ae09249f842 | 486 | |
Kovalev_D | 124:9ae09249f842 | 487 | } |
Kovalev_D | 124:9ae09249f842 | 488 | |
igor_v | 0:8ad47e2b6f00 | 489 | void CMD_Rate(void) |
Kovalev_D | 190:289514f730ee | 490 | { |
Kovalev_D | 124:9ae09249f842 | 491 | Gyro.Rate1_Event=0; |
Kovalev_D | 108:030cdde08314 | 492 | unsigned int Temp; |
Kovalev_D | 208:19150d2b528f | 493 | int Temp1; |
Kovalev_D | 209:224e7331a061 | 494 | float Temp2; |
Kovalev_D | 122:fbacb932a30b | 495 | |
Kovalev_D | 208:19150d2b528f | 496 | BuffTemp[ 0] = Gyro.SOC_Out; //1 --старт данных |
Kovalev_D | 208:19150d2b528f | 497 | BuffTemp[ 1] = Gyro.My_Addres; //2 --адрес отвечающего устройствва |
igor_v | 21:bc8c1cec3da6 | 498 | |
Kovalev_D | 209:224e7331a061 | 499 | BuffTemp[ 2] =( Gyro.CaunPlusReper >> 8) & 0xff;//старший байт счетчика +. 3 --сарший байт счентчика + |
Kovalev_D | 209:224e7331a061 | 500 | BuffTemp[ 3] =( Gyro.CaunPlusReper >> 0) & 0xff;//младший байт счетчика +. 4 --младший байт счетчика + |
Kovalev_D | 211:ac8251b067d2 | 501 | |
Kovalev_D | 209:224e7331a061 | 502 | BuffTemp[ 4] =( Gyro.CaunMinReper >> 8) & 0xff;//старший байт счетчика -. 5 --сарший байт счентчика - |
Kovalev_D | 209:224e7331a061 | 503 | BuffTemp[ 5] =( Gyro.CaunMinReper >> 0) & 0xff;//младший байт счетчика -. 6 --младший байт счетчика - |
Kovalev_D | 211:ac8251b067d2 | 504 | |
Kovalev_D | 209:224e7331a061 | 505 | |
Kovalev_D | 209:224e7331a061 | 506 | Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle; //(72 град/с) |
Kovalev_D | 208:19150d2b528f | 507 | OldCuruAngle=Gyro.CuruAngle & 0x1f; //сохраняем 5 бит для след измирений |
Kovalev_D | 211:ac8251b067d2 | 508 | Temp=Gyro.CuruAngle>>5; //приводим к форме вывода |
Kovalev_D | 211:ac8251b067d2 | 509 | |
Kovalev_D | 209:224e7331a061 | 510 | |
Kovalev_D | 208:19150d2b528f | 511 | Gyro.CuruAngle = 0; |
Kovalev_D | 208:19150d2b528f | 512 | BuffTemp[ 6] =(Temp >> 8) & 0xff;//старший байт разности счетчиков 7 --младший байт разности счетчиков |
Kovalev_D | 208:19150d2b528f | 513 | BuffTemp[ 7] =(Temp >> 0) & 0xff;//младший байт разности счетчиков 8 --старший байт разности счетчиков |
Kovalev_D | 108:030cdde08314 | 514 | |
Kovalev_D | 108:030cdde08314 | 515 | |
Kovalev_D | 208:19150d2b528f | 516 | BuffTemp[38] =(Temp >> 24) & 0xff;; //39 приращение угла |
Kovalev_D | 208:19150d2b528f | 517 | BuffTemp[39] =(Temp >> 16) & 0xff;; //40 формат 22.10 |
Kovalev_D | 208:19150d2b528f | 518 | BuffTemp[40] =(Temp >> 8) & 0xff;; //41 1бит знак |
Kovalev_D | 208:19150d2b528f | 519 | BuffTemp[41] =(Temp >> 0) & 0xff;; //42 |
Kovalev_D | 209:224e7331a061 | 520 | |
Kovalev_D | 208:19150d2b528f | 521 | Temp = Gyro.F_ras; |
Kovalev_D | 209:224e7331a061 | 522 | //Gyro.F_ras=0; |
Kovalev_D | 208:19150d2b528f | 523 | BuffTemp[ 8] = (Temp >> 8) & 0xff;//расщипление частота 9 --частота расщипления |
Kovalev_D | 209:224e7331a061 | 524 | BuffTemp[ 9] = (Temp >> 0) & 0xff;// 10 --частота расщипления |
Kovalev_D | 208:19150d2b528f | 525 | |
Kovalev_D | 211:ac8251b067d2 | 526 | //(unsigned int)((Gyro.DacIn+30000)*0.6667); |
Kovalev_D | 211:ac8251b067d2 | 527 | if(Gyro.LG_Type) {Temp1 =(int)(((Spi.DAC_A/0.6667)-30000)-0x7fff);} |
Kovalev_D | 211:ac8251b067d2 | 528 | else |
Kovalev_D | 211:ac8251b067d2 | 529 | { |
Kovalev_D | 209:224e7331a061 | 530 | Temp2 = ((Spi.DAC_A/0.65)-22544)-0x7fff; |
Kovalev_D | 209:224e7331a061 | 531 | Temp1= (int)Temp2; |
Kovalev_D | 211:ac8251b067d2 | 532 | } |
Kovalev_D | 209:224e7331a061 | 533 | //Temp1=Gyro.DacIn/*-0x7fff*/; |
Kovalev_D | 209:224e7331a061 | 534 | BuffTemp[10] = (Temp1 >> 8) & 0xff;//выход регулятора гвч; 11 --выход регулятора ГВЧ |
Kovalev_D | 209:224e7331a061 | 535 | BuffTemp[11] = (Temp1 >> 0) & 0xff; //12 --выход регулятора ГВЧ |
Kovalev_D | 209:224e7331a061 | 536 | |
Kovalev_D | 211:ac8251b067d2 | 537 | |
Kovalev_D | 211:ac8251b067d2 | 538 | |
Kovalev_D | 213:9953db9543d6 | 539 | if(Gyro.LG_Type) Temp =(int)(tempDeltaRegul); |
Kovalev_D | 211:ac8251b067d2 | 540 | else Temp =(unsigned int)(0x7fff-Spi.ADC5)*0.79; |
Kovalev_D | 208:19150d2b528f | 541 | BuffTemp[12]=(Temp >> 8) & 0xff;//// HFO 13 --сигнал ошибки регулятора ГВЧ |
Kovalev_D | 208:19150d2b528f | 542 | BuffTemp[13]=(Temp >> 0) & 0xff;//// 14 --сигнал ошибки регулятора ГВЧ |
Kovalev_D | 209:224e7331a061 | 543 | |
Kovalev_D | 209:224e7331a061 | 544 | //Temp = (unsigned int)((7675000*16/(Gyro.Frq>>12))); |
Kovalev_D | 210:b02fa166315d | 545 | Temp = (unsigned int)(7680000/(Gyro.Frq>>16)); |
Kovalev_D | 208:19150d2b528f | 546 | BuffTemp[14] = (Temp >> 8) & 0xff; //15 период вибропривода.(частота) T_Vibro |
Kovalev_D | 208:19150d2b528f | 547 | BuffTemp[15] = (Temp >> 0) & 0xff; //16 период вибропривода. |
Kovalev_D | 208:19150d2b528f | 548 | |
Kovalev_D | 209:224e7331a061 | 549 | Temp = Gyro.FrqPhaseEror<<2;//Spi.DAC_A-0x7fff; |
Kovalev_D | 209:224e7331a061 | 550 | BuffTemp[16] = (Temp >> 8) & 0xff; //17 старший байт ФД регулятора периода вибропривода |
Kovalev_D | 209:224e7331a061 | 551 | BuffTemp[17] = (Temp >> 0) & 0xff; |
Kovalev_D | 209:224e7331a061 | 552 | /*sprintf((Time),"%d %d\r\n",Gyro.FrqPhaseEror, Gyro.FrqPhaseEror<<2); |
Kovalev_D | 209:224e7331a061 | 553 | WriteCon(Time); */ //18 |
igor_v | 21:bc8c1cec3da6 | 554 | |
Kovalev_D | 209:224e7331a061 | 555 | Temp =Gyro.L_vibro/*>>1*/;//(unsigned int)(((7675000*16/200) * Gyro.AmpPer /(Gyro.Frq>>12))); |
Kovalev_D | 208:19150d2b528f | 556 | BuffTemp[18] = (Temp >> 8) & 0xff; //19 длительность импулься вибропривода(амплитуда) |
Kovalev_D | 208:19150d2b528f | 557 | BuffTemp[19] = (Temp >> 0) & 0xff; //20 |
Kovalev_D | 210:b02fa166315d | 558 | |
Kovalev_D | 208:19150d2b528f | 559 | |
Kovalev_D | 208:19150d2b528f | 560 | Temp = 0x0;//Gyro.L_vibro<<2; |
Kovalev_D | 208:19150d2b528f | 561 | BuffTemp[20] = (Temp >> 8) & 0xff;//регулятор датчика угла поворота //21 старший байт регулятора датчика угла поворота |
Kovalev_D | 208:19150d2b528f | 562 | BuffTemp[21] = (Temp >> 0) & 0xff; //22 |
Kovalev_D | 208:19150d2b528f | 563 | |
Kovalev_D | 209:224e7331a061 | 564 | Temp1 =(Spi.DAC_B-0x7fff); |
Kovalev_D | 209:224e7331a061 | 565 | BuffTemp[22] = (Temp1 >> 8) & 0xff; //23 Выход регулятора рабочего периметра |
Kovalev_D | 209:224e7331a061 | 566 | BuffTemp[23] = (Temp1 >> 0) & 0xff; |
Kovalev_D | 209:224e7331a061 | 567 | //24 |
Kovalev_D | 211:ac8251b067d2 | 568 | |
Kovalev_D | 209:224e7331a061 | 569 | Temp = Gyro.PLC_Eror_count>>4; //Gyro.AD_Slow >> 16; |
Kovalev_D | 209:224e7331a061 | 570 | Gyro.PLC_Eror_count = 0; |
Kovalev_D | 208:19150d2b528f | 571 | BuffTemp[24] = (Temp >> 8) & 0xff;// //25 ФД СРП |
Kovalev_D | 208:19150d2b528f | 572 | BuffTemp[25] = (Temp >> 0) & 0xff;// //26 ФД СРП |
Kovalev_D | 209:224e7331a061 | 573 | |
Kovalev_D | 209:224e7331a061 | 574 | Temp =0;/* Gyro.AD_Slow >> 16*/; |
Kovalev_D | 208:19150d2b528f | 575 | BuffTemp[26] = (Temp >> 8) & 0xff; //27 ADC 0 |
Kovalev_D | 208:19150d2b528f | 576 | BuffTemp[27] = (Temp >> 0) & 0xff; //28 |
Kovalev_D | 113:8be429494918 | 577 | |
Kovalev_D | 209:224e7331a061 | 578 | Temp =0; /*Gyro.AD_Slow >> 16*/; |
Kovalev_D | 208:19150d2b528f | 579 | BuffTemp[28] = (Temp >> 8) & 0xff; //29 ADC 1 |
Kovalev_D | 208:19150d2b528f | 580 | BuffTemp[29] = (Temp >> 0) & 0xff; //30 |
Kovalev_D | 113:8be429494918 | 581 | |
Kovalev_D | 209:224e7331a061 | 582 | Temp1 = ((Gyro.In1>>1)*0.800875)-0x3e0b; |
Kovalev_D | 209:224e7331a061 | 583 | BuffTemp[30] = (Temp1 >> 8) & 0xff;//in1//2 //31 ADC 2 |
Kovalev_D | 209:224e7331a061 | 584 | BuffTemp[31] = (Temp1 >> 0) & 0xff; //32 |
Kovalev_D | 208:19150d2b528f | 585 | |
Kovalev_D | 209:224e7331a061 | 586 | Temp1 =((Gyro.In2>>1)*0.800875)-0x3e0b;// - 0x4FFF; |
Kovalev_D | 209:224e7331a061 | 587 | BuffTemp[32] = (Temp1 >> 8) & 0xff; //33 ADC 3 |
Kovalev_D | 209:224e7331a061 | 588 | BuffTemp[33] = (Temp1 >> 0) & 0xff;//in2//3 //34 |
Kovalev_D | 209:224e7331a061 | 589 | |
Kovalev_D | 208:19150d2b528f | 590 | Temp = (Gyro.DeltaT); |
Kovalev_D | 208:19150d2b528f | 591 | BuffTemp[34] = (Temp >> 8) & 0xff;//дельта //35 ADC 4 |
Kovalev_D | 208:19150d2b528f | 592 | BuffTemp[35] = (Temp >> 0) & 0xff; //36 |
Kovalev_D | 208:19150d2b528f | 593 | // Temp = 000; |
Kovalev_D | 208:19150d2b528f | 594 | |
Kovalev_D | 208:19150d2b528f | 595 | Temp = Gyro.Termo; |
Kovalev_D | 208:19150d2b528f | 596 | BuffTemp[36] =(Temp >> 8) & 0xff;//температура //37 ADC 5 |
Kovalev_D | 208:19150d2b528f | 597 | BuffTemp[37] =(Temp >> 0) & 0xff;//ADC6 sesnsor 5 //38 |
igor_v | 21:bc8c1cec3da6 | 598 | |
igor_v | 21:bc8c1cec3da6 | 599 | Check(BuffTemp, 44); |
igor_v | 21:bc8c1cec3da6 | 600 | WriteConN (BuffTemp,44); |
Kovalev_D | 209:224e7331a061 | 601 | for(int i=0; i<45;i++) {BuffTemp[i]=0;} |
Kovalev_D | 209:224e7331a061 | 602 | } |
Kovalev_D | 209:224e7331a061 | 603 | |
Kovalev_D | 210:b02fa166315d | 604 | void CMD_Rate2(void) |
Kovalev_D | 210:b02fa166315d | 605 | { |
Kovalev_D | 210:b02fa166315d | 606 | unsigned int Temp; |
Kovalev_D | 210:b02fa166315d | 607 | Gyro.Reper_Event=0; |
Kovalev_D | 210:b02fa166315d | 608 | |
Kovalev_D | 210:b02fa166315d | 609 | BuffTemp[ 0] = Gyro.SOC_Out; |
Kovalev_D | 210:b02fa166315d | 610 | BuffTemp[ 1] = Gyro.My_Addres; |
Kovalev_D | 211:ac8251b067d2 | 611 | |
Kovalev_D | 211:ac8251b067d2 | 612 | Temp=Gyro.CaunPlusReper; |
Kovalev_D | 211:ac8251b067d2 | 613 | |
Kovalev_D | 210:b02fa166315d | 614 | BuffTemp[ 2] =(Temp >> 8) & 0xff;//старший байт счетчика +. |
Kovalev_D | 210:b02fa166315d | 615 | BuffTemp[ 3] =(Temp >> 0) & 0xff;//младший байт счетчика +. |
Kovalev_D | 211:ac8251b067d2 | 616 | //сохраняем 5 бит для след измирений |
Kovalev_D | 210:b02fa166315d | 617 | |
Kovalev_D | 211:ac8251b067d2 | 618 | Temp= Gyro.CaunMinReper; |
Kovalev_D | 211:ac8251b067d2 | 619 | |
Kovalev_D | 210:b02fa166315d | 620 | BuffTemp[ 4] =(Temp >> 8) & 0xff;//старший байт счетчика -. |
Kovalev_D | 210:b02fa166315d | 621 | BuffTemp[ 5] =(Temp >> 0) & 0xff;//младший байт счетчика -. |
Kovalev_D | 211:ac8251b067d2 | 622 | |
Kovalev_D | 210:b02fa166315d | 623 | Check(BuffTemp, 8); |
Kovalev_D | 210:b02fa166315d | 624 | WriteConN (BuffTemp,8); |
Kovalev_D | 210:b02fa166315d | 625 | } |
Kovalev_D | 210:b02fa166315d | 626 | |
Kovalev_D | 210:b02fa166315d | 627 | void CMD_Rate3(void) |
Kovalev_D | 210:b02fa166315d | 628 | { |
Kovalev_D | 210:b02fa166315d | 629 | Gyro.Rate3_Event=0; |
Kovalev_D | 210:b02fa166315d | 630 | BuffTemp[ 0] = Gyro.SOC_Out; |
Kovalev_D | 210:b02fa166315d | 631 | BuffTemp[ 1] = Gyro.My_Addres; |
Kovalev_D | 210:b02fa166315d | 632 | BuffTemp[ 2] = 0xcc;//старший байт счетчика +. |
Kovalev_D | 210:b02fa166315d | 633 | BuffTemp[ 3] = 0xcc;//младший байт счетчика +. |
Kovalev_D | 210:b02fa166315d | 634 | |
Kovalev_D | 210:b02fa166315d | 635 | BuffTemp[ 4] =0xBB;//старший байт счетчика -. |
Kovalev_D | 210:b02fa166315d | 636 | BuffTemp[ 5] =0xBB;//младший байт счетчика -. |
Kovalev_D | 210:b02fa166315d | 637 | |
Kovalev_D | 210:b02fa166315d | 638 | Check(BuffTemp, 8); |
Kovalev_D | 210:b02fa166315d | 639 | WriteConN (BuffTemp,8); |
Kovalev_D | 210:b02fa166315d | 640 | } |
Kovalev_D | 210:b02fa166315d | 641 | |
Kovalev_D | 209:224e7331a061 | 642 | void CMD_M_Stymul() |
Kovalev_D | 209:224e7331a061 | 643 | { |
Kovalev_D | 209:224e7331a061 | 644 | int temp,Consol=0,HFO,b4; |
Kovalev_D | 209:224e7331a061 | 645 | float Temp1; |
Kovalev_D | 209:224e7331a061 | 646 | temp=BuffTemp[3]; |
Kovalev_D | 209:224e7331a061 | 647 | |
Kovalev_D | 209:224e7331a061 | 648 | b4 = temp; |
Kovalev_D | 209:224e7331a061 | 649 | Consol = temp>>7; |
Kovalev_D | 209:224e7331a061 | 650 | HFO = temp&0x3;// // (номер (код) ЦАПа 0...3, HFO - 3dac, PLC - 0DAC |
Kovalev_D | 209:224e7331a061 | 651 | |
Kovalev_D | 209:224e7331a061 | 652 | temp = (((BuffTemp[4]<<8) | BuffTemp[5])&0xFFFF); |
Kovalev_D | 209:224e7331a061 | 653 | if(HFO) |
Kovalev_D | 209:224e7331a061 | 654 | { |
Kovalev_D | 209:224e7331a061 | 655 | Gyro.DacIn=temp; |
Kovalev_D | 211:ac8251b067d2 | 656 | if(Gyro.LG_Type==1) Spi.DAC_A = (unsigned int)((Gyro.DacIn+30000)*0.6667); |
Kovalev_D | 211:ac8251b067d2 | 657 | else Spi.DAC_A = (unsigned int)((temp)); |
Kovalev_D | 209:224e7331a061 | 658 | } |
Kovalev_D | 209:224e7331a061 | 659 | else Spi.DAC_B = (unsigned int)temp; |
Kovalev_D | 92:c892f0311aa7 | 660 | |
Kovalev_D | 211:ac8251b067d2 | 661 | /* sprintf((Time)," %d %d \r\n", Spi.DAC_A,Gyro.DacIn); |
Kovalev_D | 209:224e7331a061 | 662 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 663 | */ |
Kovalev_D | 209:224e7331a061 | 664 | |
Kovalev_D | 209:224e7331a061 | 665 | /* |
Kovalev_D | 209:224e7331a061 | 666 | sprintf((Time),"%d %d %f \r\n", temp, Spi.DAC_A, (temp+10744)*0.79); |
Kovalev_D | 209:224e7331a061 | 667 | WriteCon(Time); |
Kovalev_D | 209:224e7331a061 | 668 | */ |
Kovalev_D | 209:224e7331a061 | 669 | |
Kovalev_D | 209:224e7331a061 | 670 | /*{ |
Kovalev_D | 209:224e7331a061 | 671 | DACF =(temp*K_DAC)+deltaDAC; |
Kovalev_D | 209:224e7331a061 | 672 | Spi.DAC_B =(unsigned int)(DACF) (unsigned int)(temp*K_DAC+deltaDAC); // K_DAC); |
Kovalev_D | 209:224e7331a061 | 673 | }*/ |
Kovalev_D | 209:224e7331a061 | 674 | if(Consol) |
Kovalev_D | 209:224e7331a061 | 675 | { |
Kovalev_D | 209:224e7331a061 | 676 | BuffTemp[0] = Gyro.SOC_Out; //DD |
Kovalev_D | 209:224e7331a061 | 677 | BuffTemp[1] = Gyro.My_Addres; //00 |
Kovalev_D | 209:224e7331a061 | 678 | BuffTemp[2] = Gyro.CMD_In; //D9 |
Kovalev_D | 209:224e7331a061 | 679 | BuffTemp[3] =0; |
Kovalev_D | 209:224e7331a061 | 680 | Check(BuffTemp, CRC_N); |
Kovalev_D | 209:224e7331a061 | 681 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 209:224e7331a061 | 682 | } |
igor_v | 0:8ad47e2b6f00 | 683 | } |
Kovalev_D | 209:224e7331a061 | 684 | |
Kovalev_D | 179:2b4e6bc277df | 685 | void CMD_M_vib() |
Kovalev_D | 179:2b4e6bc277df | 686 | { |
Kovalev_D | 209:224e7331a061 | 687 | unsigned int temp1,temp2,anser; |
Kovalev_D | 209:224e7331a061 | 688 | // anser = BuffTemp[3]>>7; |
Kovalev_D | 209:224e7331a061 | 689 | |
Kovalev_D | 209:224e7331a061 | 690 | temp1 = (((BuffTemp[4]<<8) | BuffTemp[5])&0xFFFF); |
Kovalev_D | 209:224e7331a061 | 691 | Gyro.Frq = (122780000/temp1)<<12; |
Kovalev_D | 209:224e7331a061 | 692 | |
Kovalev_D | 209:224e7331a061 | 693 | temp2 = (((BuffTemp[6]<<8) | BuffTemp[7])&0xFFFF); |
Kovalev_D | 210:b02fa166315d | 694 | Gyro.AmpPer = ((((((Gyro.Frq>>12)*200)/16)*temp2)/7680000)/2); |
Kovalev_D | 210:b02fa166315d | 695 | /* sprintf((Time),"%d %d \r\n",temp2,Gyro.AmpPer); |
Kovalev_D | 210:b02fa166315d | 696 | WriteCon(Time); */ |
Kovalev_D | 207:d1ce992f5d17 | 697 | |
Kovalev_D | 209:224e7331a061 | 698 | // if(anser) |
Kovalev_D | 209:224e7331a061 | 699 | // { |
Kovalev_D | 209:224e7331a061 | 700 | BuffTemp[0] = Gyro.SOC_Out; |
Kovalev_D | 209:224e7331a061 | 701 | BuffTemp[1] = Gyro.My_Addres; |
Kovalev_D | 209:224e7331a061 | 702 | BuffTemp[2] = Gyro.CMD_In; |
Kovalev_D | 209:224e7331a061 | 703 | BuffTemp[3] = 0x0; |
Kovalev_D | 209:224e7331a061 | 704 | BuffTemp[4] = 0x0; |
Kovalev_D | 209:224e7331a061 | 705 | Check(BuffTemp, CRC_N); |
Kovalev_D | 209:224e7331a061 | 706 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 209:224e7331a061 | 707 | // } |
Kovalev_D | 179:2b4e6bc277df | 708 | } |
igor_v | 21:bc8c1cec3da6 | 709 | void CMD_M_Control_D8()///установка\сброс регистров управления |
igor_v | 21:bc8c1cec3da6 | 710 | { |
Kovalev_D | 209:224e7331a061 | 711 | unsigned int bit=0,Pa=0; |
Kovalev_D | 209:224e7331a061 | 712 | unsigned int SR=0,V=0,Bit_num=0,A=0; |
Kovalev_D | 209:224e7331a061 | 713 | Pa = BuffTemp[3]; |
Kovalev_D | 209:224e7331a061 | 714 | SR = Pa >> 7; |
Kovalev_D | 209:224e7331a061 | 715 | V = (Pa>>5)&0x3; |
Kovalev_D | 209:224e7331a061 | 716 | A = (Pa>>4)&0x1; |
Kovalev_D | 209:224e7331a061 | 717 | Bit_num = Pa & 0xf; |
Kovalev_D | 104:ab1cb4ff56b2 | 718 | |
Kovalev_D | 209:224e7331a061 | 719 | switch (SR) |
Kovalev_D | 209:224e7331a061 | 720 | { |
Kovalev_D | 209:224e7331a061 | 721 | case 0: |
Kovalev_D | 209:224e7331a061 | 722 | switch (A) |
Kovalev_D | 209:224e7331a061 | 723 | { |
Kovalev_D | 209:224e7331a061 | 724 | case 0: |
Kovalev_D | 209:224e7331a061 | 725 | switch (Bit_num) |
Kovalev_D | 209:224e7331a061 | 726 | { |
Kovalev_D | 209:224e7331a061 | 727 | case 0x06: FrqOFF break; |
Kovalev_D | 209:224e7331a061 | 728 | case 0x05: AVibOFF break; |
Kovalev_D | 209:224e7331a061 | 729 | case 0x01: HFOOFF break; |
Kovalev_D | 209:224e7331a061 | 730 | case 0x03: PlcOFF break; |
Kovalev_D | 209:224e7331a061 | 731 | } |
Kovalev_D | 209:224e7331a061 | 732 | break; |
Kovalev_D | 209:224e7331a061 | 733 | case 1: |
Kovalev_D | 209:224e7331a061 | 734 | switch (Bit_num) |
Kovalev_D | 209:224e7331a061 | 735 | { |
Kovalev_D | 209:224e7331a061 | 736 | case 0x00: Gyro.RgConB &= ~(1<<0); break; |
Kovalev_D | 209:224e7331a061 | 737 | case 0x01: Gyro.RgConB &= ~(1<<1); break; |
Kovalev_D | 209:224e7331a061 | 738 | case 0x02: Gyro.RgConB &= ~(1<<2); break; |
Kovalev_D | 209:224e7331a061 | 739 | } |
Kovalev_D | 209:224e7331a061 | 740 | break; |
Kovalev_D | 209:224e7331a061 | 741 | } |
Kovalev_D | 209:224e7331a061 | 742 | |
Kovalev_D | 209:224e7331a061 | 743 | |
Kovalev_D | 209:224e7331a061 | 744 | break; |
Kovalev_D | 209:224e7331a061 | 745 | case 1: |
Kovalev_D | 209:224e7331a061 | 746 | switch (A) |
Kovalev_D | 209:224e7331a061 | 747 | { |
Kovalev_D | 209:224e7331a061 | 748 | case 0: |
Kovalev_D | 209:224e7331a061 | 749 | switch (Bit_num) |
Kovalev_D | 209:224e7331a061 | 750 | { |
Kovalev_D | 209:224e7331a061 | 751 | case 0x06: FrqON break; |
Kovalev_D | 209:224e7331a061 | 752 | case 0x05: AVibON break; |
Kovalev_D | 209:224e7331a061 | 753 | case 0x01: HFOON break; |
Kovalev_D | 209:224e7331a061 | 754 | case 0x03: PlcON break; |
Kovalev_D | 209:224e7331a061 | 755 | } |
Kovalev_D | 209:224e7331a061 | 756 | break; |
Kovalev_D | 209:224e7331a061 | 757 | case 1: |
Kovalev_D | 209:224e7331a061 | 758 | switch (Bit_num) |
Kovalev_D | 209:224e7331a061 | 759 | { |
Kovalev_D | 209:224e7331a061 | 760 | case 0x00: Gyro.RgConB |= (1<<0); break; |
Kovalev_D | 209:224e7331a061 | 761 | case 0x01: Gyro.RgConB |= (1<<1); break; |
Kovalev_D | 209:224e7331a061 | 762 | case 0x02: Gyro.RgConB |= (1<<2); break; |
Kovalev_D | 209:224e7331a061 | 763 | } |
Kovalev_D | 209:224e7331a061 | 764 | break; |
Kovalev_D | 209:224e7331a061 | 765 | } |
Kovalev_D | 209:224e7331a061 | 766 | break; |
Kovalev_D | 209:224e7331a061 | 767 | } |
igor_v | 30:17c84ed091b3 | 768 | BuffTemp[0] = Gyro.SOC_Out; //DD |
igor_v | 30:17c84ed091b3 | 769 | BuffTemp[1] = Gyro.My_Addres; //00 |
igor_v | 30:17c84ed091b3 | 770 | BuffTemp[2] = Gyro.CMD_In; //D8 |
Kovalev_D | 209:224e7331a061 | 771 | switch (A) |
Kovalev_D | 209:224e7331a061 | 772 | { |
Kovalev_D | 209:224e7331a061 | 773 | case 0: |
Kovalev_D | 209:224e7331a061 | 774 | BuffTemp[ 4] =(Gyro.RgConA >> 8) & 0xff; |
Kovalev_D | 209:224e7331a061 | 775 | BuffTemp[ 5] =(Gyro.RgConA >> 0) & 0xff; |
Kovalev_D | 209:224e7331a061 | 776 | break; |
Kovalev_D | 209:224e7331a061 | 777 | |
Kovalev_D | 209:224e7331a061 | 778 | case 1: |
Kovalev_D | 209:224e7331a061 | 779 | BuffTemp[ 4] =(Gyro.RgConB >> 8) & 0xff; |
Kovalev_D | 209:224e7331a061 | 780 | BuffTemp[ 5] =(Gyro.RgConB >> 0) & 0xff; |
Kovalev_D | 209:224e7331a061 | 781 | break; |
Kovalev_D | 209:224e7331a061 | 782 | } |
Kovalev_D | 209:224e7331a061 | 783 | Check(BuffTemp, CRC_N); |
Kovalev_D | 209:224e7331a061 | 784 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 209:224e7331a061 | 785 | } |
Kovalev_D | 208:19150d2b528f | 786 | |
igor_v | 21:bc8c1cec3da6 | 787 | void CMD_M_Control_D9()///чтение регистров управления |
igor_v | 21:bc8c1cec3da6 | 788 | { |
Kovalev_D | 209:224e7331a061 | 789 | int bit,NReg,param=0; |
igor_v | 30:17c84ed091b3 | 790 | BuffTemp[0] = Gyro.SOC_Out; //DD |
igor_v | 30:17c84ed091b3 | 791 | BuffTemp[1] = Gyro.My_Addres; //00 |
igor_v | 30:17c84ed091b3 | 792 | BuffTemp[2] = Gyro.CMD_In; //D9 |
Kovalev_D | 209:224e7331a061 | 793 | param = BuffTemp[3]; |
Kovalev_D | 209:224e7331a061 | 794 | if (param) |
Kovalev_D | 209:224e7331a061 | 795 | { |
igor_v | 21:bc8c1cec3da6 | 796 | BuffTemp[3]=1<<4; |
igor_v | 30:17c84ed091b3 | 797 | BuffTemp[4] = (Gyro.RgConB>>8 ) & 0xff; |
igor_v | 30:17c84ed091b3 | 798 | BuffTemp[5] = Gyro.RgConB & 0xff; |
igor_v | 21:bc8c1cec3da6 | 799 | } |
Kovalev_D | 209:224e7331a061 | 800 | else |
Kovalev_D | 209:224e7331a061 | 801 | { |
Kovalev_D | 209:224e7331a061 | 802 | BuffTemp[3]=0<<4; |
Kovalev_D | 209:224e7331a061 | 803 | BuffTemp[4] = (Gyro.RgConA>>8 )& 0xff; |
Kovalev_D | 209:224e7331a061 | 804 | BuffTemp[5] = Gyro.RgConA & 0xff; |
Kovalev_D | 209:224e7331a061 | 805 | } |
igor_v | 21:bc8c1cec3da6 | 806 | Check(BuffTemp, CRC_N); |
igor_v | 21:bc8c1cec3da6 | 807 | WriteConN (BuffTemp,CRC_N); |
igor_v | 21:bc8c1cec3da6 | 808 | } |
igor_v | 21:bc8c1cec3da6 | 809 | // (номер (код) ЦАПа 0...3, старший байт требуемого ЦАПа, младший байт треб ЦАПа) |
Kovalev_D | 209:224e7331a061 | 810 | |
Kovalev_D | 209:224e7331a061 | 811 | |
Kovalev_D | 194:8f3cb37a5541 | 812 | |
Kovalev_D | 194:8f3cb37a5541 | 813 | void GLDStartDischarg(void) |
Kovalev_D | 208:19150d2b528f | 814 | { TimeDischarg=0; |
Kovalev_D | 208:19150d2b528f | 815 | Try=0; |
Kovalev_D | 194:8f3cb37a5541 | 816 | switch(Gyro.My_Addres) |
Kovalev_D | 194:8f3cb37a5541 | 817 | {//смещение поджига и подсветки в зависимости от адреса ГЛД |
Kovalev_D | 194:8f3cb37a5541 | 818 | case 0: |
Kovalev_D | 194:8f3cb37a5541 | 819 | Gyro.Discharg = StartDischarg << ShiftStart0; |
Kovalev_D | 194:8f3cb37a5541 | 820 | Gyro.BackLight = StartBackLight << ShiftStart0; |
Kovalev_D | 194:8f3cb37a5541 | 821 | break; |
Kovalev_D | 194:8f3cb37a5541 | 822 | case 1: |
Kovalev_D | 194:8f3cb37a5541 | 823 | Gyro.Discharg = StartDischarg << ShiftStart1; |
Kovalev_D | 194:8f3cb37a5541 | 824 | Gyro.BackLight = StartBackLight << ShiftStart1; |
Kovalev_D | 194:8f3cb37a5541 | 825 | break; |
Kovalev_D | 194:8f3cb37a5541 | 826 | case 2: |
Kovalev_D | 194:8f3cb37a5541 | 827 | Gyro.Discharg = StartDischarg << ShiftStart2; |
Kovalev_D | 194:8f3cb37a5541 | 828 | Gyro.BackLight = StartBackLight << ShiftStart2; |
Kovalev_D | 194:8f3cb37a5541 | 829 | break; |
Kovalev_D | 194:8f3cb37a5541 | 830 | case 3: |
Kovalev_D | 194:8f3cb37a5541 | 831 | Gyro.Discharg = StartDischarg << ShiftStart3; |
Kovalev_D | 194:8f3cb37a5541 | 832 | Gyro.BackLight = StartBackLight << ShiftStart3; |
Kovalev_D | 194:8f3cb37a5541 | 833 | break; |
Kovalev_D | 194:8f3cb37a5541 | 834 | } |
Kovalev_D | 194:8f3cb37a5541 | 835 | } |
Kovalev_D | 194:8f3cb37a5541 | 836 | |
Kovalev_D | 103:e96f08947def | 837 | void Gph_W() |
Kovalev_D | 103:e96f08947def | 838 | { |
Kovalev_D | 205:775d54fdf646 | 839 | //Gyro.flagGph_W=3; |
Kovalev_D | 208:19150d2b528f | 840 | |
Kovalev_D | 172:ef7bf1663645 | 841 | Out_G_photo(BuffTemp[4],BuffTemp[5]); |
Kovalev_D | 209:224e7331a061 | 842 | BuffTemp[0] = Gyro.SOC_Out; //DD |
Kovalev_D | 209:224e7331a061 | 843 | BuffTemp[1] = Gyro.My_Addres; //00 |
Kovalev_D | 209:224e7331a061 | 844 | BuffTemp[2] = Gyro.CMD_In; //D9 |
Kovalev_D | 209:224e7331a061 | 845 | BuffTemp[3] = 0; |
Kovalev_D | 209:224e7331a061 | 846 | Check(BuffTemp, CRC_N); |
Kovalev_D | 209:224e7331a061 | 847 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 103:e96f08947def | 848 | } |
Kovalev_D | 209:224e7331a061 | 849 | void DeviceMode() |
Kovalev_D | 209:224e7331a061 | 850 | { |
Kovalev_D | 209:224e7331a061 | 851 | int TempMod=1; |
Kovalev_D | 209:224e7331a061 | 852 | BuffTemp[0] = Gyro.SOC_Out; //DD |
Kovalev_D | 209:224e7331a061 | 853 | BuffTemp[1] = Gyro.My_Addres; //00 |
Kovalev_D | 209:224e7331a061 | 854 | BuffTemp[2] = Gyro.CMD_In; //D9 |
Kovalev_D | 209:224e7331a061 | 855 | TempMod = BuffTemp[3] & 0xf; |
Kovalev_D | 209:224e7331a061 | 856 | Gyro.RgConMod = TempMod; |
Kovalev_D | 209:224e7331a061 | 857 | BuffTemp[3]=Gyro.RgConMod & 0xff; |
Kovalev_D | 209:224e7331a061 | 858 | BuffTemp[4]=0; |
Kovalev_D | 209:224e7331a061 | 859 | BuffTemp[5]=0; |
Kovalev_D | 209:224e7331a061 | 860 | Check(BuffTemp, CRC_N); |
Kovalev_D | 209:224e7331a061 | 861 | WriteConN (BuffTemp,CRC_N); |
Kovalev_D | 209:224e7331a061 | 862 | } |
Kovalev_D | 102:4270092be987 | 863 | |
igor_v | 0:8ad47e2b6f00 | 864 | unsigned int Check(char *c, unsigned int Count) |
igor_v | 0:8ad47e2b6f00 | 865 | { |
igor_v | 21:bc8c1cec3da6 | 866 | int i=1; |
igor_v | 21:bc8c1cec3da6 | 867 | unsigned int temp,CRC; |
igor_v | 21:bc8c1cec3da6 | 868 | |
igor_v | 21:bc8c1cec3da6 | 869 | |
igor_v | 21:bc8c1cec3da6 | 870 | temp=1; |
igor_v | 21:bc8c1cec3da6 | 871 | CRC=0; |
igor_v | 21:bc8c1cec3da6 | 872 | |
igor_v | 21:bc8c1cec3da6 | 873 | |
igor_v | 21:bc8c1cec3da6 | 874 | for(; i<Count-2; i++) { |
igor_v | 21:bc8c1cec3da6 | 875 | CRC+=c[i]; |
igor_v | 21:bc8c1cec3da6 | 876 | } |
igor_v | 0:8ad47e2b6f00 | 877 | |
igor_v | 21:bc8c1cec3da6 | 878 | if(c[Count-2]!=((CRC>>8)&0xFF)) { |
igor_v | 21:bc8c1cec3da6 | 879 | temp=0; |
igor_v | 30:17c84ed091b3 | 880 | Gyro.RsErrLine = (Gyro.RsErrLine)&=0x2; |
igor_v | 21:bc8c1cec3da6 | 881 | } |
igor_v | 0:8ad47e2b6f00 | 882 | |
igor_v | 21:bc8c1cec3da6 | 883 | if(c[Count-1]!=((CRC>>0)&0xFF)) { |
igor_v | 21:bc8c1cec3da6 | 884 | temp=0; |
igor_v | 30:17c84ed091b3 | 885 | // Gyro.RsErrLine= (Gyro.RsErrLine)=0x2; |
igor_v | 21:bc8c1cec3da6 | 886 | } |
igor_v | 21:bc8c1cec3da6 | 887 | |
igor_v | 21:bc8c1cec3da6 | 888 | c[Count-2]=(CRC>>8)&0xFF; |
igor_v | 21:bc8c1cec3da6 | 889 | c[Count-1]=(CRC>>0)&0xFF; |
igor_v | 21:bc8c1cec3da6 | 890 | |
igor_v | 21:bc8c1cec3da6 | 891 | return temp; |
igor_v | 0:8ad47e2b6f00 | 892 | } |
igor_v | 0:8ad47e2b6f00 | 893 | |
igor_v | 0:8ad47e2b6f00 | 894 | int Getlengf(void) |
igor_v | 0:8ad47e2b6f00 | 895 | { |
Kovalev_D | 121:bbae560cdd43 | 896 | unsigned int lengf; |
Kovalev_D | 121:bbae560cdd43 | 897 | lengf = 1; |
Kovalev_D | 194:8f3cb37a5541 | 898 | switch(Gyro.CMD_In) |
Kovalev_D | 194:8f3cb37a5541 | 899 | { |
Kovalev_D | 194:8f3cb37a5541 | 900 | case 0x99: lengf=6; CRC_N=8; break; //Mintainance |
Kovalev_D | 194:8f3cb37a5541 | 901 | case 0xB0: lengf=6; CRC_N=9; break; //Delta_Bins |
Kovalev_D | 194:8f3cb37a5541 | 902 | case 0x0F: lengf=6; CRC_N=8; break; //Delta_Bins |
Kovalev_D | 194:8f3cb37a5541 | 903 | case 0xA0: lengf=6; CRC_N=8; break; //Delta_PS |
Kovalev_D | 194:8f3cb37a5541 | 904 | case 0xDD: lengf=6; CRC_N=44; break; //m_rate |
Kovalev_D | 209:224e7331a061 | 905 | case 0x0A: lengf=8; CRC_N=6; break; //m_stymul |
Kovalev_D | 194:8f3cb37a5541 | 906 | case 0xE9: lengf=6; CRC_N=8; break; //DeviceMode |
Kovalev_D | 194:8f3cb37a5541 | 907 | case 0xE8: lengf=6; CRC_N=8; break; //DeviceMode |
Kovalev_D | 194:8f3cb37a5541 | 908 | case 0xA5: lengf=6; CRC_N=8; break; //DeviceMode |
Kovalev_D | 209:224e7331a061 | 909 | case 0xD8: lengf=6; CRC_N=8; break; //m_control |
Kovalev_D | 194:8f3cb37a5541 | 910 | case 0xD9: lengf=6; CRC_N=8; break; //m_control |
Kovalev_D | 209:224e7331a061 | 911 | case 0xE4: lengf=8; CRC_N=6; break; //M_VIB_W |
Kovalev_D | 209:224e7331a061 | 912 | case 0xE6: lengf=8; CRC_N=6; break; //M_Gph_W |
Kovalev_D | 209:224e7331a061 | 913 | |
Kovalev_D | 194:8f3cb37a5541 | 914 | } return lengf; |
igor_v | 0:8ad47e2b6f00 | 915 | } |
igor_v | 0:8ad47e2b6f00 | 916 | |
igor_v | 0:8ad47e2b6f00 | 917 | void Read_CMD(void) |
igor_v | 21:bc8c1cec3da6 | 918 | { |
Kovalev_D | 188:4c523cc373cc | 919 | |
Kovalev_D | 147:1aed74f19a8f | 920 | Gyro.RsErrLine = (Gyro.RsErrLine)& 0xffff;//для сброса ошибки |
Kovalev_D | 188:4c523cc373cc | 921 | CountBuFFIn=ReadChekCon1(BuffTemp); |
Kovalev_D | 188:4c523cc373cc | 922 | // чтение данных из консоли |
Kovalev_D | 188:4c523cc373cc | 923 | if(CountBuFFIn==1) { |
Kovalev_D | 190:289514f730ee | 924 | // если есть первый байт |
Kovalev_D | 209:224e7331a061 | 925 | if (BuffTemp[0] != SOC_In) |
Kovalev_D | 209:224e7331a061 | 926 | { |
Kovalev_D | 147:1aed74f19a8f | 927 | ReadCon1(BuffTemp); |
Kovalev_D | 194:8f3cb37a5541 | 928 | Gyro.RsErrLine += 0x100; |
Kovalev_D | 209:224e7331a061 | 929 | //BuffTemp[99]=Gyro.RsErrLine; |
Kovalev_D | 209:224e7331a061 | 930 | ReadCon1(BuffTemp); |
Kovalev_D | 209:224e7331a061 | 931 | } |
Kovalev_D | 147:1aed74f19a8f | 932 | } |
Kovalev_D | 190:289514f730ee | 933 | else if(CountBuFFIn==2) //если второй байт |
Kovalev_D | 194:8f3cb37a5541 | 934 | { // широковещаительный |
Kovalev_D | 209:224e7331a061 | 935 | if (BuffTemp[1] != Gyro.My_Addres /*|| BuffTemp[1] !=0x1f*/) |
Kovalev_D | 209:224e7331a061 | 936 | { |
Kovalev_D | 93:b3803774f110 | 937 | ReadCon1(BuffTemp); |
Kovalev_D | 194:8f3cb37a5541 | 938 | Gyro.RsErrLine += 0x1; |
Kovalev_D | 209:224e7331a061 | 939 | ReadCon1(BuffTemp); |
Kovalev_D | 188:4c523cc373cc | 940 | } |
Kovalev_D | 147:1aed74f19a8f | 941 | } |
Kovalev_D | 190:289514f730ee | 942 | else if(CountBuFFIn==3) // если третий байт |
Kovalev_D | 147:1aed74f19a8f | 943 | { |
igor_v | 30:17c84ed091b3 | 944 | Gyro.CMD_In=BuffTemp[2]; |
Kovalev_D | 92:c892f0311aa7 | 945 | N=Getlengf(); |
Kovalev_D | 92:c892f0311aa7 | 946 | } |
Kovalev_D | 92:c892f0311aa7 | 947 | else if(CountBuFFIn==4 && (N==6)) |
Kovalev_D | 92:c892f0311aa7 | 948 | { // N - длина посылки аскглд(для записи параметров). определяется по коду команды в Getlengf(); |
igor_v | 21:bc8c1cec3da6 | 949 | Param1=BuffTemp[3]; |
Kovalev_D | 92:c892f0311aa7 | 950 | } |
Kovalev_D | 92:c892f0311aa7 | 951 | else if((CountBuFFIn==5)&&(N==7)) |
Kovalev_D | 92:c892f0311aa7 | 952 | { |
igor_v | 21:bc8c1cec3da6 | 953 | Param1=BuffTemp[3]; |
igor_v | 21:bc8c1cec3da6 | 954 | Param2=BuffTemp[4]; |
igor_v | 0:8ad47e2b6f00 | 955 | |
Kovalev_D | 92:c892f0311aa7 | 956 | } |
Kovalev_D | 92:c892f0311aa7 | 957 | else if((CountBuFFIn==6)&&(N==8)) |
Kovalev_D | 147:1aed74f19a8f | 958 | { |
igor_v | 21:bc8c1cec3da6 | 959 | Param1=BuffTemp[3]; |
igor_v | 21:bc8c1cec3da6 | 960 | Param2=BuffTemp[4]; |
igor_v | 21:bc8c1cec3da6 | 961 | Param3=BuffTemp[5]; |
Kovalev_D | 92:c892f0311aa7 | 962 | } |
Kovalev_D | 102:4270092be987 | 963 | else if((CountBuFFIn==8)&&(N==10)) |
Kovalev_D | 147:1aed74f19a8f | 964 | { |
Kovalev_D | 102:4270092be987 | 965 | Param1=BuffTemp[4]; |
Kovalev_D | 102:4270092be987 | 966 | Param2=BuffTemp[5]; |
Kovalev_D | 102:4270092be987 | 967 | Param3=BuffTemp[6]; |
Kovalev_D | 102:4270092be987 | 968 | Param4=BuffTemp[7]; |
Kovalev_D | 102:4270092be987 | 969 | } |
Kovalev_D | 98:95b8e79f13e1 | 970 | |
Kovalev_D | 92:c892f0311aa7 | 971 | else if(CountBuFFIn > (N-1)) |
Kovalev_D | 92:c892f0311aa7 | 972 | { |
Kovalev_D | 147:1aed74f19a8f | 973 | ReadCon1(BuffTemp); |
Kovalev_D | 208:19150d2b528f | 974 | |
Kovalev_D | 209:224e7331a061 | 975 | //if(SA)CMD_M_Stymul_Answer(); |
Kovalev_D | 208:19150d2b528f | 976 | // if(d8_anser)D8_Answer(); |
Kovalev_D | 208:19150d2b528f | 977 | |
Kovalev_D | 147:1aed74f19a8f | 978 | switch(Gyro.CMD_In) { |
Kovalev_D | 209:224e7331a061 | 979 | case 0x99: /*Gyro.ModeOut=0;*/CMD_Maintenance(); break; |
Kovalev_D | 209:224e7331a061 | 980 | case 0xD8: CMD_M_Control_D8(); break; |
Kovalev_D | 194:8f3cb37a5541 | 981 | case 0xE9: CMD_M_Param_R(); break; //чтение параметров |
Kovalev_D | 194:8f3cb37a5541 | 982 | case 0xE8: CMD_M_Param_W(); break; //запись параметра |
Kovalev_D | 194:8f3cb37a5541 | 983 | case 0xDA: GLDStartDischarg(); break; |
Kovalev_D | 194:8f3cb37a5541 | 984 | case 0xD9: CMD_M_Control_D9(); break; |
Kovalev_D | 208:19150d2b528f | 985 | case 0x0A: CMD_M_Stymul(); break; |
Kovalev_D | 209:224e7331a061 | 986 | case 0xDD: TempParam=(BuffTemp[3]) & 0x9f; //Rate |
Kovalev_D | 193:a0fe8bfc97e4 | 987 | switch(TempParam) { |
Kovalev_D | 209:224e7331a061 | 988 | case Rate1 : CMD_Rate(); break; |
Kovalev_D | 211:ac8251b067d2 | 989 | case Rate2 : Gyro.ModeOut=9; break; |
Kovalev_D | 209:224e7331a061 | 990 | case Rate3 : CMD_Rate3(); break; |
Kovalev_D | 194:8f3cb37a5541 | 991 | case PRate1 : Gyro.ModeOut=1; break; |
Kovalev_D | 211:ac8251b067d2 | 992 | case PRate2 : Gyro.ModeOut=2; break; |
Kovalev_D | 209:224e7331a061 | 993 | case PRate3 : Gyro.ModeOut=8; break; |
Kovalev_D | 193:a0fe8bfc97e4 | 994 | } |
Kovalev_D | 194:8f3cb37a5541 | 995 | break; //DropDelay(); выставка задержки для мультидропа сбрасывается в команде CMD_Maintenance() на () микросекунд; |
Kovalev_D | 209:224e7331a061 | 996 | case 0xA0: /*DropDelay();*/ TempParam=(BuffTemp[3]) & 0x90; //Delta_PS |
Kovalev_D | 193:a0fe8bfc97e4 | 997 | switch(TempParam) { |
Kovalev_D | 193:a0fe8bfc97e4 | 998 | case Delta_500 : CMD_Delta_PS(); break; |
Kovalev_D | 193:a0fe8bfc97e4 | 999 | case Delta_EXT : CMD_Delta_PS(); break; |
Kovalev_D | 196:f76dbc081e63 | 1000 | case PDelta_500 : Gyro.ModeOut=3; Gyro.Event_500Hz=0; break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1001 | case PDelta_EXT : Gyro.ModeOut=4; break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1002 | } |
Kovalev_D | 194:8f3cb37a5541 | 1003 | break; |
Kovalev_D | 194:8f3cb37a5541 | 1004 | case 0xB0: DropDelay(); TempParam = TempParam=(BuffTemp[3]>>7); //Delta_Bins |
Kovalev_D | 193:a0fe8bfc97e4 | 1005 | switch(TempParam) { |
Kovalev_D | 196:f76dbc081e63 | 1006 | case PDelta_Bins: Gyro.ModeOut=5; Gyro.Event_500Hz=0; break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1007 | case Delta_Bins : CMD_Delta_Bins(); break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1008 | } |
Kovalev_D | 194:8f3cb37a5541 | 1009 | break; |
Kovalev_D | 194:8f3cb37a5541 | 1010 | case 0x0F: DropDelay(); TempParam = (((BuffTemp[3])>>4) & 0x9); //B_Delta |
Kovalev_D | 193:a0fe8bfc97e4 | 1011 | switch(TempParam) { |
Kovalev_D | 193:a0fe8bfc97e4 | 1012 | case PB_Delta_EXT: Gyro.ModeOut=6; break; |
Kovalev_D | 196:f76dbc081e63 | 1013 | case PB_Delta_INT: Gyro.ModeOut=7; Gyro.Event_500Hz=0; break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1014 | case B_Delta_EXT: CMD_B_Delta(); break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1015 | case B_Delta_INT: CMD_B_Delta(); break; |
Kovalev_D | 193:a0fe8bfc97e4 | 1016 | } |
Kovalev_D | 194:8f3cb37a5541 | 1017 | break; |
Kovalev_D | 194:8f3cb37a5541 | 1018 | case 0xE4: CMD_M_vib(); break; |
Kovalev_D | 209:224e7331a061 | 1019 | case 0xA5: DeviceMode(); break; |
Kovalev_D | 194:8f3cb37a5541 | 1020 | case 0xE6: Gph_W(); break; |
Kovalev_D | 194:8f3cb37a5541 | 1021 | Gyro.RsErrLine = 0; |
Kovalev_D | 194:8f3cb37a5541 | 1022 | } |
Kovalev_D | 194:8f3cb37a5541 | 1023 | } |
Kovalev_D | 147:1aed74f19a8f | 1024 | } |
Kovalev_D | 193:a0fe8bfc97e4 | 1025 | |
Kovalev_D | 193:a0fe8bfc97e4 | 1026 | |
Kovalev_D | 147:1aed74f19a8f | 1027 | void TechLog(void) |
Kovalev_D | 147:1aed74f19a8f | 1028 | { |
Kovalev_D | 208:19150d2b528f | 1029 | unsigned int temp=0; |
Kovalev_D | 208:19150d2b528f | 1030 | if (ReadCon (Time)) |
Kovalev_D | 208:19150d2b528f | 1031 | { |
Kovalev_D | 147:1aed74f19a8f | 1032 | ///////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 1033 | //////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 1034 | //////////////////////Выбор FlashMod/////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 1035 | //////////////////////////////////////////////////////////////// |
Kovalev_D | 121:bbae560cdd43 | 1036 | |
Kovalev_D | 205:775d54fdf646 | 1037 | if (Time[0] == 'B') Gyro.FlashMod=1; |
Kovalev_D | 147:1aed74f19a8f | 1038 | if (Time[0] == 'R') {Gyro.FlashMod=3;} |
Kovalev_D | 205:775d54fdf646 | 1039 | if (Time[0] == 'E') {Gyro.FlashMod=4;} |
Kovalev_D | 147:1aed74f19a8f | 1040 | /////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 1041 | /////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 1042 | //////////////////////////////////////////////////////////////// |
Kovalev_D | 209:224e7331a061 | 1043 | |
Kovalev_D | 209:224e7331a061 | 1044 | |
Kovalev_D | 209:224e7331a061 | 1045 | |
Kovalev_D | 209:224e7331a061 | 1046 | |
Kovalev_D | 211:ac8251b067d2 | 1047 | /* if (Time[0] == 'f') { // выдача технологическая |
Kovalev_D | 209:224e7331a061 | 1048 | Gyro.ModAmp += 1; |
Kovalev_D | 209:224e7331a061 | 1049 | sprintf((Time),"%d \r\n", Gyro.ModAmp); |
Kovalev_D | 209:224e7331a061 | 1050 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1051 | }*/ |
Kovalev_D | 211:ac8251b067d2 | 1052 | /* if (Time[0] == 'd') { // выдача технологическая |
Kovalev_D | 209:224e7331a061 | 1053 | Gyro.ModAmp -= 1; |
Kovalev_D | 209:224e7331a061 | 1054 | sprintf((Time),"%d \r\n", Gyro.ModAmp); |
Kovalev_D | 209:224e7331a061 | 1055 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1056 | }*/ |
Kovalev_D | 147:1aed74f19a8f | 1057 | if (Time[0] == 'V') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1058 | Gyro.Debag += 10; |
Kovalev_D | 211:ac8251b067d2 | 1059 | } |
Kovalev_D | 147:1aed74f19a8f | 1060 | if (Time[0] == 'v') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1061 | Gyro.Debag -= 10; |
Kovalev_D | 211:ac8251b067d2 | 1062 | |
Kovalev_D | 209:224e7331a061 | 1063 | } |
Kovalev_D | 209:224e7331a061 | 1064 | if (Time[0] == 'C') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1065 | Gyro.Debag += 1000; |
Kovalev_D | 211:ac8251b067d2 | 1066 | |
Kovalev_D | 209:224e7331a061 | 1067 | } |
Kovalev_D | 209:224e7331a061 | 1068 | if (Time[0] == 'c') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1069 | Gyro.Debag -= 1000; |
Kovalev_D | 211:ac8251b067d2 | 1070 | |
Kovalev_D | 209:224e7331a061 | 1071 | } |
Kovalev_D | 209:224e7331a061 | 1072 | if (Time[0] == 'X') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1073 | Spi.DAC_A += 3000; |
Kovalev_D | 211:ac8251b067d2 | 1074 | sprintf((Time),"%d \r\n", Spi.DAC_A); |
Kovalev_D | 211:ac8251b067d2 | 1075 | WriteCon(Time); |
Kovalev_D | 209:224e7331a061 | 1076 | } |
Kovalev_D | 209:224e7331a061 | 1077 | if (Time[0] == 'x') { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1078 | Spi.DAC_A -= 3000; |
Kovalev_D | 211:ac8251b067d2 | 1079 | sprintf((Time),"%d \r\n", Spi.DAC_A); |
Kovalev_D | 211:ac8251b067d2 | 1080 | WriteCon(Time); |
Kovalev_D | 209:224e7331a061 | 1081 | } |
Kovalev_D | 209:224e7331a061 | 1082 | if (Time[0] == 'p') { // выдача технологическая |
Kovalev_D | 209:224e7331a061 | 1083 | PlcOFF //Gyro.RgConA&0x8=0; |
Kovalev_D | 209:224e7331a061 | 1084 | Gyro.LogMod=1; |
Kovalev_D | 211:ac8251b067d2 | 1085 | // MODFlag=1; |
Kovalev_D | 213:9953db9543d6 | 1086 | Spi.DAC_B = 32767; |
Kovalev_D | 209:224e7331a061 | 1087 | } |
Kovalev_D | 209:224e7331a061 | 1088 | if (Time[0] == 'o') { // выдача технологическая |
Kovalev_D | 213:9953db9543d6 | 1089 | if(Gyro.LogMod==2)Gyro.LogMod=0; |
Kovalev_D | 213:9953db9543d6 | 1090 | else Gyro.LogMod=2; |
Kovalev_D | 213:9953db9543d6 | 1091 | |
Kovalev_D | 211:ac8251b067d2 | 1092 | // Spi.DAC_B = 32000; |
Kovalev_D | 209:224e7331a061 | 1093 | } |
Kovalev_D | 211:ac8251b067d2 | 1094 | if (Time[0] == 'm') |
Kovalev_D | 211:ac8251b067d2 | 1095 | { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1096 | /* for(q=0; q<32; q++) |
Kovalev_D | 211:ac8251b067d2 | 1097 | { |
Kovalev_D | 211:ac8251b067d2 | 1098 | sprintf((Time),"%d ", Buff_1Point[q]); |
Kovalev_D | 211:ac8251b067d2 | 1099 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1100 | } |
Kovalev_D | 211:ac8251b067d2 | 1101 | sprintf((Time),"\r\n"); |
Kovalev_D | 211:ac8251b067d2 | 1102 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1103 | for(q=0; q<32; q++) |
Kovalev_D | 211:ac8251b067d2 | 1104 | { |
Kovalev_D | 211:ac8251b067d2 | 1105 | sprintf((Time),"%d ", Buff_Restored_sin [q]); |
Kovalev_D | 211:ac8251b067d2 | 1106 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1107 | }*/ |
Kovalev_D | 211:ac8251b067d2 | 1108 | sprintf((Time),"\r\n"); |
Kovalev_D | 211:ac8251b067d2 | 1109 | WriteCon(Time); |
Kovalev_D | 211:ac8251b067d2 | 1110 | } |
Kovalev_D | 209:224e7331a061 | 1111 | |
Kovalev_D | 209:224e7331a061 | 1112 | if (Time[0] == 'u') |
Kovalev_D | 209:224e7331a061 | 1113 | { // выдача технологическая |
Kovalev_D | 209:224e7331a061 | 1114 | MODFlag=0; //Mod vibro Hz |
Kovalev_D | 211:ac8251b067d2 | 1115 | } |
Kovalev_D | 211:ac8251b067d2 | 1116 | |
Kovalev_D | 211:ac8251b067d2 | 1117 | |
Kovalev_D | 209:224e7331a061 | 1118 | if (Time[0] == 'y') |
Kovalev_D | 209:224e7331a061 | 1119 | { //Mod 250 Hz PLCRegul250(); |
Kovalev_D | 209:224e7331a061 | 1120 | MODFlag=2; |
Kovalev_D | 209:224e7331a061 | 1121 | } |
Kovalev_D | 211:ac8251b067d2 | 1122 | if (Time[0] == 'f') |
Kovalev_D | 211:ac8251b067d2 | 1123 | { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1124 | Gyro.CuruAngleLog = 0; //Mod vibro Hz |
Kovalev_D | 211:ac8251b067d2 | 1125 | } |
Kovalev_D | 211:ac8251b067d2 | 1126 | if (Time[0] == 'd') |
Kovalev_D | 211:ac8251b067d2 | 1127 | { // выдача технологическая |
Kovalev_D | 211:ac8251b067d2 | 1128 | Gyro.CuruAngleLog = 1; //Mod vibro Hz |
Kovalev_D | 211:ac8251b067d2 | 1129 | } |
Kovalev_D | 208:19150d2b528f | 1130 | if (Time[0] == 'l') |
Kovalev_D | 208:19150d2b528f | 1131 | { // выдача технологическая |
Kovalev_D | 206:00341a03e05c | 1132 | Gyro.My_Addres = GyroP.Str.My_Addres; // Gyro.My_Addres = 0; |
Kovalev_D | 208:19150d2b528f | 1133 | Gyro.GLD_Serial = GyroP.Str.GLD_Serial; |
Kovalev_D | 208:19150d2b528f | 1134 | Gyro.FrqHZ = GyroP.Str.FrqHZ; |
Kovalev_D | 206:00341a03e05c | 1135 | Gyro.Frq = GyroP.Str.FrqHZ<<16; |
Kovalev_D | 206:00341a03e05c | 1136 | Gyro.FrqHZmin = GyroP.Str.FrqHZmin<<16; |
Kovalev_D | 206:00341a03e05c | 1137 | Gyro.FrqHZmax = GyroP.Str.FrqHZmax<<16; |
Kovalev_D | 206:00341a03e05c | 1138 | Gyro.FrqChengSpeed = GyroP.Str.FrqChengSpeed; |
Kovalev_D | 208:19150d2b528f | 1139 | Gyro.PLC_Gain = GyroP.Str.PLC_Gain; |
Kovalev_D | 208:19150d2b528f | 1140 | Gyro.PLC_Phase = GyroP.Str.PLC_Phase; |
Kovalev_D | 206:00341a03e05c | 1141 | Gyro.ModAmp = GyroP.Str.ModAmp; |
Kovalev_D | 208:19150d2b528f | 1142 | Gyro.FrqPhase = GyroP.Str.FrqPhase; |
Kovalev_D | 206:00341a03e05c | 1143 | Gyro.AmpPer = GyroP.Str.AmpPer; |
Kovalev_D | 206:00341a03e05c | 1144 | Gyro.Amp = GyroP.Str.AmpPer<<16; |
Kovalev_D | 208:19150d2b528f | 1145 | Gyro.AmpSpeed = GyroP.Str.AmpSpeed; |
Kovalev_D | 206:00341a03e05c | 1146 | Gyro.AmpPerDel = GyroP.Str.AmpPerDel; |
Kovalev_D | 208:19150d2b528f | 1147 | temp=((GyroP.Str.VB_Fdf_Hi<<16) | GyroP.Str.VB_Fdf_Lo); |
Kovalev_D | 208:19150d2b528f | 1148 | temp=temp/18.2; |
Kovalev_D | 208:19150d2b528f | 1149 | Gyro.AmpTarget=(unsigned int)(temp); |
Kovalev_D | 206:00341a03e05c | 1150 | Gyro.AmpPerMin = GyroP.Str.AmpPerMin; |
Kovalev_D | 206:00341a03e05c | 1151 | Gyro.AmpPerMax = GyroP.Str.AmpPerMax; |
Kovalev_D | 206:00341a03e05c | 1152 | Gyro.AmpMin = GyroP.Str.AmpMin; |
Kovalev_D | 206:00341a03e05c | 1153 | Gyro.AmpTD = GyroP.Str.AmpTD; |
Kovalev_D | 208:19150d2b528f | 1154 | Spi.DAC_A = GyroP.Str.DAC_current_Work; |
Kovalev_D | 206:00341a03e05c | 1155 | Gyro.Gain_Sin = GyroP.Str.Gain_Sin; |
Kovalev_D | 206:00341a03e05c | 1156 | Gyro.Gain_Cos = GyroP.Str.Gain_Cos; |
Kovalev_D | 207:d1ce992f5d17 | 1157 | Out_G_photo(Gyro.Gain_Sin, Gyro.Gain_Cos); |
Kovalev_D | 206:00341a03e05c | 1158 | } |
Kovalev_D | 208:19150d2b528f | 1159 | |
Kovalev_D | 208:19150d2b528f | 1160 | |
Kovalev_D | 208:19150d2b528f | 1161 | } |
igor_v | 0:8ad47e2b6f00 | 1162 | } |
igor_v | 0:8ad47e2b6f00 | 1163 | |
igor_v | 0:8ad47e2b6f00 | 1164 |