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