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