123
Fork of LG by
Diff: QEI.c
- Revision:
- 185:7e200f4d9b16
- Parent:
- 179:2b4e6bc277df
- Child:
- 189:8a16378724c4
--- a/QEI.c Thu Jul 14 14:10:49 2016 +0000 +++ b/QEI.c Fri Jul 15 14:03:47 2016 +0000 @@ -12,17 +12,20 @@ int Pulse_8Point; int Pulse_16Point; int Pulse_32Point; +int Pulse_64Point; int Pulse_16PointD; - +int Pulse_16PointDD; int CaunAddPlus =0;//счетчик ипульсов энкодера"+" за такт ВП int CaunAddMin =0;//счетчик ипульсов энкодера"-" за такт ВП int unsigned Cur_QEI, Last_QEI; //текушее и предыдущее,(единичное) значение энкодера int Buff_1Point [256]; // этот на 256 -int Buff_32Point [32]; +int Buff_32Point [32]; +int Buff_64Point [32]; int Buff_16Point [32]; int Buff_16PointD [32]; +int Buff_16PointDD [64]; int Buff_8Point [32]; int Buff_Restored_sin [32]; @@ -51,16 +54,34 @@ Pulse_32Point -= Buff_1Point[(CountV255-32) & 0xff]; // заполнение буфера накопленых приращений за 32 тактов Gyro.Cnt_Dif = (Pulse_32Point); Buff_32Point[CountV31] = (Pulse_32Point ); + +/* Pulse_64Point += Buff_1Point[CountV255]; + Pulse_64Point -= Buff_1Point[(CountV255-64) & 0xff]; // заполнение буфера накопленых приращений за 32 тактов + Gyro.Cnt_Dif = (Pulse_64Point); + Buff_64Point[CountV31] = (Pulse_64Point ); +*/ Pulse_16PointD += Buff_1Point[CountV255]; Pulse_16PointD -= Buff_1Point[(CountV255-16) & 0xff]; // заполнение буфера накопленых приращений за 16 тактов Двойныз Pulse_16PointD += Buff_1Point[(CountV255-32) & 0xff]; // Pulse_16PointD -= Buff_1Point[(CountV255-48) & 0xff]; // Buff_16PointD[CountV31] = Pulse_16PointD ; + +/* + Pulse_16PointDD += Buff_1Point[CountV255]; + Pulse_16PointDD -= Buff_1Point[(CountV255-16) & 0xff]; // заполнение буфера накопленых приращений за 16 тактов Двойныз + Pulse_16PointDD += Buff_1Point[(CountV255-32) & 0xff]; // + Pulse_16PointDD -= Buff_1Point[(CountV255-48) & 0xff]; // + Pulse_16PointDD += Buff_1Point[(CountV255-64) & 0xff]; + Pulse_16PointDD -= Buff_1Point[(CountV255-80) & 0xff]; // заполнение буфера накопленых приращений за 16 тактов Двойныз + Pulse_16PointDD += Buff_1Point[(CountV255-96) & 0xff]; // + Pulse_16PointDD -= Buff_1Point[(CountV255-112) & 0xff]; + Buff_16PointDD[CountV31] = Pulse_16PointDD ; + Buff_Restored_sin [CountV31]= Buff_16PointDD[ CountV31] - Buff_64Point[CountV31]; +*/ - Buff_Restored_sin [CountV31]= Buff_16PointD [ CountV31] - Buff_32Point[CountV31]; - + Buff_Restored_sin [CountV31]= Buff_16PointD[CountV31] - Buff_32Point[CountV31]; if((Buff_Restored_sin [CountV31]) > 0) CaunAddPlus += Buff_Restored_sin [CountV31]; else CaunAddMin -= (Buff_Restored_sin [CountV31]); // расчет амплитуды