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