![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
forkd
Fork of LG2 by
main.c@168:f4a6abb18358, 2016-06-06 (annotated)
- Committer:
- Kovalev_D
- Date:
- Mon Jun 06 14:07:45 2016 +0000
- Revision:
- 168:f4a6abb18358
- Parent:
- 165:b2bd0c810a4f
- Child:
- 169:140743e3bb96
mod jump
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 8:5188b1448d34 | 1 | //ssdfwewedfsfds |
igor_v | 0:8ad47e2b6f00 | 2 | /****************************************Copyright (c)**************************************************** |
igor_v | 0:8ad47e2b6f00 | 3 | **--------------File Info--------------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 4 | ** File name: main.c |
igor_v | 0:8ad47e2b6f00 | 5 | ** Last modified Date: 2011-10-24 |
igor_v | 0:8ad47e2b6f00 | 6 | ** Last Version: V1.00 |
igor_v | 0:8ad47e2b6f00 | 7 | ** Descriptions: The main() function |
igor_v | 0:8ad47e2b6f00 | 8 | ** |
igor_v | 0:8ad47e2b6f00 | 9 | **-------------------------------------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 10 | ** Created by: Electrooptica Incorp. |
igor_v | 0:8ad47e2b6f00 | 11 | ** Created date: 2011-08-22 |
igor_v | 0:8ad47e2b6f00 | 12 | ** Version: V1.00 |
igor_v | 3:ed8744c5f67a | 13 | ** Descriptions: |
igor_v | 3:ed8744c5f67a | 14 | **-------------------------------------------------------------------------------------------------------- |
igor_v | 30:17c84ed091b3 | 15 | последнии изменения |
igor_v | 30:17c84ed091b3 | 16 | //2016_02_03_17_47 |
igor_v | 31:c783288001b5 | 17 | //2016_02_06 igor |
igor_v | 37:bdd52117b56e | 18 | //2016_06 Dima |
Kovalev_D | 41:70d12776d1ef | 19 | //2016_02_06 21:20 Kovalev_D |
igor_v | 0:8ad47e2b6f00 | 20 | *********************************************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 21 | #include "Global.h" |
Diletant | 74:f4d9c3403578 | 22 | #include "Device.h" |
igor_v | 0:8ad47e2b6f00 | 23 | /****************************************************************************** |
igor_v | 0:8ad47e2b6f00 | 24 | ** Main Function main() |
igor_v | 0:8ad47e2b6f00 | 25 | ******************************************************************************/ |
Diletant | 138:14a0c452cf32 | 26 | extern Device device; //Single global for all device hardware-independent algorithm |
Kovalev_D | 136:19b9e6abb86f | 27 | unsigned int addres; |
Kovalev_D | 134:caf4c9cd5052 | 28 | uint32_t Result[5]; |
igor_v | 0:8ad47e2b6f00 | 29 | extern uint32_t CMD_Mode; |
igor_v | 52:30f2e52a493f | 30 | unsigned int secPuls; |
igor_v | 52:30f2e52a493f | 31 | float DACF, K_DAC; |
Kovalev_D | 107:4d178bcc9d8a | 32 | int tempAMP; |
Kovalev_D | 139:1716152517aa | 33 | int temp; |
Kovalev_D | 136:19b9e6abb86f | 34 | unsigned int status; |
Kovalev_D | 136:19b9e6abb86f | 35 | unsigned int Para; |
igor_v | 52:30f2e52a493f | 36 | int main (void) |
igor_v | 52:30f2e52a493f | 37 | { |
Kovalev_D | 136:19b9e6abb86f | 38 | SystemInit1(); // Инициализация контроллера: установка тактовых частот |
Kovalev_D | 150:29c9f7671bac | 39 | SystemCoreClockUpdate1(); // расчет тактовой частоты процессора перед инициализацией UART - 103MHz |
Kovalev_D | 147:1aed74f19a8f | 40 | GLD_Init(); |
igor_v | 91:a2bb81eaa183 | 41 | |
Kovalev_D | 164:6f43f85fdd8d | 42 | UART_InitSet (0, 921600, 0x03); |
Kovalev_D | 165:b2bd0c810a4f | 43 | // UART_InitSet (1, 921600, 0x03); |
Kovalev_D | 165:b2bd0c810a4f | 44 | // UART_InitSet (1, 115200, 0x03); |
Kovalev_D | 165:b2bd0c810a4f | 45 | UART_InitSet (1, 38400, 0x03);//для проверки дельта 500Гц на 115200 выходит при выставки флага delta500Hz |
Kovalev_D | 150:29c9f7671bac | 46 | // IntLatch_Init(); // инициализация внутренней защелки. |
Kovalev_D | 150:29c9f7671bac | 47 | // ExtLatch_Init(); // инициализация внешней защелки. |
Kovalev_D | 150:29c9f7671bac | 48 | // LoadFlashParam(FromFLASH); //загрузка параметров. |
Kovalev_D | 150:29c9f7671bac | 49 | // init_PLC(); //Инициализация СРП(регулировка периметра) |
Kovalev_D | 150:29c9f7671bac | 50 | // init_Dither_reg(); //инициализация вибропривода |
igor_v | 51:81f47b817071 | 51 | |
Kovalev_D | 159:38f39c0c143f | 52 | |
Kovalev_D | 159:38f39c0c143f | 53 | |
Kovalev_D | 159:38f39c0c143f | 54 | //250,250 мин син кос |
Kovalev_D | 159:38f39c0c143f | 55 | |
Kovalev_D | 159:38f39c0c143f | 56 | |
Kovalev_D | 159:38f39c0c143f | 57 | Out_G_photo(200,200); |
Kovalev_D | 158:0c8342e1837a | 58 | //Out_G_photo(200,200); //запись в буфер мастера принятые от функции данные (60,60) и установка флага старта передачи и занятой шины. |
Kovalev_D | 165:b2bd0c810a4f | 59 | WriteCon1("\n\r 123456789...GL start programm uart ACK.... "); |
Kovalev_D | 47:d902ef6f7564 | 60 | WriteCon("\n\r ...GL start programm uart Tech.... "); |
igor_v | 15:f5191a1c3805 | 61 | sprintf(Time,"\r\nCompiled: %s %s.",__DATE__, __TIME__ ); //Подготовка даты и времени компиляции |
igor_v | 13:e2a1d18677b8 | 62 | WriteCon(Time); |
Kovalev_D | 150:29c9f7671bac | 63 | |
igor_v | 11:af609f6dee46 | 64 | |
Kovalev_D | 150:29c9f7671bac | 65 | |
Kovalev_D | 150:29c9f7671bac | 66 | while ( 1 ){ //основной цикл. |
Kovalev_D | 150:29c9f7671bac | 67 | |
Kovalev_D | 147:1aed74f19a8f | 68 | G_Photo_Exchange(); |
Kovalev_D | 108:030cdde08314 | 69 | Concol (); // Проврка 0 консоли (вход и выход) |
Kovalev_D | 93:b3803774f110 | 70 | Concol1 (); // Проврка 0 консоли (вход и выход) |
Kovalev_D | 99:3d8f206ceac2 | 71 | Read_CMD(); |
igor_v | 3:ed8744c5f67a | 72 | if (OutBufConCount) OutBufConCount--; |
Kovalev_D | 108:030cdde08314 | 73 | if (OutBufCon1Count) OutBufCon1Count--; |
Kovalev_D | 104:ab1cb4ff56b2 | 74 | |
Kovalev_D | 147:1aed74f19a8f | 75 | TechLog();//технологическая выдача |
Kovalev_D | 136:19b9e6abb86f | 76 | |
Kovalev_D | 116:66f1f0ff2dab | 77 | Event_100KHz(); |
Kovalev_D | 88:b5c1d9d338d1 | 78 | Event_1KHz(); |
Kovalev_D | 124:9ae09249f842 | 79 | Event_500Hz(); |
Kovalev_D | 116:66f1f0ff2dab | 80 | Event_1Hz(); |
Kovalev_D | 88:b5c1d9d338d1 | 81 | Event_Vibro(); |
Kovalev_D | 150:29c9f7671bac | 82 | |
Kovalev_D | 150:29c9f7671bac | 83 | |
Kovalev_D | 150:29c9f7671bac | 84 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 85 | ////////////////////////////////////выдача параметров через Rate//////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 86 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 87 | switch(Gyro.ModeOut) { |
Kovalev_D | 150:29c9f7671bac | 88 | case 1: if(Gyro.Rate1_Event == 1) CMD_Rate(); break; |
Kovalev_D | 150:29c9f7671bac | 89 | case 2: if(Gyro.Rate2_Event == 1) CMD_Rate2(); break; |
Kovalev_D | 150:29c9f7671bac | 90 | case 3: if(Gyro.Delta500_Event == 1) CMD_Delta_500Hz(); break; |
Kovalev_D | 150:29c9f7671bac | 91 | case 4: if(Gyro.EXT_Latch == 1) CMD_Delta_Ext(); break; |
Kovalev_D | 150:29c9f7671bac | 92 | } |
Kovalev_D | 150:29c9f7671bac | 93 | |
Kovalev_D | 150:29c9f7671bac | 94 | |
Kovalev_D | 150:29c9f7671bac | 95 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 96 | /////////////////////////////////////////////////контуры регулировки/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 97 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 98 | if (Spi.ADC_NewData == 1) {ADS_Acum(); } // был приход новых данных по ацп сдесь сделать обработку информации и подготовку для выдачи делается 1 раз за вибро |
Kovalev_D | 150:29c9f7671bac | 99 | if (Gyro.ADF_NewData == 1) {Gyro.ADF_NewData = 0; } // был приход новых данных После быстрого фильтра AD |
Kovalev_D | 168:f4a6abb18358 | 100 | if (Gyro.ADS_NewData == 1) {Gyro.ADS_NewData = 0; if(Gyro.ModJump == 3){ShowMod();} else {PlcRegul();}} // был приход новых данных После Медленного фильтра AD (гдето раз в 0.63 секунды )//регулировка периметра. |
Kovalev_D | 150:29c9f7671bac | 101 | if (Gyro.VibroFrqRegulF == 1) {Gyro.VibroFrqRegulF = 0; VibroFrqRegul(); } // Регулеровка частоты виброподвеса |
Kovalev_D | 150:29c9f7671bac | 102 | if (Gyro.VibroAMPRegulF == 1) {Gyro.VibroAMPRegulF = 0; VibroAMPRegul(); } // Регулеровка Амплитуды виброподвеса |
Kovalev_D | 150:29c9f7671bac | 103 | if (Gyro.VibroNoiseF == 1) {Gyro.VibroNoiseF = 0; CalcAmpN(); } // регулеровка ошумления, наверно нужно объеденить с регулеровкой ампитуды |
Kovalev_D | 150:29c9f7671bac | 104 | if (Gyro.VibroOutF == 1) {Gyro.VibroOutF = 0; VibroOut(); } // установка ног в регисторе тоже подумать , зачем отделный флаг? наверно |
Kovalev_D | 150:29c9f7671bac | 105 | |
Kovalev_D | 150:29c9f7671bac | 106 | |
Kovalev_D | 150:29c9f7671bac | 107 | |
Kovalev_D | 150:29c9f7671bac | 108 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 109 | ////////////////////////////////////////////////////выдача частоты в терминал длля записи лога/////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 110 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 111 | //////G=1,K=0 в терменале |
Kovalev_D | 159:38f39c0c143f | 112 | if((Gyro.LogHZ == 1)&&(Gyro.Event_500Hz==1)) //Запись для Ориджина. |
Kovalev_D | 139:1716152517aa | 113 | { |
Kovalev_D | 143:2b15794a6cd2 | 114 | Gyro.Event_500Hz=0; |
Kovalev_D | 147:1aed74f19a8f | 115 | sprintf((Time),"%d \r\n",LPC_TIM1->MR0); |
Kovalev_D | 147:1aed74f19a8f | 116 | WriteCon(Time); |
Kovalev_D | 147:1aed74f19a8f | 117 | } |
Kovalev_D | 132:2c7bec5cf6fe | 118 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 132:2c7bec5cf6fe | 119 | /////////////////////////Работа с Flash////////////////////////////////////////////////////////////////// |
Kovalev_D | 132:2c7bec5cf6fe | 120 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 121 | if(Gyro.FlashMod == 1) {GoBoot(); } |
Kovalev_D | 147:1aed74f19a8f | 122 | if(Gyro.FlashMod == 2) {WriteFlash(); } |
Kovalev_D | 147:1aed74f19a8f | 123 | if(Gyro.FlashMod == 3) {ReadFlash(); } |
Kovalev_D | 136:19b9e6abb86f | 124 | |
Kovalev_D | 147:1aed74f19a8f | 125 | } |
Kovalev_D | 132:2c7bec5cf6fe | 126 | }//main |
igor_v | 0:8ad47e2b6f00 | 127 | |
igor_v | 0:8ad47e2b6f00 | 128 | /****************************************************************************** |
igor_v | 0:8ad47e2b6f00 | 129 | ** End Of File |
igor_v | 0:8ad47e2b6f00 | 130 | ******************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 131 | |
igor_v | 0:8ad47e2b6f00 | 132 |