![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LG2 by
Diff: Command.c
- Revision:
- 106:250ddd8629c6
- Parent:
- 105:bd01d8d20fb6
- Child:
- 107:4d178bcc9d8a
--- a/Command.c Thu Mar 31 14:03:40 2016 +0000 +++ b/Command.c Fri Apr 01 10:05:35 2016 +0000 @@ -1,7 +1,7 @@ #include "stdlib.h" #include "LPC17xx.h" #include "Global.h" - +int tempNH,tempNL; unsigned int Rate_Flag; unsigned int CountBuFFIn; unsigned int N=0,CRC_N; @@ -35,44 +35,50 @@ void CMD_Rate(void) { - unsigned int T_VibH , T_VibL; // Частота вибропривода. + unsigned int T_VibH , T_VibL; // Частота вибропривода. + unsigned int tau_VibH , tau_VibL; unsigned int Cnt_PlsL , Cnt_PlsH; // Счетчик +. unsigned int Cnt_MnsL , Cnt_MnsH; // Счетчик -. unsigned int Cnt_DifL , Cnt_DifH; // Разность счетчиков. unsigned int F_rasL , F_rasH; // Частота расщепления. - unsigned int HF_regL , HF_regH; // Выход регулятора ГВЧ. НЕ СДЕЛАНО - unsigned int HF_difL , HF_difH; // Сигнал ошибки регулячтора ГВЧ. НЕ СДЕЛАНО + unsigned int HF_regL , HF_regH; // Выход регулятора ГВЧ. + unsigned int HF_difL , HF_difH; // Сигнал ошибки регулячтора ГВЧ. unsigned int WP_regL , WP_regH; unsigned int ADC1L, ADC2L, ADC3L, ADC4L, ADC5L; unsigned int ADC1H, ADC2H, ADC3H, ADC4H, ADC5H; - - - + // Gyro .T_Vib=(unsigned int)((7680000*16/Gyro.Frq)*4096); -// Gyro.T_Vib=(unsigned int)((7680000*16/(Gyro.Frq>>12))); + Gyro.T_Vib=(unsigned int)((7680000*16/(Gyro.Frq>>12))); Gyro.Firmware_Version=0xff; /// промежуточная затычка T_VibH = ( Gyro.T_Vib>>8 ) TakeByte; T_VibL = ( Gyro.T_Vib ) TakeByte; - + + tau_VibH = ( Gyro.tau >>8 ) TakeByte; + tau_VibL = ( Gyro.tau ) TakeByte; + Cnt_PlsH = ( Gyro.Cnt_Pls>>8) TakeByte; - Cnt_PlsL = ( Gyro.Cnt_Pls ) TakeByte; - + Cnt_PlsL = Gyro.Cnt_Pls TakeByte; + Gyro.Cnt_Pls= 0; + Cnt_MnsH = ( Gyro.Cnt_Mns>>8) TakeByte; - Cnt_MnsL = ( Gyro.Cnt_Mns ) TakeByte; - - Cnt_DifH = ( Gyro.Cnt_Dif>>8) TakeByte; - Cnt_DifL = ( Gyro.Cnt_Dif ) TakeByte; - + Cnt_MnsL = Gyro.Cnt_Mns TakeByte; + Gyro.Cnt_Mns=0; + + Cnt_DifH = ( Dif_QEI>>8) TakeByte; + Cnt_DifL = ( Dif_QEI ) TakeByte; + + //Spi.DAC_A F_rasH = ( Gyro.F_ras>>8 ) TakeByte; F_rasL = ( Gyro.F_ras ) TakeByte; - - F_rasH =0; - F_rasL=1; - + + HF_regL = ( Spi.DAC_A>>8 ) TakeByte; + HF_regH = ( Spi.DAC_A>>8 ) TakeByte; + + ADC1H = ( Spi.ADC1>>8 ) TakeByte; ADC1L = ( Spi.ADC1 ) TakeByte; @@ -101,64 +107,62 @@ BuffTemp[ 0] = Gyro.SOC_Out; BuffTemp[ 1] = Gyro.My_Addres; - BuffTemp[ 2] = Cnt_PlsH;//старший байт счетчика +. - BuffTemp[ 3] = Cnt_PlsL;//младший байт счетчика +. - - BuffTemp[ 4] = Cnt_MnsH;//старший байт счетчика -. - BuffTemp[ 5] = Cnt_MnsL;//младший байт счетчика -. + BuffTemp[ 2] =0x00;//старший байт счетчика +. + BuffTemp[ 3] =0x00;//младший байт счетчика +. + BuffTemp[ 4] =0x00;//старший байт счетчика -. + BuffTemp[ 5] =0x00;//младший байт счетчика -. + BuffTemp[ 6] =0x00;//старший байт разности счетчиков + BuffTemp[ 7] =0x00;//младший байт разности счетчиков - BuffTemp[ 6] = Cnt_DifH;//старший байт разности счетчиков - BuffTemp[ 7] = Cnt_DifL;//младший байт разности счетчиков + BuffTemp[ 8] = F_rasH;//расщипление частота + BuffTemp[ 9] = F_rasL;// - BuffTemp[ 8] = F_rasH; - BuffTemp[ 9] = F_rasL; - - BuffTemp[10] = HF_regH; + BuffTemp[10] = HF_regH;//выход регулятора гвч; BuffTemp[11] = HF_regL; - BuffTemp[12] = HF_difH; - BuffTemp[13] = HF_difL; + BuffTemp[12]=0x01;//// + BuffTemp[13]=0x01;//// - BuffTemp[14] = T_VibH ;// - BuffTemp[15] = T_VibL; //? + BuffTemp[14] = T_VibH; + BuffTemp[15] = T_VibL; - BuffTemp[16] = Gyro.Firmware_Version;//ХЗ - BuffTemp[17] = Gyro.Firmware_Version;//ХЗ + BuffTemp[16] = 0x01; + BuffTemp[17] = 0x02; - BuffTemp[18] = T_VibH>>1; - BuffTemp[19] = T_VibL; + BuffTemp[18] = tau_VibH; + BuffTemp[19] = tau_VibL; - BuffTemp[20] = Gyro.Firmware_Version;//ХЗ - BuffTemp[21] = Gyro.Firmware_Version;//ХЗ + BuffTemp[20] = 0x00; + BuffTemp[21] = 0x00; - BuffTemp[22] = WP_regH; //СРП Spi.DAC_B - BuffTemp[23] = WP_regL; //СРП + BuffTemp[22] = 0x00; + BuffTemp[23] = 0x00; - BuffTemp[24] = Gyro.Firmware_Version;// ХЗ - BuffTemp[25] = Gyro.Firmware_Version;// ХЗ + BuffTemp[24] = 0x00; + BuffTemp[25] = 0x00;// ХЗ - BuffTemp[26] = ADC1H; - BuffTemp[27] = ADC1L; + BuffTemp[26] = ADC1H; + BuffTemp[27] = ADC1L; - BuffTemp[28] = ADC1H; - BuffTemp[29] = ADC1L; + BuffTemp[28] = ADC2H; + BuffTemp[29] = ADC2L; - BuffTemp[30] = ADC1H; - BuffTemp[31] = ADC1L; + BuffTemp[30] = ADC2H;//in1 + BuffTemp[31] = ADC2L; - BuffTemp[32] = ADC1H; - BuffTemp[33] = ADC1L; + BuffTemp[32] = ADC3H; + BuffTemp[33] = ADC3L;//in2 - BuffTemp[34] = ADC1H; - BuffTemp[35] = ADC1L; + BuffTemp[34] = ADC5H; + BuffTemp[35] = ADC5L; - BuffTemp[36] = 0x00;//ADC6 - BuffTemp[37] = 0x00;//ADC6 + BuffTemp[36] =0x00;//ADC6 + BuffTemp[37] =0x00;//ADC6 - BuffTemp[38] = Gyro.Firmware_Version; - BuffTemp[39] = Gyro.Firmware_Version; - BuffTemp[40] = Gyro.Firmware_Version; - BuffTemp[41] = Gyro.Firmware_Version; + BuffTemp[38] =0x00; + BuffTemp[39] =0x00; + BuffTemp[40] =0x00; + BuffTemp[41] =0x00; Check(BuffTemp, 44);