![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
main.c@189:8a16378724c4, 2016-08-22 (annotated)
- Committer:
- Kovalev_D
- Date:
- Mon Aug 22 10:39:08 2016 +0000
- Revision:
- 189:8a16378724c4
- Parent:
- 188:4c523cc373cc
- Child:
- 190:289514f730ee
?????? ?? ??????????? ??????? ? ????????? ?????
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(); |
Kovalev_D | 188:4c523cc373cc | 41 | BackLightOFF |
Kovalev_D | 188:4c523cc373cc | 42 | LightUpOFF |
Kovalev_D | 188:4c523cc373cc | 43 | //UART_InitSet (0, 115200, 0x03); |
Kovalev_D | 182:ebcd2bc3be8f | 44 | UART_InitSet (0, 921600, 0x03); |
Kovalev_D | 188:4c523cc373cc | 45 | //UART_InitSet (1, 115200, 0x03); |
Kovalev_D | 188:4c523cc373cc | 46 | UART_InitSet (1, 921600, 0x03); |
Kovalev_D | 150:29c9f7671bac | 47 | // IntLatch_Init(); // инициализация внутренней защелки. |
Kovalev_D | 150:29c9f7671bac | 48 | // ExtLatch_Init(); // инициализация внешней защелки. |
Kovalev_D | 150:29c9f7671bac | 49 | // LoadFlashParam(FromFLASH); //загрузка параметров. |
Kovalev_D | 150:29c9f7671bac | 50 | // init_PLC(); //Инициализация СРП(регулировка периметра) |
Kovalev_D | 150:29c9f7671bac | 51 | // init_Dither_reg(); //инициализация вибропривода |
igor_v | 51:81f47b817071 | 52 | |
Kovalev_D | 159:38f39c0c143f | 53 | |
Kovalev_D | 159:38f39c0c143f | 54 | |
Kovalev_D | 159:38f39c0c143f | 55 | //250,250 мин син кос |
Kovalev_D | 159:38f39c0c143f | 56 | |
Kovalev_D | 159:38f39c0c143f | 57 | |
Kovalev_D | 188:4c523cc373cc | 58 | Out_G_photo(100,100); |
Kovalev_D | 158:0c8342e1837a | 59 | //Out_G_photo(200,200); //запись в буфер мастера принятые от функции данные (60,60) и установка флага старта передачи и занятой шины. |
Kovalev_D | 165:b2bd0c810a4f | 60 | WriteCon1("\n\r 123456789...GL start programm uart ACK.... "); |
Kovalev_D | 47:d902ef6f7564 | 61 | WriteCon("\n\r ...GL start programm uart Tech.... "); |
igor_v | 15:f5191a1c3805 | 62 | sprintf(Time,"\r\nCompiled: %s %s.",__DATE__, __TIME__ ); //Подготовка даты и времени компиляции |
igor_v | 13:e2a1d18677b8 | 63 | WriteCon(Time); |
Kovalev_D | 150:29c9f7671bac | 64 | |
Kovalev_D | 183:7e200f4d9b16 | 65 | |
Kovalev_D | 150:29c9f7671bac | 66 | |
Kovalev_D | 150:29c9f7671bac | 67 | while ( 1 ){ //основной цикл. |
Kovalev_D | 150:29c9f7671bac | 68 | |
Kovalev_D | 147:1aed74f19a8f | 69 | G_Photo_Exchange(); |
Kovalev_D | 108:030cdde08314 | 70 | Concol (); // Проврка 0 консоли (вход и выход) |
Kovalev_D | 93:b3803774f110 | 71 | Concol1 (); // Проврка 0 консоли (вход и выход) |
Kovalev_D | 99:3d8f206ceac2 | 72 | Read_CMD(); |
igor_v | 3:ed8744c5f67a | 73 | if (OutBufConCount) OutBufConCount--; |
Kovalev_D | 108:030cdde08314 | 74 | if (OutBufCon1Count) OutBufCon1Count--; |
Kovalev_D | 104:ab1cb4ff56b2 | 75 | |
Kovalev_D | 147:1aed74f19a8f | 76 | TechLog();//технологическая выдача |
Kovalev_D | 136:19b9e6abb86f | 77 | |
Kovalev_D | 116:66f1f0ff2dab | 78 | Event_100KHz(); |
Kovalev_D | 88:b5c1d9d338d1 | 79 | Event_1KHz(); |
Kovalev_D | 124:9ae09249f842 | 80 | Event_500Hz(); |
Kovalev_D | 116:66f1f0ff2dab | 81 | Event_1Hz(); |
Kovalev_D | 88:b5c1d9d338d1 | 82 | Event_Vibro(); |
Kovalev_D | 150:29c9f7671bac | 83 | |
Kovalev_D | 150:29c9f7671bac | 84 | |
Kovalev_D | 150:29c9f7671bac | 85 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 86 | ////////////////////////////////////выдача параметров через Rate//////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 87 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 88 | switch(Gyro.ModeOut) { |
Kovalev_D | 150:29c9f7671bac | 89 | case 1: if(Gyro.Rate1_Event == 1) CMD_Rate(); break; |
Kovalev_D | 150:29c9f7671bac | 90 | case 2: if(Gyro.Rate2_Event == 1) CMD_Rate2(); break; |
Kovalev_D | 150:29c9f7671bac | 91 | case 3: if(Gyro.Delta500_Event == 1) CMD_Delta_500Hz(); break; |
Kovalev_D | 150:29c9f7671bac | 92 | case 4: if(Gyro.EXT_Latch == 1) CMD_Delta_Ext(); break; |
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 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 150:29c9f7671bac | 99 | if (Spi.ADC_NewData == 1) {ADS_Acum(); } // был приход новых данных по ацп сдесь сделать обработку информации и подготовку для выдачи делается 1 раз за вибро |
Kovalev_D | 150:29c9f7671bac | 100 | if (Gyro.ADF_NewData == 1) {Gyro.ADF_NewData = 0; } // был приход новых данных После быстрого фильтра AD |
Kovalev_D | 168:f4a6abb18358 | 101 | if (Gyro.ADS_NewData == 1) {Gyro.ADS_NewData = 0; if(Gyro.ModJump == 3){ShowMod();} else {PlcRegul();}} // был приход новых данных После Медленного фильтра AD (гдето раз в 0.63 секунды )//регулировка периметра. |
Kovalev_D | 150:29c9f7671bac | 102 | if (Gyro.VibroFrqRegulF == 1) {Gyro.VibroFrqRegulF = 0; VibroFrqRegul(); } // Регулеровка частоты виброподвеса |
Kovalev_D | 150:29c9f7671bac | 103 | if (Gyro.VibroAMPRegulF == 1) {Gyro.VibroAMPRegulF = 0; VibroAMPRegul(); } // Регулеровка Амплитуды виброподвеса |
Kovalev_D | 150:29c9f7671bac | 104 | if (Gyro.VibroNoiseF == 1) {Gyro.VibroNoiseF = 0; CalcAmpN(); } // регулеровка ошумления, наверно нужно объеденить с регулеровкой ампитуды |
Kovalev_D | 150:29c9f7671bac | 105 | if (Gyro.VibroOutF == 1) {Gyro.VibroOutF = 0; VibroOut(); } // установка ног в регисторе тоже подумать , зачем отделный флаг? наверно |
Kovalev_D | 150:29c9f7671bac | 106 | |
Kovalev_D | 150:29c9f7671bac | 107 | |
Kovalev_D | 150:29c9f7671bac | 108 | |
Kovalev_D | 189:8a16378724c4 | 109 | |
Kovalev_D | 132:2c7bec5cf6fe | 110 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 132:2c7bec5cf6fe | 111 | /////////////////////////Работа с Flash////////////////////////////////////////////////////////////////// |
Kovalev_D | 132:2c7bec5cf6fe | 112 | ///////////////////////////////////////////////////////////////////////////////////////////////////////// |
Kovalev_D | 147:1aed74f19a8f | 113 | if(Gyro.FlashMod == 1) {GoBoot(); } |
Kovalev_D | 147:1aed74f19a8f | 114 | if(Gyro.FlashMod == 2) {WriteFlash(); } |
Kovalev_D | 147:1aed74f19a8f | 115 | if(Gyro.FlashMod == 3) {ReadFlash(); } |
Kovalev_D | 136:19b9e6abb86f | 116 | |
Kovalev_D | 147:1aed74f19a8f | 117 | } |
Kovalev_D | 132:2c7bec5cf6fe | 118 | }//main |
igor_v | 0:8ad47e2b6f00 | 119 | |
igor_v | 0:8ad47e2b6f00 | 120 | /****************************************************************************** |
igor_v | 0:8ad47e2b6f00 | 121 | ** End Of File |
igor_v | 0:8ad47e2b6f00 | 122 | ******************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 123 | |
igor_v | 0:8ad47e2b6f00 | 124 |