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