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