![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LGstaandart by
Revision 232:130a2b5003e6, committed 2018-01-31
- Comitter:
- Kovalev_D
- Date:
- Wed Jan 31 13:41:23 2018 +0000
- Parent:
- 231:079835d508ef
- Commit message:
- static termocorr
Changed in this revision
--- a/Command.c Thu Jan 25 13:59:43 2018 +0000 +++ b/Command.c Wed Jan 31 13:41:23 2018 +0000 @@ -113,7 +113,29 @@ case 1: if(Gyro.Rate1_Event ) CMD_Rate(); break; case 2: if(Gyro.Reper_Event ) CMD_Rate2(); break; case 3: if(Gyro.Event_500Hz ) CMD_Delta_PS(); break; - case 4: if(Gyro.EXT_Latch ) CMD_Delta_PS(); Gyro.EXT_Latch=0; break; + case 4: + + if(Gyro.EXT_Latch ){ + Gyro.EXT_Latch=0; + LoopOn + LoopOn + LoopOn + LoopOn + LoopOn + LoopOn + + LoopOn + LoopOn + LoopOn + LoopOn + + LoopOn + CMD_Delta_PS(); + + LoopOff + //NVIC_EnableIRQ(EINT3_IRQn); + } + break; case 5: if(Gyro.Event_500Hz ) CMD_Delta_Bins(); break; case 6: if(Gyro.EXT_Latch ) CMD_B_Delta(); Gyro.EXT_Latch=0; break; case 7: if(Gyro.Event_500Hz ) CMD_B_Delta(); break; @@ -245,46 +267,182 @@ } - return SimpleFloat.num*10000; + return SimpleFloat.num; } -void Switch(unsigned int NP) -{ - unsigned int TempTermodataHi, TempTermodataLo; - switch(NP) + +void CMD_M_Param_W(void) +{ + unsigned int NP=0; + unsigned int Param,temp,flash; + unsigned int TempTermodataHi, TempTermodataLo; + float Ttemp; + + NP = BuffTemp[3]; + Param = (BuffTemp[4]<<8); + Param |= BuffTemp[5]; + + GyroP.Array[NP] = Param; + flash=GyroP.Array[115]; + Gyro.NP=NP; + WriteCon(Time); + switch(NP) { - case 63: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0; break; - case 64: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1; break; - case 65: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2; break; - case 66: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3; break; - case 67: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4; break; - case 68: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5; break; - case 69: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6; break; - case 70: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7; break; - case 71: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8; break; - case 72: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9; break; - case 73: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10; break; - case 74: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11; break; - case 75: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12; break; - case 76: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13; break; - + case 63: + if(GyroP.Str.TStatic_0&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0; + break; + + case 64: + if(GyroP.Str.TStatic_1&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1; + break; + + case 65: + if(GyroP.Str.TStatic_2&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2; + break; + + case 66: + if(GyroP.Str.TStatic_3&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3; + break; + + case 67: + if(GyroP.Str.TStatic_4&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4; + break; + + case 68: + if(GyroP.Str.TStatic_5&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5; + break; + + case 69: + if(GyroP.Str.TStatic_6&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6; + break; + + case 70: + if(GyroP.Str.TStatic_7&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7; + break; + + case 71: + if(GyroP.Str.TStatic_8&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8; + break; + + case 72: + if(GyroP.Str.TStatic_9&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9; + break; + + case 73: + if(GyroP.Str.TStatic_10&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10; + break; + + case 74: + if(GyroP.Str.TStatic_11&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11; + break; + + case 75: + if(GyroP.Str.TStatic_12&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12; + break; + + case 76: + if(GyroP.Str.TStatic_13&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13; + break; + + + + + + + - case 160: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; break; - case 161: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1; break; - case 162: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2; break; - case 163: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3; break; - case 164: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4; break; - case 165: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5; break; - case 166: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6; break; - case 167: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7; break; - case 168: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8; break; - case 169: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9; break; - case 170: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10; break; - case 171: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11; break; - case 172: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12; break; - case 173: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13; break; + case 160: + if(GyroP.Str.TDCool_0&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; + break; + + case 161: + if(GyroP.Str.TDCool_1&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1; + break; + + case 162: + if(GyroP.Str.TDCool_2&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2; + break; + + case 163: + if(GyroP.Str.TDCool_3&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3; + break; + + case 164: + if(GyroP.Str.TDCool_4&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4; + break; + + case 165: + if(GyroP.Str.TDCool_5&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5; + break; + + case 166: + if(GyroP.Str.TDCool_6&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6; + break; - + case 167: + if(GyroP.Str.TDCool_7&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7; + break; + + case 168: + if(GyroP.Str.TDCool_8&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8; + break; + + case 169: + if(GyroP.Str.TDCool_9&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9; + break; + + case 170: + if(GyroP.Str.TDCool_10&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10; + break; + + case 171: + if(GyroP.Str.TDCool_11&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11; + break; + + case 172: + if(GyroP.Str.TDCool_12&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12; + break; + + case 173: + if(GyroP.Str.TDCool_13&0x8000)TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13 - 65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13; + break; + + + + + + + + + case 78: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_0 = Float(GyroP.Str.TermoDeltaStatic_0, GyroP.Str.TermoDeltaStatic_1 ); break; case 80: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_1 = Float(GyroP.Str.TermoDeltaStatic_2, GyroP.Str.TermoDeltaStatic_3 ); break; case 82: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_2 = Float(GyroP.Str.TermoDeltaStatic_4, GyroP.Str.TermoDeltaStatic_5 ); break; @@ -298,78 +456,27 @@ case 98: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_10 = Float(GyroP.Str.TermoDeltaStatic_20,GyroP.Str.TermoDeltaStatic_21); break; case 100: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_11 = Float(GyroP.Str.TermoDeltaStatic_22,GyroP.Str.TermoDeltaStatic_23); break; case 102: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_12 = Float(GyroP.Str.TermoDeltaStatic_24,GyroP.Str.TermoDeltaStatic_25); break; - case 104: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_13 = Float(GyroP.Str.TermoDeltaStatic_26,GyroP.Str.TermoDeltaStatic_27); break; - case 175: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_0 = Float(GyroP.Str.TermoDynamicDataHeat0, GyroP.Str.TermoDynamicDataHeat1 ); break; - case 177: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_1 = Float(GyroP.Str.TermoDynamicDataHeat2, GyroP.Str.TermoDynamicDataHeat3 ); break; - case 179: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_2 = Float(GyroP.Str.TermoDynamicDataHeat4, GyroP.Str.TermoDynamicDataHeat5 ); break; - case 181: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_3 = Float(GyroP.Str.TermoDynamicDataHeat6, GyroP.Str.TermoDynamicDataHeat7 ); break; - case 183: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_4 = Float(GyroP.Str.TermoDynamicDataHeat8, GyroP.Str.TermoDynamicDataHeat9 ); break; - case 185: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_5 = Float(GyroP.Str.TermoDynamicDataHeat10,GyroP.Str.TermoDynamicDataHeat11); break; - case 187: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_6 = Float(GyroP.Str.TermoDynamicDataHeat12,GyroP.Str.TermoDynamicDataHeat13); break; - case 189: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_7 = Float(GyroP.Str.TermoDynamicDataHeat14,GyroP.Str.TermoDynamicDataHeat15); break; - case 191: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_8 = Float(GyroP.Str.TermoDynamicDataHeat16,GyroP.Str.TermoDynamicDataHeat17); break; - case 193: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_9 = Float(GyroP.Str.TermoDynamicDataHeat18,GyroP.Str.TermoDynamicDataHeat19); break; - case 195: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_10 = Float(GyroP.Str.TermoDynamicDataHeat20,GyroP.Str.TermoDynamicDataHeat21); break; - case 197: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_11 = Float(GyroP.Str.TermoDynamicDataHeat22,GyroP.Str.TermoDynamicDataHeat23); break; - case 199: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_12 = Float(GyroP.Str.TermoDynamicDataHeat24,GyroP.Str.TermoDynamicDataHeat25); break; - case 201: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_13 = Float(GyroP.Str.TermoDynamicDataHeat26,GyroP.Str.TermoDynamicDataHeat27); break; - } - -} -void CMD_M_Param_W(void) -{ - unsigned int NP=0; - unsigned int Param,temp,flash; - unsigned int TempTermodataHi, TempTermodataLo; - float Ttemp; - - NP = BuffTemp[3]; - Param = (BuffTemp[4]<<8); - Param |= BuffTemp[5]; - - GyroP.Array[NP] = Param; - flash=GyroP.Array[115]; - sprintf((Time),"READ NP= <%07d> Param = <%07d> \r\n", NP, Param); - WriteCon(Time); - Gyro.NP=NP; - // Switch(NP); - - switch(NP) - { - case 63: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0; break; - case 64: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1; break; - case 65: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2; break; - case 66: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3; break; - case 67: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4; break; - case 68: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5; break; - case 69: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6; break; - case 70: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7; break; - case 71: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8; break; - case 72: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9; break; - case 73: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10; break; - case 74: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11; break; - case 75: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12; break; - case 76: TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13; break; - - - case 160: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; break; - case 161: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1; break; - case 162: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2; break; - case 163: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3; break; - case 164: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4; break; - case 165: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5; break; - case 166: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6; break; - case 167: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7; break; - case 168: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8; break; - case 169: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9; break; - case 170: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10; break; - case 171: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11; break; - case 172: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12; break; - case 173: TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13; break; - - - - //case 0: Gyro.My_Addres = GyroP.Str.My_Addres; break; + case 104: TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_13 = Float(GyroP.Str.TermoDeltaStatic_26,GyroP.Str.TermoDeltaStatic_27); break; + + case 175: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_0 = Float(GyroP.Str.TermoDynamicData_0, GyroP.Str.TermoDynamicData_1 ); break; + case 177: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_1 = Float(GyroP.Str.TermoDynamicData_2, GyroP.Str.TermoDynamicData_3 ); break; + case 179: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_2 = Float(GyroP.Str.TermoDynamicData_4, GyroP.Str.TermoDynamicData_5 ); break; + case 181: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_3 = Float(GyroP.Str.TermoDynamicData_6, GyroP.Str.TermoDynamicData_7 ); break; + case 183: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_4 = Float(GyroP.Str.TermoDynamicData_8, GyroP.Str.TermoDynamicData_9 ); break; + case 185: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_5 = Float(GyroP.Str.TermoDynamicData_10, GyroP.Str.TermoDynamicData_11); break; + case 187: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_6 = Float(GyroP.Str.TermoDynamicData_12, GyroP.Str.TermoDynamicData_13); break; + case 189: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_7 = Float(GyroP.Str.TermoDynamicData_14, GyroP.Str.TermoDynamicData_15); break; + case 191: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_8 = Float(GyroP.Str.TermoDynamicData_16, GyroP.Str.TermoDynamicData_17); break; + case 193: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_9 = Float(GyroP.Str.TermoDynamicData_18, GyroP.Str.TermoDynamicData_19); break; + case 195: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_10 = Float(GyroP.Str.TermoDynamicData_20, GyroP.Str.TermoDynamicData_21); break; + case 197: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_11 = Float(GyroP.Str.TermoDynamicData_22, GyroP.Str.TermoDynamicData_23); break; + case 199: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_12 = Float(GyroP.Str.TermoDynamicData_24, GyroP.Str.TermoDynamicData_25); break; + case 201: TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_13 = Float(GyroP.Str.TermoDynamicData_26, GyroP.Str.TermoDynamicData_27); break; + + + + //case 0: Gyro.My_Addres = GyroP.Str.My_Addres; break; + case 159: Gyro.step = GyroP.Str.Step; break; case 1: Gyro.HFO_ref = (unsigned int)(GyroP.Str.HFO_ref) ; break; case 2: Gyro.HFO_Gain = GyroP.Str.HFO_Gain; break; case 3: if(Gyro.LG_Type) Gyro.HFO_Max=0xffff-GyroP.Str.DAC_current_Work; //((int)(GyroP.Str.DAC_current_Work*0.67)-2000); @@ -417,19 +524,32 @@ case 57: Gyro.Gain_Cos = GyroP.Str.Gain_Cos; Out_G_photo(Gyro.Gain_Sin, Gyro.Gain_Cos); break; - case 60: Gyro.GLD_Serial = GyroP.Str.GLD_Serial; break; + case 60: Gyro.GLD_Serial = GyroP.Str.GLD_Serial; break; + // case 62: Gyro.TermoMod = GyroP.Str.TermoMode; break; + + case 10: Gyro.DownTreshold = (unsigned int)((GyroP.Str.DownTreshold-0x7fff)&0xffff); break; + case 11: Gyro.HighTreshold = (unsigned int)((GyroP.Str.HighTreshold-0x7fff)&0xffff); break; + + case 9: Gyro.PLCDelay = GyroP.Str.PLCDelay; break; + + case 105:Gyro.ResetLevelCool = (unsigned int)((GyroP.Str.ResetLevelCool-0x7fff)&0xffff); break; + case 116:Gyro.HFO_Gain_Reset_PLC = GyroP.Str.HFO_Gain_Reset_PLC; break; + case 55: Gyro.ResetLevelHeat = (unsigned int)((GyroP.Str.ResetLevelHeat-0x7fff)&0xffff); break; - case 10: Gyro.DownTreshold = (unsigned int)((GyroP.Str.DownTreshold-0x7fff)&0xffff); break; - case 11: Gyro.HighTreshold = (unsigned int)((GyroP.Str.HighTreshold-0x7fff)&0xffff); break; - case 9: Gyro.PLCDelay = GyroP.Str.PLCDelay; break; - case 105:Gyro.ResetLevelCool = (unsigned int)((GyroP.Str.ResetLevelCool-0x7fff)&0xffff); break; - case 55: Gyro.ResetLevelHeat = (unsigned int)((GyroP.Str.ResetLevelHeat-0x7fff)&0xffff); break; - + case 47: + if(GyroP.Str.Tmp_OffsetT4&0x8000) Gyro.Tmp_OffsetT4 = GyroP.Str.Tmp_OffsetT4 - 65536; + else Gyro.Tmp_OffsetT4 = GyroP.Str.Tmp_OffsetT4; + break; + + case 48: + if(GyroP.Str.Tmp_OffsetT5&0x8000) Gyro.Tmp_OffsetT5 = GyroP.Str.Tmp_OffsetT5 - 65536; + else Gyro.Tmp_OffsetT5 = GyroP.Str.Tmp_OffsetT5; + break; - default : Gyro.ParamFlag=1; + } @@ -500,7 +620,8 @@ } void CMD_Delta_Bins(void) -{ Gyro.Event_500Hz=0; +{ + Gyro.Event_500Hz=0; unsigned int Temp; BuffTemp[ 0] = Gyro.SOC_Out; BuffTemp[ 1] = Gyro.My_Addres; @@ -519,17 +640,15 @@ void CMD_Delta_PS(void) { int drob,Temp1; float Temp2=0; - Gyro.EXT_Latch=0; - Gyro.Event_500Hz=0; + unsigned int Temp; - - - + + Gyro.Event_500Hz=0; BuffTemp[ 0] = Gyro.SOC_Out; BuffTemp[ 1] = Gyro.My_Addres; - - Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle; //(72 град/с) - + Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle + Gyro.AngelCompens; + + Gyro.AngelCompens=0; OldCuruAngle=Gyro.CuruAngle & 0xf; //сохраняем 3 бит для след измирений Temp=Gyro.CuruAngle>>4; //приводим к форме вывода @@ -687,10 +806,10 @@ Check(BuffTemp, CRC_N); WriteConN (BuffTemp,CRC_N); - + if(CountParam>20)CountParam=0;//зацикливания буфера от 0 до 21 else CountParam++; - + } @@ -736,15 +855,18 @@ BuffTemp[ 0] = Gyro.SOC_Out; //1 --старт данных BuffTemp[ 1] = Gyro.My_Addres; //2 --адрес отвечающего устройствва - BuffTemp[ 2] =( Gyro.CaunPlusReper >> 8) & 0xff;//старший байт счетчика +. 3 --сарший байт счентчика + - BuffTemp[ 3] =( Gyro.CaunPlusReper >> 0) & 0xff;//младший байт счетчика +. 4 --младший байт счетчика + + BuffTemp[ 2] =( Gyro.CaunPlusReper >> 8) & 0xff;//старший байт счетчика +. 3 --сарший байт счентчика + + BuffTemp[ 3] =( Gyro.CaunPlusReper >> 0) & 0xff;//младший байт счетчика +. 4 --младший байт счетчика + BuffTemp[ 4] =( Gyro.CaunMinReper >> 8) & 0xff;//старший байт счетчика -. 5 --сарший байт счентчика - BuffTemp[ 5] =( Gyro.CaunMinReper >> 0) & 0xff;//младший байт счетчика -. 6 --младший байт счетчика - + + - Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle; //(72 град/с) - OldCuruAngle=Gyro.CuruAngle & 0x3f; //сохраняем 5 бит для след измирений - Temp=Gyro.CuruAngle>>6; //приводим к форме вывода + Gyro.CuruAngle = Gyro.CuruAngle + OldCuruAngle + Gyro.AngelCompens; //(72 град/с) + + OldCuruAngle=Gyro.CuruAngle & 0x3f; //сохраняем 5 бит для след измирений + Temp=Gyro.CuruAngle>>6; //приводим к форме вывода Gyro.AngelCompens=0; Gyro.CuruAngle = 0; @@ -808,24 +930,24 @@ BuffTemp[26] = (Temp >> 8) & 0xff; //27 ADC 0 BuffTemp[27] = (Temp >> 0) & 0xff; //28 - Temp =0; /*Gyro.AD_Slow >> 16*/; + Temp = 0; /*Gyro.AD_Slow >> 16*/; BuffTemp[28] = (Temp >> 8) & 0xff; //29 ADC 1 BuffTemp[29] = (Temp >> 0) & 0xff; //30 - Temp1 = 0;//((Gyro.In1>>1)*0.800875)-0x3e0b; + Temp1 =Gyro.DeltaTRate;//((Gyro.In1>>1)*0.800875)-0x3e0b; BuffTemp[30] = (Temp1 >> 8) & 0xff;//in1//2 //31 ADC 2 BuffTemp[31] = (Temp1 >> 0) & 0xff; //32 - Temp1 =0;//((Gyro.In2>>1)*0.800875)-0x3e0b;// - 0x4FFF; + Temp1 =Gyro.DeltaTRate/163;//((Gyro.In2>>1)*0.800875)-0x3e0b;// - 0x4FFF; BuffTemp[32] = (Temp1 >> 8) & 0xff; //33 ADC 3 BuffTemp[33] = (Temp1 >> 0) & 0xff;//in2//3 //34 - Temp = (Gyro.DeltaT); + Temp = Gyro.Termo; BuffTemp[34] = (Temp >> 8) & 0xff;//дельта //35 ADC 4 BuffTemp[35] = (Temp >> 0) & 0xff; //36 // Temp = 000; - Temp = Gyro.Termo; + Temp = (Gyro.DeltaT); BuffTemp[36] =(Temp >> 8) & 0xff;//температура //37 ADC 5 BuffTemp[37] =(Temp >> 0) & 0xff;//ADC6 sesnsor 5 //38
--- a/Command.h Thu Jan 25 13:59:43 2018 +0000 +++ b/Command.h Wed Jan 31 13:41:23 2018 +0000 @@ -64,5 +64,5 @@ extern void DropDelay(void); extern void M_RateA(void); extern void ReadFlash (void); -extern void Switch(unsigned int NP); + float Float(unsigned int TermoHi,unsigned int TermoLo); \ No newline at end of file
--- a/Global.c Thu Jan 25 13:59:43 2018 +0000 +++ b/Global.c Wed Jan 31 13:41:23 2018 +0000 @@ -316,6 +316,12 @@ if(GyroP.Str.ParamMod==1) { Gyro.ShowMod2=0; + // Gyro.TermoMod = GyroP.Str.TermoMode; + + + + + Gyro.TimeToJump = GyroP.Str.TimeToJump; Gyro.JumpDelta = GyroP.Str.JumpDelta; Gyro.ShiftMod = GyroP.Str.ShiftMod; @@ -326,6 +332,7 @@ Gyro.ResetLevelCool = (unsigned int)((GyroP.Str.ResetLevelCool-0x7fff)&0xffff); //105 Gyro.ResetLevelHeat = (unsigned int)((GyroP.Str.ResetLevelHeat-0x7fff)&0xffff); Gyro.HFO_Gain = GyroP.Str.HFO_Gain; + Gyro.HFO_Gain_Reset_PLC = GyroP.Str.HFO_Gain_Reset_PLC; Gyro.HFO_ref = (unsigned int)(GyroP.Str.HFO_ref); Gyro.LG_Type = GyroP.Str.LG_Type; Gyro.LG_Type = 1; @@ -340,7 +347,7 @@ Gyro.PLC_Phase = GyroP.Str.PLC_Phase; Gyro.ModAmp = GyroP.Str.ModAmp; Gyro.FrqPhase = GyroP.Str.FrqPhase; - Gyro.AmpPer = 700;//GyroP.Str.AmpPer*100; + //Gyro.AmpPer = 700;//GyroP.Str.AmpPer*100; Gyro.Amp =(GyroP.Str.AmpPer<<17); Gyro.AmpSpeed = GyroP.Str.AmpSpeed; Gyro.AmpPerDel = GyroP.Str.AmpPerDel; @@ -351,6 +358,7 @@ Gyro.AmpPerMax = GyroP.Str.AmpPerMax; Gyro.AmpMin = GyroP.Str.AmpMin; Gyro.AmpTD = GyroP.Str.AmpTD; + F_vib=(103200000<<5)/((Gyro.Frq)>>10);//периуд вибро. T_vibP = F_vib/10000; T_vib_1 = Gyro.AmpPer * T_vibP; @@ -375,22 +383,59 @@ Gyro.Gain_Sin = GyroP.Str.Gain_Sin; Gyro.Gain_Cos = GyroP.Str.Gain_Cos; Out_G_photo(Gyro.Gain_Sin, Gyro.Gain_Cos); - + + if(GyroP.Str.Tmp_OffsetT4&0x8000) Gyro.Tmp_OffsetT4 = GyroP.Str.Tmp_OffsetT4 - 65536; + else Gyro.Tmp_OffsetT4 = GyroP.Str.Tmp_OffsetT4; + + if(GyroP.Str.Tmp_OffsetT5&0x8000) Gyro.Tmp_OffsetT5 = GyroP.Str.Tmp_OffsetT5 - 65536; + else Gyro.Tmp_OffsetT5 = GyroP.Str.Tmp_OffsetT5; + + + - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12; - TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13; + if(GyroP.Str.TStatic_0&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_0 = GyroP.Str.TStatic_0; + + if(GyroP.Str.TStatic_1&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1 - 65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_1 = GyroP.Str.TStatic_1; + + if(GyroP.Str.TStatic_2&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_2 = GyroP.Str.TStatic_2; + + if(GyroP.Str.TStatic_3&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_3 = GyroP.Str.TStatic_3; + + if(GyroP.Str.TStatic_4&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_4 = GyroP.Str.TStatic_4; + + if(GyroP.Str.TStatic_5&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_5 = GyroP.Str.TStatic_5; + + if(GyroP.Str.TStatic_6&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_6 = GyroP.Str.TStatic_6; + + if(GyroP.Str.TStatic_7&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_7 = GyroP.Str.TStatic_7; + + if(GyroP.Str.TStatic_8&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_8 = GyroP.Str.TStatic_8; + + if(GyroP.Str.TStatic_9&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_9 = GyroP.Str.TStatic_9; + + if(GyroP.Str.TStatic_10&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_10 = GyroP.Str.TStatic_10; + + if(GyroP.Str.TStatic_11&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_11 = GyroP.Str.TStatic_11; + + if(GyroP.Str.TStatic_12&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_12 = GyroP.Str.TStatic_12; + + if(GyroP.Str.TStatic_13&0x8000) TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13-65536; + else TermoCorrStatic.TermoTempStatic.Str.TermoTempStatic_13 = GyroP.Str.TStatic_13; + + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_0 = Float(GyroP.Str.TermoDeltaStatic_0, GyroP.Str.TermoDeltaStatic_1 ); @@ -408,8 +453,67 @@ TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_12 = Float(GyroP.Str.TermoDeltaStatic_24,GyroP.Str.TermoDeltaStatic_25); TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_13 = Float(GyroP.Str.TermoDeltaStatic_26,GyroP.Str.TermoDeltaStatic_27); - - TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; + + /* + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_0 = Float(GyroP.Str.TermoDeltaStatic_1, GyroP.Str.TermoDeltaStatic_0); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_1 = Float(GyroP.Str.TermoDeltaStatic_3, GyroP.Str.TermoDeltaStatic_2); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_2 = Float(GyroP.Str.TermoDeltaStatic_5, GyroP.Str.TermoDeltaStatic_4); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_3 = Float(GyroP.Str.TermoDeltaStatic_7, GyroP.Str.TermoDeltaStatic_6); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_4 = Float(GyroP.Str.TermoDeltaStatic_9, GyroP.Str.TermoDeltaStatic_8); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_5 = Float(GyroP.Str.TermoDeltaStatic_11,GyroP.Str.TermoDeltaStatic_10); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_6 = Float(GyroP.Str.TermoDeltaStatic_13,GyroP.Str.TermoDeltaStatic_12); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_7 = Float(GyroP.Str.TermoDeltaStatic_15,GyroP.Str.TermoDeltaStatic_14); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_8 = Float(GyroP.Str.TermoDeltaStatic_17,GyroP.Str.TermoDeltaStatic_16); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_9 = Float(GyroP.Str.TermoDeltaStatic_19,GyroP.Str.TermoDeltaStatic_18); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_10 = Float(GyroP.Str.TermoDeltaStatic_21,GyroP.Str.TermoDeltaStatic_20); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_11 = Float(GyroP.Str.TermoDeltaStatic_23,GyroP.Str.TermoDeltaStatic_22); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_12 = Float(GyroP.Str.TermoDeltaStatic_25,GyroP.Str.TermoDeltaStatic_24); + TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_13 = Float(GyroP.Str.TermoDeltaStatic_27,GyroP.Str.TermoDeltaStatic_26); + */ + if(GyroP.Str.TDCool_0&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; + + if(GyroP.Str.TDCool_1&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1; + + if(GyroP.Str.TDCool_2&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2; + + if(GyroP.Str.TDCool_3&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3; + + if(GyroP.Str.TDCool_4&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_4 = GyroP.Str.TDCool_4; + + if(GyroP.Str.TDCool_5&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_5 = GyroP.Str.TDCool_5; + + if(GyroP.Str.TDCool_6&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_6 = GyroP.Str.TDCool_6; + + if(GyroP.Str.TDCool_7&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_7 = GyroP.Str.TDCool_7; + + if(GyroP.Str.TDCool_8&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_8 = GyroP.Str.TDCool_8; + + if(GyroP.Str.TDCool_9&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_9 = GyroP.Str.TDCool_9; + + if(GyroP.Str.TDCool_10&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_10 = GyroP.Str.TDCool_10; + + if(GyroP.Str.TDCool_11&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_11 = GyroP.Str.TDCool_11; + + if(GyroP.Str.TDCool_12&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12; + + if(GyroP.Str.TDCool_13&0x8000) TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13-65536; + else TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13; + + /* + TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_0 = GyroP.Str.TDCool_0; TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_1 = GyroP.Str.TDCool_1; TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_2 = GyroP.Str.TDCool_2; TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_3 = GyroP.Str.TDCool_3; @@ -424,22 +528,22 @@ TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_12 = GyroP.Str.TDCool_12; TermoCorrDynamic.TermoTempDynamic.Str.TermoTempDynamic_13 = GyroP.Str.TDCool_13; - +*/ - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_0 = Float(GyroP.Str.TermoDynamicDataHeat0, GyroP.Str.TermoDynamicDataHeat1 ); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_1 = Float(GyroP.Str.TermoDynamicDataHeat2, GyroP.Str.TermoDynamicDataHeat3 ); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_2 = Float(GyroP.Str.TermoDynamicDataHeat4, GyroP.Str.TermoDynamicDataHeat5 ); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_3 = Float(GyroP.Str.TermoDynamicDataHeat6, GyroP.Str.TermoDynamicDataHeat7 ); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_4 = Float(GyroP.Str.TermoDynamicDataHeat8, GyroP.Str.TermoDynamicDataHeat9 ); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_5 = Float(GyroP.Str.TermoDynamicDataHeat10,GyroP.Str.TermoDynamicDataHeat11); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_6 = Float(GyroP.Str.TermoDynamicDataHeat12,GyroP.Str.TermoDynamicDataHeat13); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_7 = Float(GyroP.Str.TermoDynamicDataHeat14,GyroP.Str.TermoDynamicDataHeat15); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_8 = Float(GyroP.Str.TermoDynamicDataHeat16,GyroP.Str.TermoDynamicDataHeat17); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_9 = Float(GyroP.Str.TermoDynamicDataHeat18,GyroP.Str.TermoDynamicDataHeat19); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_10 = Float(GyroP.Str.TermoDynamicDataHeat20,GyroP.Str.TermoDynamicDataHeat21); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_11 = Float(GyroP.Str.TermoDynamicDataHeat22,GyroP.Str.TermoDynamicDataHeat23); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_12 = Float(GyroP.Str.TermoDynamicDataHeat24,GyroP.Str.TermoDynamicDataHeat25); - TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_13 = Float(GyroP.Str.TermoDynamicDataHeat26,GyroP.Str.TermoDynamicDataHeat27); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_0 = Float(GyroP.Str.TermoDynamicData_0, GyroP.Str.TermoDynamicData_1 ); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_1 = Float(GyroP.Str.TermoDynamicData_2, GyroP.Str.TermoDynamicData_3 ); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_2 = Float(GyroP.Str.TermoDynamicData_4, GyroP.Str.TermoDynamicData_5 ); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_3 = Float(GyroP.Str.TermoDynamicData_6, GyroP.Str.TermoDynamicData_7 ); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_4 = Float(GyroP.Str.TermoDynamicData_8, GyroP.Str.TermoDynamicData_9 ); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_5 = Float(GyroP.Str.TermoDynamicData_10, GyroP.Str.TermoDynamicData_11); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_6 = Float(GyroP.Str.TermoDynamicData_12, GyroP.Str.TermoDynamicData_13); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_7 = Float(GyroP.Str.TermoDynamicData_14, GyroP.Str.TermoDynamicData_15); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_8 = Float(GyroP.Str.TermoDynamicData_16, GyroP.Str.TermoDynamicData_17); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_9 = Float(GyroP.Str.TermoDynamicData_18, GyroP.Str.TermoDynamicData_19); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_10 = Float(GyroP.Str.TermoDynamicData_20, GyroP.Str.TermoDynamicData_21); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_11 = Float(GyroP.Str.TermoDynamicData_22, GyroP.Str.TermoDynamicData_23); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_12 = Float(GyroP.Str.TermoDynamicData_24, GyroP.Str.TermoDynamicData_25); + TermoCorrDynamic.TermoDeltaDynamic.Str.TermoDeltaDynamic_13 = Float(GyroP.Str.TermoDynamicData_26, GyroP.Str.TermoDynamicData_27); } else { @@ -541,11 +645,11 @@ Last_QEI=0; } void BUTTON_init(void) { - LPC_GPIO0->FIODIR &= ~(1 << 1); /* PORT2.10 defined as input */ - LPC_GPIOINT->IO0IntEnF |= (1 << 1); /* enable falling edge irq */ + if(Gyro.EXT_Latch)Gyro.EXT_Latch=0; + else Gyro.EXT_Latch=1; + LPC_GPIOINT->IO2IntClr |= (1 << 10); +} - NVIC_EnableIRQ(EINT3_IRQn); /* enable irq in nvic */ -} /*void EINT3_IRQHandler() { if(Gyro.EXT_Latch)Gyro.EXT_Latch=0;
--- a/InputOutput.c Thu Jan 25 13:59:43 2018 +0000 +++ b/InputOutput.c Wed Jan 31 13:41:23 2018 +0000 @@ -1,6 +1,6 @@ #include "Global.h" INPUT Input; -OUTPUT Output; +//OUTPUT Output; volatile uint32_t I2CMasterState = I2C_IDLE; volatile uint32_t I2CMasterBuffer[I2C_WRITELENGTH]; @@ -64,17 +64,17 @@ { I2CMasterState = I2C_IDLE; LPC_I2C0->CONSET = I2CONSET_STO; //e. Set Stop flag - Output.Str.Cnt_Dif = 300; + // Output.Str.Cnt_Dif = 300; } else if (WrIndex == 3) { LPC_I2C0->CONSET = I2CONSET_STA; - Output.Str.Cnt_Dif = 200; + // Output.Str.Cnt_Dif = 200; } else { LPC_I2C0->DAT = I2CMasterBuffer[WrIndex++]; //e. send another byte - Output.Str.Cnt_Dif = 100; + // Output.Str.Cnt_Dif = 100; } LPC_I2C0->CONCLR = I2CONCLR_SIC; //e. clear interrupt bit break; @@ -112,12 +112,12 @@ if (WRITE_DAC0 & 1)//если нечетный такт то { LPC_SSP0->DR = WRITE_DAC0; //e.команда для ЦАП_0 передавать. - LPC_SSP0->DR = (-Output.ArrayOut[3]+32767); //e. передача 12 бит + // LPC_SSP0->DR = (-Output.ArrayOut[3]+32767); //e. передача 12 бит } else //если такт четный. { LPC_SSP0->DR = WRITE_DAC1 ; //e.команда для ЦАП_1 передавать. - LPC_SSP0->DR = (Output.ArrayOut[0]<<1) & 0xFFF0; //e. передача 12 бит + // LPC_SSP0->DR = (Output.ArrayOut[0]<<1) & 0xFFF0; //e. передача 12 бит } } }
--- a/InputOutput.h Thu Jan 25 13:59:43 2018 +0000 +++ b/InputOutput.h Wed Jan 31 13:41:23 2018 +0000 @@ -58,7 +58,7 @@ #define TIMEOUT 1000 -typedef union +/*typedef union { int ArrayOut[31]; struct { @@ -90,7 +90,7 @@ } Str; } OUTPUT; - +*/ typedef union { int ArrayIn[3]; @@ -102,7 +102,7 @@ } INPUT; extern INPUT Input; -extern OUTPUT Output; +//extern OUTPUT Output; extern volatile uint32_t I2CMasterState; extern volatile uint32_t I2CMasterBuffer[]; void DAC_ADC_Exchange_Init(void);
--- a/MTimer.c Thu Jan 25 13:59:43 2018 +0000 +++ b/MTimer.c Wed Jan 31 13:41:23 2018 +0000 @@ -13,7 +13,7 @@ unsigned int CountV31=0; unsigned int CountV255=0; unsigned int CountV511=0; -unsigned int f,MODCount=0; +unsigned int f; int loop=0; int t; float aPLC[5]; @@ -31,8 +31,7 @@ Gyro.EvenRate7=1; -/* sprintf((Time),"%d %d\r\n", Spi.DAC_B, PlcWormDeltaout); - WriteCon(Time);*/ + Event1250Hz--; } @@ -101,56 +100,30 @@ if (Event1Hz) { - - - - if(Gyro.ParamFlag) {/*Switch(Gyro.NP)*/}; - - - - - + TempClac(); - if(Gyro.TemperNewData) - { - Gyro.TemperNewData = 0; - - if(Gyro.TermoMod>0)Gyro.TermoMod = 1; - else if(Gyro.TermoMod==0)Gyro.TermoMod = OldTermoMod; - else Gyro.TermoMod =(-1); - OldTermoMod = Gyro.TermoMod; - } - - PlcWormDeltaout=0; + + TermoCopensRecalc(Spi.ADC1, Spi.ADC2, 10000); + PlcWormDeltaout=0; if(Gyro.RgConA&0x4) JumpTimer=0; - else + else { - JumpTimer++; if(JumpTimer>(Gyro.TimeToJump-1)) { - Gyro.PLCDelay = GyroP.Str.PLCDelay; + //Gyro.PLCDelay = GyroP.Str.PLCDelay; JumpMod(); JumpTimer=0; } - } - - + + } Discharg(); BackLight(); Gyro.Rate1_Event = 1; Event1Hz--; Time1Hz++; - - - /* - sprintf((Time),"\r\n %s %d %d ",__DATE__, UItempDate, FtempDate); - WriteCon(Time);*/ - /*sprintf(Time,"%s %s.",__DATE__, __TIME__ ); //Подготовка даты и времени компиляции - WriteCon(Time);*/ - } } @@ -198,7 +171,7 @@ // Gyro.CuruAngle=0; Event250Hz--; - MODCount++; + } } /////////////////////////////////////////////////////
--- a/MTimer.h Thu Jan 25 13:59:43 2018 +0000 +++ b/MTimer.h Wed Jan 31 13:41:23 2018 +0000 @@ -1,7 +1,3 @@ - - -extern unsigned int MODCount; - extern unsigned int init_timer (unsigned int TimerInterval ); extern void enable_timer1( void ); extern unsigned int Init_TIM2 (void);
--- a/QEI.c Thu Jan 25 13:59:43 2018 +0000 +++ b/QEI.c Wed Jan 31 13:41:23 2018 +0000 @@ -16,7 +16,6 @@ int Pulse_16PointD; unsigned int CaunAddPlus =0;//счетчик ипульсов энкодера"+" за такт ВП unsigned int CaunAddMin =0;//счетчик ипульсов энкодера"-" за такт ВП -int TempAngelCompens=0; int unsigned Cur_QEI, Last_QEI; //текушее и предыдущее,(единичное) значение энкодера int temp32=0; int Buff_1Point [512]; @@ -40,31 +39,74 @@ SumTermoCompens -= SumTermoCompens&0xffc00000;*/ -int TermoCopensRecalc(unsigned int T4, unsigned int T5) +int TermoCopensRecalc(int T4, int T5, unsigned int multiplier) { + static unsigned int test; static int OldTempT4=0,OldTempT5=0,OldTempAVR; static int TempAVR; - static unsigned int FlagRecalc=0; - int DeltaT4, DeltaT5; + static unsigned int FlagRecalc=0,DeltaT4, DeltaT5, DeltaT, TempL, TempR, TempD; + static float DeltaL, DeltaR,DeltaD; + static float TempAngelCompens=0; + static float SumAngelCompens=0; + static int IntegerAngelCompens=0; - DeltaT4=Spi.ADC1-OldTempT4; - DeltaT4=abs(DeltaT4); - if(DeltaT4>15) + DeltaT4=T4-OldTempT4; // ищем дельту между текущей температурой Т4 и тимпературой прошлого пересчета термокомпенс. состовляющей. + DeltaT4=abs(DeltaT4); // убираем знак дельты температуры. + if(DeltaT4> GyroP.Str.Step) // если дельта больше шага пересчета то, + { + + OldTempT4=T4; // записываем текущую температуру как темп. прошлого пересчета. + FlagRecalc=1; // выставляем флаг о необходимости пересчитать термокомпенс. поправку числа + } + + // тоже самое что и для Т4, без выставления флага пересчета. + DeltaT5=T5-OldTempT5; + DeltaT5=abs(DeltaT5); + if(DeltaT5> GyroP.Str.Step) + { + OldTempT5=T5; + } + if(FlagRecalc) //если влаг персчета то, { - sprintf((Time),"Recalc\r\n"); - WriteCon(Time); - OldTempT4=Spi.ADC1; - FlagRecalc=1; - } - - DeltaT5=Spi.ADC2-OldTempT5; - DeltaT5=abs(DeltaT5); - if(DeltaT5>15) - { - OldTempT5=Spi.ADC2; + for(int q=0; q<14; q++) + { + if(TermoCorrStatic.TermoTempStatic.StaticTermoCorr_Temp_Arr[q] < T4 ) //пробегаем по масиву температур. + { + } + else + { + TempL = TermoCorrStatic.TermoTempStatic.StaticTermoCorr_Temp_Arr[q - 1]; //подготавливаем левую границу температуры. + DeltaL = TermoCorrStatic.TermoDeltaStatic.StaticTermoCorr_Delta_Arr[q - 1] * multiplier; //подготавливаем левую границу значения поправки и приводим к времени вызова функции. + + TempR = TermoCorrStatic.TermoTempStatic.StaticTermoCorr_Temp_Arr[q]; //подготавливаем правую границу температуры. + DeltaR = TermoCorrStatic.TermoDeltaStatic.StaticTermoCorr_Delta_Arr[q] * multiplier; //подготавливаем правую границу значения поправки и приводим к времени вызова функции. + q=15; + } + } + + TempD = TempR - TempL; //расчитываем значение термокомпенс. сост. + TempAngelCompens = DeltaL+(T4-TempL)*((DeltaR-DeltaL)/TempD); //при текущей температуре. + FlagRecalc=0; } - return Gyro.AngelCompens ; + if(GyroP.Str.TermoMode==1) + { + SumAngelCompens += TempAngelCompens; //копим статическую термокомпенсационную составляющую числа + IntegerAngelCompens =(SumAngelCompens); //смотрим накопился ли импульс + SumAngelCompens -= IntegerAngelCompens; //если накопился, то списываем его из суматора. + Gyro.AngelCompens += (IntegerAngelCompens<<6); //добовляем накопившиеся количество целых импульсов к общей термокомпенс. сост. числа, и приводим к разрядной сетке 1 имп. = 64 ппг. + } + if(GyroP.Str.TermoMode==2) + { + SumAngelCompens += TempAngelCompens; //сумматор + if((SumAngelCompens)>0.25) //если накопили четверть импульса то, + { + Gyro.AngelCompens += 16; //добовляем четверть импульса (привед. к разрядной сетке) к общей термокомпенс. сост. числа. + SumAngelCompens -= 0.25; //списываем четверть импулься из суматора. + } + } + + return 0; } @@ -175,14 +217,12 @@ tempReper=1; Gyro.CaunMinReperAdd -= Dif_QEI; } - - - // Gyro.TermoModAdd=TermoCopensRecalc(Gyro.CurTermoCompens, Gyro.Frq>>11); - Gyro.CuruAngle += Buff_32Point [CountV31]; + Gyro.CuruAngle += Buff_32Point[CountV31]; + //Gyro.AngelCompens=0; }
--- a/QEI.h Thu Jan 25 13:59:43 2018 +0000 +++ b/QEI.h Wed Jan 31 13:41:23 2018 +0000 @@ -35,7 +35,7 @@ extern int Buff_Restored_sin2[]; extern int temp32; extern void D_QEI(void); -extern int TermoCopensRecalc(unsigned int TermoComp, unsigned int Frq ); +extern int TermoCopensRecalc(int T4,int T5, unsigned int multiplier); /*extern void CurAngle(void); extern void CurAngleLOG(void);*/
--- a/SPI.c Thu Jan 25 13:59:43 2018 +0000 +++ b/SPI.c Wed Jan 31 13:41:23 2018 +0000 @@ -47,10 +47,14 @@ Spi.ADC_NewData = 0; /*Gyro.IN1_Accum += Spi.ADC2; Gyro.IN2_Accum += Spi.ADC3;*/ - Gyro.Termo = (unsigned int)((((Spi.ADC1>>1)*100)*0.0122)-27300); - Gyro.DeltaT = (unsigned int)((((Spi.ADC2>>1)*100)*0.0122)-27300); - Gyro.Termo = Spi.ADC1>>1; - Gyro.DeltaT = Spi.ADC2>>1; + + Spi.ADC1 = (int)(((((Spi.ADC1>>1)*100)*0.0122)-27300)+Gyro.Tmp_OffsetT4); + Spi.ADC2 = (int)(((((Spi.ADC2>>1)*100)*0.0122)-27300)+Gyro.Tmp_OffsetT5); + Gyro.Termo = Spi.ADC1; + Gyro.DeltaT = Spi.ADC2; + /*Gyro.Termo = Spi.ADC1-44726; + Gyro.DeltaT = Spi.ADC2-44726;*/ + Gyro.DeltaTRate=(Spi.ADC2-Spi.ADC1); Gyro.TermLM = Spi.ADC1; } @@ -111,7 +115,7 @@ static int TempModT5=0; static int OldT4=0; - static int OldT5=0; + static int OldT5=0,LastTermoMod=0;; static int OldDeltaT4=0; static int OldDeltaT5=0; static int OldMod=0; @@ -119,14 +123,11 @@ AVR_T_Count++; - - Gyro.T4=Spi.ADC1; - Gyro.T5=Spi.ADC2; + TempModT4 = (int)(Gyro.T4-OldT4); TempModT5 = (int)(Gyro.T5-OldT5); - OldT4=Gyro.T4; OldT5=Gyro.T5; @@ -143,19 +144,30 @@ Gyro.DeltaT5+=Delt_T5[q]; Delt_T5[q]=0; } + if(Gyro.DeltaT4==0)Gyro.DeltaT4=OldDeltaT4; if(Gyro.DeltaT5==0)Gyro.DeltaT5=OldDeltaT5; OldDeltaT4=Gyro.DeltaT4; OldDeltaT5=Gyro.DeltaT5; + + + Gyro.TermoMod = Gyro.DeltaT4+Gyro.DeltaT5; + + + + if (Gyro.TermoMod> 0) Gyro.TermoMod=1; + else if(Gyro.TermoMod==0) Gyro.TermoMod=LastTermoMod ; + else Gyro.TermoMod=(-1); - Gyro.TermoMod = Gyro.DeltaT4 + Gyro.DeltaT5; - + LastTermoMod = Gyro.TermoMod; Gyro.DeltaT4=0; Gyro.DeltaT5=0; Gyro.TemperNewData=1; AVR_T_Count=0; + + } @@ -189,8 +201,11 @@ Spi.ADC1 = Spi.ADC1_Accum >> 5; // подгоотавливаем данные (в той эе сетке) те ADC1 0..65535 Spi.ADC2 = Spi.ADC2_Accum >> 5; Spi.ADC3 = Spi.ADC3_Accum >> 5; - Spi.ADC4 = Spi.ADC4_Accum >> 5; - Spi.ADC5 = Spi.ADC5_Accum >> 5; + Spi.ADC4 = (Spi.ADC4_Accum >> 5); + Spi.ADC5 = (Spi.ADC5_Accum >> 5); + + Gyro.T4=Spi.ADC1; + Gyro.T5=Spi.ADC2; Spi.ADC1_Accum = 0; // сбрасывкем аккамулятор Spi.ADC2_Accum = 0; Spi.ADC3_Accum = 0; @@ -233,7 +248,8 @@ void PLCRegul(void) { static unsigned int Flag_64=0, count; -static int CountFaza,Sin; +static int CountFaza,Sin,FlagGain; + if(Gyro.RgConA&0x8) @@ -241,21 +257,32 @@ if(PLC_Flag) { PLC_Flag=0; - if(Gyro.PLCDelay) { } - else Spi.DAC_B+=Gyro.PLC_Eror_count; + if(Gyro.PLCDelay) { FlagGain=1; } + else + { + if(FlagGain) + { + FlagGain=0; + Gyro.HFO_Gain = GyroP.Str.HFO_Gain; + } + Spi.DAC_B+=Gyro.PLC_Eror_count; + } } switch(Gyro.TermoMod) { case -1: if(Spi.DAC_B > Gyro.HighTreshold ) { - Spi.DAC_B = (Gyro.ResetLevelCool); + Gyro.HFO_Gain = GyroP.Str.HFO_Gain_Reset_PLC; + Spi.DAC_B = (Gyro.ResetLevelCool); Gyro.PLCDelay = GyroP.Str.PLCDelay; } break; + case 1: if(Spi.DAC_B < Gyro.DownTreshold ) { + Gyro.HFO_Gain = GyroP.Str.HFO_Gain_Reset_PLC; Spi.DAC_B = (Gyro.ResetLevelHeat); Gyro.PLCDelay = GyroP.Str.PLCDelay; }
--- a/SPI.h Thu Jan 25 13:59:43 2018 +0000 +++ b/SPI.h Wed Jan 31 13:41:23 2018 +0000 @@ -8,18 +8,18 @@ // unsigned int SpiFlag; - unsigned int ADC1; - unsigned int ADC2; - unsigned int ADC3; - unsigned int ADC4; - unsigned int ADC5; + int ADC1; + int ADC2; + int ADC3; + int ADC4; + int ADC5; - unsigned int ADC1_Accum; - unsigned int ADC2_Accum; - unsigned int ADC3_Accum; - unsigned int ADC4_Accum; - unsigned int ADC5_Accum; - unsigned int ADC_NewData; + int ADC1_Accum; + int ADC2_Accum; + int ADC3_Accum; + int ADC4_Accum; + int ADC5_Accum; + int ADC_NewData; unsigned int FlagExchange;
--- a/main.c Thu Jan 25 13:59:43 2018 +0000 +++ b/main.c Wed Jan 31 13:41:23 2018 +0000 @@ -13,7 +13,7 @@ ** Descriptions: **-------------------------------------------------------------------------------------------------------- *********************************************************************************************************/ -#include "startup_LPC17xx.s" + #include "Global.h" /****************************************************************************** @@ -56,7 +56,10 @@ Gyro.Firmware_Version = 17543; Gyro.Firmware_Version=convertStrToTime(__DATE__); - +sprintf((Time),"%0.15f %0.15f %d %d \r\n", TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_0,Float(GyroP.Str.TermoDeltaStatic_1, GyroP.Str.TermoDeltaStatic_0),GyroP.Str.TermoDeltaStatic_0,GyroP.Str.TermoDeltaStatic_1); +WriteCon(Time); +sprintf((Time),"%0.15f %0.15f %d %d \r\n", TermoCorrStatic.TermoDeltaStatic.Str.TermoDeltaStatic_0,Float( GyroP.Str.TermoDeltaStatic_0,GyroP.Str.TermoDeltaStatic_1),GyroP.Str.TermoDeltaStatic_0,GyroP.Str.TermoDeltaStatic_1); +WriteCon(Time); while ( 1 ) { Event_1250Hz();
--- a/vibro.c Thu Jan 25 13:59:43 2018 +0000 +++ b/vibro.c Wed Jan 31 13:41:23 2018 +0000 @@ -16,9 +16,10 @@ __irq void EINT3_IRQHandler() { - - Gyro.EXT_Latch=1; - LPC_GPIOINT->IO0IntClr |= (1<<1); + if( Gyro.EXT_Latch){} + else Gyro.EXT_Latch=1; + LPC_GPIOINT->IO0IntClr |= (1<<1); + //NVIC_DisableIRQ(EINT3_IRQn); }
--- a/vibro.h Thu Jan 25 13:59:43 2018 +0000 +++ b/vibro.h Wed Jan 31 13:41:23 2018 +0000 @@ -139,22 +139,22 @@ typedef struct { union { - float StaticTermoCorr_Temp_Arr[14]; + int StaticTermoCorr_Temp_Arr[14]; struct { - float TermoTempStatic_0; - float TermoTempStatic_1; - float TermoTempStatic_2; - float TermoTempStatic_3; - float TermoTempStatic_4; - float TermoTempStatic_5; - float TermoTempStatic_6; - float TermoTempStatic_7; - float TermoTempStatic_8; - float TermoTempStatic_9; - float TermoTempStatic_10; - float TermoTempStatic_11; - float TermoTempStatic_12; - float TermoTempStatic_13; + int TermoTempStatic_0; + int TermoTempStatic_1; + int TermoTempStatic_2; + int TermoTempStatic_3; + int TermoTempStatic_4; + int TermoTempStatic_5; + int TermoTempStatic_6; + int TermoTempStatic_7; + int TermoTempStatic_8; + int TermoTempStatic_9; + int TermoTempStatic_10; + int TermoTempStatic_11; + int TermoTempStatic_12; + int TermoTempStatic_13; } Str; }TermoTempStatic; @@ -260,7 +260,7 @@ unsigned int ParamFlag; int DeltaT4; int DeltaT5; - + int DeltaTRate; int TermoModT4; int TermoModT5; int TermoModSum; @@ -324,7 +324,7 @@ unsigned int TimeToJump; //5 unsigned int JumpDelta; - + unsigned int step; unsigned int Termodata0; unsigned int Termodata1; unsigned int Termodata2; @@ -358,7 +358,9 @@ int CurTermoCompens; + int AngelCompens; + unsigned int ShowMod2; int Debag; int Debag2; @@ -394,6 +396,7 @@ int HFO_Min; int HFO_Max; unsigned int HFO_Gain; + unsigned int HFO_Gain_Reset_PLC; unsigned int RgConA; // 9 регистр управления ГЛД unsigned int RgConB; //10 регистр управления ГЛД unsigned int RgConMod; @@ -571,8 +574,8 @@ unsigned int a27; //45 unsigned int a28; //46 - unsigned int Tmp_OffsetT4; //47 - unsigned int Tmp_OffsetT5; //48 + int Tmp_OffsetT4; //47 + int Tmp_OffsetT5; //48 unsigned int a29; //49 unsigned int a30; //61 0 - Mirror 1 - Prizm. @@ -592,7 +595,7 @@ unsigned int PLC_Start; //61 0 - Mirror 1 - Prizm. - unsigned int TermoMode; //62 серийный номер прибора + unsigned int TermoMode; //62 термокомпенсация unsigned int TStatic_0; //63 unsigned int TStatic_1; //64 @@ -609,34 +612,34 @@ unsigned int TStatic_12; //75 unsigned int TStatic_13; //76 -unsigned int TermoDeltaStatic_0; //77 -unsigned int TermoDeltaStatic_1; //78 -unsigned int TermoDeltaStatic_2; //79 -unsigned int TermoDeltaStatic_3; //80 -unsigned int TermoDeltaStatic_4; //81 -unsigned int TermoDeltaStatic_5; //82 -unsigned int TermoDeltaStatic_6; //83 -unsigned int TermoDeltaStatic_7; //84 -unsigned int TermoDeltaStatic_8; //85 -unsigned int TermoDeltaStatic_9; //86 -unsigned int TermoDeltaStatic_10; //87 -unsigned int TermoDeltaStatic_11; //88 -unsigned int TermoDeltaStatic_12; //89 -unsigned int TermoDeltaStatic_13; //90 -unsigned int TermoDeltaStatic_14; //91 -unsigned int TermoDeltaStatic_15; //92 -unsigned int TermoDeltaStatic_16; //93 -unsigned int TermoDeltaStatic_17; //94 -unsigned int TermoDeltaStatic_18; //95 -unsigned int TermoDeltaStatic_19; //96 -unsigned int TermoDeltaStatic_20; //97 -unsigned int TermoDeltaStatic_21; //98 -unsigned int TermoDeltaStatic_22; //99 -unsigned int TermoDeltaStatic_23; //100 -unsigned int TermoDeltaStatic_24; //101 -unsigned int TermoDeltaStatic_25; //102 -unsigned int TermoDeltaStatic_26; //103 -unsigned int TermoDeltaStatic_27; //104 +unsigned int aTermoDeltaStatic_0; //77 +unsigned int aTermoDeltaStatic_1; //78 +unsigned int aTermoDeltaStatic_2; //79 +unsigned int aTermoDeltaStatic_3; //80 +unsigned int aTermoDeltaStatic_4; //81 +unsigned int aTermoDeltaStatic_5; //82 +unsigned int aTermoDeltaStatic_6; //83 +unsigned int aTermoDeltaStatic_7; //84 +unsigned int aTermoDeltaStatic_8; //85 +unsigned int aTermoDeltaStatic_9; //86 +unsigned int aTermoDeltaStatic_10; //87 +unsigned int aTermoDeltaStatic_11; //88 +unsigned int aTermoDeltaStatic_12; //89 +unsigned int aTermoDeltaStatic_13; //90 +unsigned int aTermoDeltaStatic_14; //91 +unsigned int aTermoDeltaStatic_15; //92 +unsigned int aTermoDeltaStatic_16; //93 +unsigned int aTermoDeltaStatic_17; //94 +unsigned int aTermoDeltaStatic_18; //95 +unsigned int aTermoDeltaStatic_19; //96 +unsigned int aTermoDeltaStatic_20; //97 +unsigned int aTermoDeltaStatic_21; //98 +unsigned int aTermoDeltaStatic_22; //99 +unsigned int aTermoDeltaStatic_23; //100 +unsigned int aTermoDeltaStatic_24; //101 +unsigned int aTermoDeltaStatic_25; //102 +unsigned int aTermoDeltaStatic_26; //103 +unsigned int aTermoDeltaStatic_27; //104 unsigned int /*RLC;*/ResetLevelCool; //105 временно должен быть на 39 @@ -651,7 +654,7 @@ unsigned int a86; //113 unsigned int a87; //114 unsigned int FlashMod; //115 -unsigned int a89; //116 +unsigned int HFO_Gain_Reset_PLC; //116 unsigned int TSHeat0; //117 unsigned int TSHeat1; //118 @@ -668,80 +671,80 @@ unsigned int TSHeat12; //129 unsigned int TSHeat13; //130 -unsigned int TermoDynamicDataHeat0; //131 -unsigned int TermoDynamicDataHeat1; //132 -unsigned int TermoDynamicDataHeat2; //133 -unsigned int TermoDynamicDataHeat3; //134 -unsigned int TermoDynamicDataHeat4; //135 -unsigned int TermoDynamicDataHeat5; //136 -unsigned int TermoDynamicDataHeat6; //137 -unsigned int TermoDynamicDataHeat7; //138 -unsigned int TermoDynamicDataHeat8; //139 -unsigned int TermoDynamicDataHeat9; //140 -unsigned int TermoDynamicDataHeat10; //141 -unsigned int TermoDynamicDataHeat11; //142 -unsigned int TermoDynamicDataHeat12; //143 -unsigned int TermoDynamicDataHeat13; //144 -unsigned int TermoDynamicDataHeat14; //145 -unsigned int TermoDynamicDataHeat15; //146 -unsigned int TermoDynamicDataHeat16; //147 -unsigned int TermoDynamicDataHeat17; //148 -unsigned int TermoDynamicDataHeat18; //149 -unsigned int TermoDynamicDataHeat19; //150 -unsigned int TermoDynamicDataHeat20; //151 -unsigned int TermoDynamicDataHeat21; //152 -unsigned int TermoDynamicDataHeat22; //153 -unsigned int TermoDynamicDataHeat23; //154 -unsigned int TermoDynamicDataHeat24; //155 -unsigned int TermoDynamicDataHeat25; //156 -unsigned int TermoDynamicDataHeat26; //157 -unsigned int TermoDynamicDataHeat27; //158 +unsigned int TermoDeltaStatic_0; //131 +unsigned int TermoDeltaStatic_1; //132 +unsigned int TermoDeltaStatic_2; //133 +unsigned int TermoDeltaStatic_3; //134 +unsigned int TermoDeltaStatic_4; //135 +unsigned int TermoDeltaStatic_5; //136 +unsigned int TermoDeltaStatic_6; //137 +unsigned int TermoDeltaStatic_7; //138 +unsigned int TermoDeltaStatic_8; //139 +unsigned int TermoDeltaStatic_9; //140 +unsigned int TermoDeltaStatic_10; //141 +unsigned int TermoDeltaStatic_11; //142 +unsigned int TermoDeltaStatic_12; //143 +unsigned int TermoDeltaStatic_13; //144 +unsigned int TermoDeltaStatic_14; //145 +unsigned int TermoDeltaStatic_15; //146 +unsigned int TermoDeltaStatic_16; //147 +unsigned int TermoDeltaStatic_17; //148 +unsigned int TermoDeltaStatic_18; //149 +unsigned int TermoDeltaStatic_19; //150 +unsigned int TermoDeltaStatic_20; //151 +unsigned int TermoDeltaStatic_21; //152 +unsigned int TermoDeltaStatic_22; //153 +unsigned int TermoDeltaStatic_23; //154 +unsigned int TermoDeltaStatic_24; //155 +unsigned int TermoDeltaStatic_25; //156 +unsigned int TermoDeltaStatic_26; //157 +unsigned int TermoDeltaStatic_27; //158 unsigned int Step; //159 -unsigned int TDCool_0; //160 -unsigned int TDCool_1; //161 -unsigned int TDCool_2; //162 -unsigned int TDCool_3; //163 -unsigned int TDCool_4; //164 +unsigned int TDCool_0; //160 +unsigned int TDCool_1; //161 +unsigned int TDCool_2; //162 +unsigned int TDCool_3; //163 +unsigned int TDCool_4; //164 unsigned int TDCool_5; //165 -unsigned int TDCool_6; //166 +unsigned int TDCool_6; //166 unsigned int TDCool_7; //167 unsigned int TDCool_8; //168 unsigned int TDCool_9; //169 -unsigned int TDCool_10; //170 +unsigned int TDCool_10; //170 unsigned int TDCool_11; //171 unsigned int TDCool_12; //172 unsigned int TDCool_13; //173 -unsigned int TermoDataCool0; //174 -unsigned int TermoDataCool1; //175 -unsigned int TermoDataCool2; //176 -unsigned int TermoDataCool3; //177 -unsigned int TermoDataCool4; //178 -unsigned int TermoDataCool5; //179 -unsigned int TermoDataCool6; //180 -unsigned int TermoDataCool7; //181 -unsigned int TermoDataCool8; //182 -unsigned int TermoDataCool9; //183 -unsigned int TermoDataCool10; //184 -unsigned int TermoDataCool11; //185 -unsigned int TermoDataCool12; //186 -unsigned int TermoDataCool13; //187 -unsigned int TermoDataCool14; //188 -unsigned int TermoDataCool15; //189 -unsigned int TermoDataCool16; //190 -unsigned int TermoDataCool17; //191 -unsigned int TermoDataCool18; //192 -unsigned int TermoDataCool19; //193 -unsigned int TermoDataCool20; //194 -unsigned int TermoDataCool21; //195 -unsigned int TermoDataCool22; //196 -unsigned int TermoDataCool23; //197 -unsigned int TermoDataCool24; //198 -unsigned int TermoDataCool25; //199 -unsigned int TermoDataCool26; //200 -unsigned int TermoDataCool27; //201 +unsigned int TermoDynamicData_0; //174 +unsigned int TermoDynamicData_1; //175 +unsigned int TermoDynamicData_2; //176 +unsigned int TermoDynamicData_3; //177 +unsigned int TermoDynamicData_4; //178 +unsigned int TermoDynamicData_5; //179 +unsigned int TermoDynamicData_6; //180 +unsigned int TermoDynamicData_7; //181 +unsigned int TermoDynamicData_8; //182 +unsigned int TermoDynamicData_9; //183 +unsigned int TermoDynamicData_10; //184 +unsigned int TermoDynamicData_11; //185 +unsigned int TermoDynamicData_12; //186 +unsigned int TermoDynamicData_13; //187 +unsigned int TermoDynamicData_14; //188 +unsigned int TermoDynamicData_15; //189 +unsigned int TermoDynamicData_16; //190 +unsigned int TermoDynamicData_17; //191 +unsigned int TermoDynamicData_18; //192 +unsigned int TermoDynamicData_19; //193 +unsigned int TermoDynamicData_20; //194 +unsigned int TermoDynamicData_21; //195 +unsigned int TermoDynamicData_22; //196 +unsigned int TermoDynamicData_23; //197 +unsigned int TermoDynamicData_24; //198 +unsigned int TermoDynamicData_25; //199 +unsigned int TermoDynamicData_26; //200 +unsigned int TermoDynamicData_27; //201 } Str; } GyroParam;