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