![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
n
Fork of LG by
main.c@14:555e68b5413b, 2016-02-02 (annotated)
- Committer:
- igor_v
- Date:
- Tue Feb 02 15:15:58 2016 +0000
- Revision:
- 14:555e68b5413b
- Parent:
- 13:e2a1d18677b8
- Child:
- 15:f5191a1c3805
1
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 | 0:8ad47e2b6f00 | 15 | *********************************************************************************************************/ |
Kovalev_D | 7:078abbed4565 | 16 | // первое изменение певое изменения Дмитрия ghjdthrth |
igor_v | 0:8ad47e2b6f00 | 17 | |
igor_v | 0:8ad47e2b6f00 | 18 | #include "Global.h" |
igor_v | 0:8ad47e2b6f00 | 19 | //#include <math.h> |
igor_v | 0:8ad47e2b6f00 | 20 | |
Kovalev_D | 10:8d2edc51f3c9 | 21 | |
Kovalev_D | 10:8d2edc51f3c9 | 22 | |
Kovalev_D | 10:8d2edc51f3c9 | 23 | |
Kovalev_D | 10:8d2edc51f3c9 | 24 | //проба версий |
Kovalev_D | 10:8d2edc51f3c9 | 25 | |
Kovalev_D | 10:8d2edc51f3c9 | 26 | |
Kovalev_D | 10:8d2edc51f3c9 | 27 | |
Kovalev_D | 10:8d2edc51f3c9 | 28 | |
Kovalev_D | 10:8d2edc51f3c9 | 29 | |
igor_v | 0:8ad47e2b6f00 | 30 | /****************************************************************************** |
igor_v | 0:8ad47e2b6f00 | 31 | ** Main Function main() |
igor_v | 0:8ad47e2b6f00 | 32 | ******************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 33 | extern uint32_t CMD_Mode; |
igor_v | 0:8ad47e2b6f00 | 34 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 35 | ////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 3:ed8744c5f67a | 36 | int i1 =0; |
igor_v | 0:8ad47e2b6f00 | 37 | //extern unsigned int Buff_QEI[256]; |
igor_v | 0:8ad47e2b6f00 | 38 | volatile unsigned int IRQ_Counter=0; |
igor_v | 0:8ad47e2b6f00 | 39 | volatile uint32_t timer1_counter = 0; |
igor_v | 0:8ad47e2b6f00 | 40 | int temp111=0,temp=0; |
igor_v | 0:8ad47e2b6f00 | 41 | int y = 0; |
igor_v | 0:8ad47e2b6f00 | 42 | int CuruAngleOld=0; |
igor_v | 0:8ad47e2b6f00 | 43 | unsigned int LightUpCount,BackLightCount,secPuls,CountBI,CmmandIn,tt,th; |
igor_v | 0:8ad47e2b6f00 | 44 | |
igor_v | 0:8ad47e2b6f00 | 45 | unsigned int paramV; |
igor_v | 0:8ad47e2b6f00 | 46 | |
igor_v | 0:8ad47e2b6f00 | 47 | |
igor_v | 0:8ad47e2b6f00 | 48 | |
igor_v | 0:8ad47e2b6f00 | 49 | void Led_init() |
igor_v | 0:8ad47e2b6f00 | 50 | { |
igor_v | 3:ed8744c5f67a | 51 | LPC_PINCON->PINSEL0 = (0x00<<28); |
igor_v | 3:ed8744c5f67a | 52 | LPC_GPIO1->FIODIR = (0x1<<30); |
igor_v | 3:ed8744c5f67a | 53 | LPC_PINCON->PINMODE0 = (0x3<<28); |
igor_v | 3:ed8744c5f67a | 54 | // LPC_GPIO1->FIOSET = (0x0<<30); |
igor_v | 3:ed8744c5f67a | 55 | // LPC_GPIO0->FIOSET = (1<<4); |
igor_v | 0:8ad47e2b6f00 | 56 | } |
igor_v | 3:ed8744c5f67a | 57 | |
igor_v | 0:8ad47e2b6f00 | 58 | int flag=0, TIME=0,t=0, Sec=0,tmpSec=0,SEC=0, mSec=0; |
igor_v | 0:8ad47e2b6f00 | 59 | int tempsec=0; |
igor_v | 0:8ad47e2b6f00 | 60 | float DACF, K_DAC; |
igor_v | 3:ed8744c5f67a | 61 | |
igor_v | 0:8ad47e2b6f00 | 62 | void Led_Blink() |
igor_v | 0:8ad47e2b6f00 | 63 | { |
igor_v | 3:ed8744c5f67a | 64 | if (flag == 0) { |
igor_v | 3:ed8744c5f67a | 65 | LPC_GPIO1->FIOSET = (0x1<<30); |
igor_v | 3:ed8744c5f67a | 66 | flag=1; |
igor_v | 3:ed8744c5f67a | 67 | } else { |
igor_v | 3:ed8744c5f67a | 68 | flag =0; |
igor_v | 3:ed8744c5f67a | 69 | LPC_GPIO1->FIOCLR = (0x01<<30); |
igor_v | 3:ed8744c5f67a | 70 | } |
igor_v | 0:8ad47e2b6f00 | 71 | } |
igor_v | 0:8ad47e2b6f00 | 72 | |
igor_v | 0:8ad47e2b6f00 | 73 | long LED_TEMP=0; |
igor_v | 11:af609f6dee46 | 74 | |
igor_v | 11:af609f6dee46 | 75 | |
igor_v | 11:af609f6dee46 | 76 | |
igor_v | 12:74bd0ecf7f83 | 77 | |
igor_v | 0:8ad47e2b6f00 | 78 | int main (void) |
igor_v | 0:8ad47e2b6f00 | 79 | { |
igor_v | 5:02e9f559395c | 80 | K_DAC=65535.0/(65535.0+(deltaDAC+deltaDAC/2)); |
igor_v | 5:02e9f559395c | 81 | K_DAC=0.8; |
igor_v | 0:8ad47e2b6f00 | 82 | |
igor_v | 5:02e9f559395c | 83 | Main.Firmware_Version=0x15; |
igor_v | 5:02e9f559395c | 84 | Main.GLD_Serial = 0x20; |
igor_v | 5:02e9f559395c | 85 | Main.My_Addres=0; |
igor_v | 5:02e9f559395c | 86 | LightUpCount=1000; |
igor_v | 5:02e9f559395c | 87 | BackLightCount=5000; |
igor_v | 5:02e9f559395c | 88 | secPuls=0; |
igor_v | 5:02e9f559395c | 89 | Pulse_midl = 0; |
igor_v | 5:02e9f559395c | 90 | PulseHalf = 0; |
igor_v | 5:02e9f559395c | 91 | CuruAngle = 0; |
igor_v | 5:02e9f559395c | 92 | Spi.DAC_A=0x7fff; |
igor_v | 6:6c5cd8c615cc | 93 | Spi.DAC_B = 0x7fff; |
igor_v | 5:02e9f559395c | 94 | //������������� |
igor_v | 11:af609f6dee46 | 95 | |
igor_v | 12:74bd0ecf7f83 | 96 | SystemInit1(); // ������������� �������ввававва |
igor_v | 5:02e9f559395c | 97 | Led_init(); |
igor_v | 12:74bd0ecf7f83 | 98 | |
igor_v | 5:02e9f559395c | 99 | ///* |
igor_v | 5:02e9f559395c | 100 | //���������������� ������� ������� |
igor_v | 5:02e9f559395c | 101 | LPC_PINCON->PINSEL0 &= ~(3<<8); //e. P0.4 is GPIO pin (������ ( 00 ) � 9:8 ��� PISEL0 ����� P0.4 ��� GPIO) |
igor_v | 5:02e9f559395c | 102 | LPC_PINCON->PINMODE0 |= (3<<8); //e. P0.4 is GPIO pin (������ ( 11 ) � 9:8 ��� PINMODE0 "��� ��������� �������������� ���������") |
igor_v | 5:02e9f559395c | 103 | LPC_GPIO0->FIODIR |= (1<<4); //e. P0.4 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.4 ��� �����) |
igor_v | 5:02e9f559395c | 104 | LightUpON //e. P0.4 is output (������ ( 1 ) � 5 ��� CLR ������������� �� P0.4 ������ ������� �������) |
igor_v | 11:af609f6dee46 | 105 | |
igor_v | 11:af609f6dee46 | 106 | |
igor_v | 11:af609f6dee46 | 107 | |
igor_v | 11:af609f6dee46 | 108 | |
igor_v | 12:74bd0ecf7f83 | 109 | |
igor_v | 12:74bd0ecf7f83 | 110 | |
igor_v | 12:74bd0ecf7f83 | 111 | |
igor_v | 5:02e9f559395c | 112 | /* |
igor_v | 5:02e9f559395c | 113 | LPC_PINCON->PINSEL0 &= ~(3<<10); //e. P0.4 is GPIO pin (������ ( 00 ) � 9:8 ��� PISEL0 ����� P0.4 ��� GPIO) |
igor_v | 5:02e9f559395c | 114 | LPC_PINCON->PINMODE0 |= (3<<10); //e. P0.4 is GPIO pin (������ ( 11 ) � 9:8 ��� PINMODE0 "��� ��������� �������������� ���������") |
igor_v | 5:02e9f559395c | 115 | LPC_GPIO0->FIODIR |= (1<<5); //e. P0.4 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.4 ��� �����) |
igor_v | 5:02e9f559395c | 116 | LPC_GPIO0->FIOCLR |= (1<<5); //e. P0.4 is output (������ ( 1 ) � 5 ��� CLR ������������� �� P0.4 ������ ������� �������)*/ |
igor_v | 3:ed8744c5f67a | 117 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 118 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 3:ed8744c5f67a | 119 | |
igor_v | 5:02e9f559395c | 120 | LPC_PINCON->PINSEL3 = (0x00<<18); //e. P1.25 is GPIO pin |
igor_v | 5:02e9f559395c | 121 | LPC_PINCON->PINMODE3 |= (3<<18); //e. P1.25 (��������e �������������� ���������") |
igor_v | 5:02e9f559395c | 122 | LPC_GPIO1->FIODIR |= (1<<25); //e. P0.5 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.5 ��� �����) |
igor_v | 5:02e9f559395c | 123 | LPC_GPIO1->FIOCLR |= (1<<25); |
igor_v | 3:ed8744c5f67a | 124 | |
igor_v | 3:ed8744c5f67a | 125 | |
igor_v | 0:8ad47e2b6f00 | 126 | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 3:ed8744c5f67a | 127 | |
igor_v | 5:02e9f559395c | 128 | LPC_PINCON->PINSEL3 = (0x00<<24); //e. P1.28 is GPIO pin |
igor_v | 5:02e9f559395c | 129 | LPC_PINCON->PINMODE3 |= (3<<24); //e. P1.28 is GPIO pin (������ ( 11 ) � ��� PINMODE0 "��� ��������� �������������� ���������") |
igor_v | 5:02e9f559395c | 130 | LPC_GPIO1->FIODIR |= (1<<28); //e. P1.28 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.5 ��� �����) |
igor_v | 5:02e9f559395c | 131 | LPC_GPIO1->FIOCLR |= (1<<28); |
igor_v | 3:ed8744c5f67a | 132 | // init_timer(TIME_INTERVAL ); // 10ms |
igor_v | 3:ed8744c5f67a | 133 | // enable_timer1(); |
igor_v | 0:8ad47e2b6f00 | 134 | ///������������� ��������� |
igor_v | 5:02e9f559395c | 135 | LPC_PINCON->PINSEL2 = (0x00<<24); //e. P2.12 is GPIO pin |
igor_v | 5:02e9f559395c | 136 | LPC_PINCON->PINMODE3 |= (3<<24); //e. P1.28 is GPIO pin (������ ( 11 ) � ��� PINMODE0 "��� ��������� �������������� ���������") |
igor_v | 5:02e9f559395c | 137 | LPC_GPIO2->FIODIR |= (1<<12); //e. P1.28 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.5 ��� �����) |
igor_v | 5:02e9f559395c | 138 | LPC_GPIO2->FIOCLR |= (1<<12); |
igor_v | 3:ed8744c5f67a | 139 | |
igor_v | 3:ed8744c5f67a | 140 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 141 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 5:02e9f559395c | 142 | /* |
igor_v | 5:02e9f559395c | 143 | //���������������� ������� ������� ��������� ���� (������ �� 80 ���� ������ 81) |
igor_v | 5:02e9f559395c | 144 | LPC_PINCON->PINSEL0 = (0x00<<10); //e. P0.5 is GPIO pin (������ ( 00 ) � 11:10 ��� PISEL0 ����� P0.5 ��� GPIO) |
igor_v | 5:02e9f559395c | 145 | LPC_PINCON->PINMODE0 |= (3<<10); //e. P0.5 is GPIO pin (������ ( 11 ) � 11:10 ��� PINMODE0 "��� ��������� �������������� ���������") |
igor_v | 5:02e9f559395c | 146 | LPC_GPIO0->FIODIR |= (1<<5); //e. P0.5 is output (������ ( 1 ) � 5 ��� FIODIR ����� P0.5 ��� �����) |
igor_v | 5:02e9f559395c | 147 | LPC_GPIO0->FIOCLR |= (1<<5); //e. P0.5 is output (������ ( 1 ) � 5 ��� CLR ������������� �� P0.5 ������ ������� �������) |
igor_v | 5:02e9f559395c | 148 | */ |
igor_v | 5:02e9f559395c | 149 | DMA_Init(); // ������������� DMA |
igor_v | 5:02e9f559395c | 150 | FlashDMA_Init(); // �������� ���������� � ���� |
igor_v | 3:ed8744c5f67a | 151 | |
igor_v | 12:74bd0ecf7f83 | 152 | SystemCoreClockUpdate1(); // ������ ��������� ������� ��� UART. |
igor_v | 5:02e9f559395c | 153 | UARTInit(); // ������������� UART0 �� �������� 38400. |
igor_v | 5:02e9f559395c | 154 | UART1_Init(); // ������������� UART1 �� �������� 38400. |
igor_v | 3:ed8744c5f67a | 155 | |
igor_v | 0:8ad47e2b6f00 | 156 | |
igor_v | 5:02e9f559395c | 157 | DAC_ADC_Exchange_Init(); // ������������� ������ ��� � ���. |
igor_v | 5:02e9f559395c | 158 | DACInit(); // ������������� ���. |
igor_v | 5:02e9f559395c | 159 | SOI_Init(); // ������������� ������������� ��������. |
igor_v | 3:ed8744c5f67a | 160 | |
igor_v | 5:02e9f559395c | 161 | IntLatch_Init(); // ������������� ���������� �������. |
igor_v | 5:02e9f559395c | 162 | ExtLatch_Init(); // ������������� ������� �������. |
igor_v | 0:8ad47e2b6f00 | 163 | |
igor_v | 3:ed8744c5f67a | 164 | //----------------debug------------------------- |
igor_v | 5:02e9f559395c | 165 | //LPC_GPIO2->FIODIR = 0x5C; // P2.0...P2.7 defined as Outputs |
igor_v | 5:02e9f559395c | 166 | //LPC_GPIO2->FIOCLR = 0x5C; // turn off all the LEDs |
igor_v | 3:ed8744c5f67a | 167 | //----------------debug------------------------- |
igor_v | 3:ed8744c5f67a | 168 | |
igor_v | 3:ed8744c5f67a | 169 | |
igor_v | 13:e2a1d18677b8 | 170 | |
igor_v | 5:02e9f559395c | 171 | LoadFlashParam(FromFLASH); //�������� ����������. |
igor_v | 5:02e9f559395c | 172 | UART_DMA_Init(); //������������� DMA ��� UART. |
igor_v | 5:02e9f559395c | 173 | G_Photo_Init(); //������������� ���������� I2C ��� �������������. |
igor_v | 5:02e9f559395c | 174 | Out_G_photo(60, 60); //������ � ����� ������� �������� �� ������� ������ (60,60) � ��������� ����� ������ �������� � ������� ����. |
igor_v | 0:8ad47e2b6f00 | 175 | // WDTInit(); |
igor_v | 0:8ad47e2b6f00 | 176 | |
igor_v | 0:8ad47e2b6f00 | 177 | |
igor_v | 5:02e9f559395c | 178 | open_all_loops(); //#define open_all_loops() RgConA = 0 (�������� ������� ���������� ���������� (0 - ��������, 1 - ���������)). |
igor_v | 5:02e9f559395c | 179 | Output.Str.HF_reg = Device_blk.Str.HF_min; //HFO output voltage = ������������ ���������� �� ���. |
igor_v | 5:02e9f559395c | 180 | init_PLC(); //������������� ���(����������� ���������) |
igor_v | 5:02e9f559395c | 181 | init_Dither_reg(); //������������� ������������ |
igor_v | 5:02e9f559395c | 182 | RgConB = RATE_VIBRO_1; // �������������� ������� ���������� = �������� �������������� ����� ������� ������.��������(#define RATE_VIBRO_1 0x0001) |
igor_v | 5:02e9f559395c | 183 | init_Vibro(); |
igor_v | 5:02e9f559395c | 184 | init_timer(TIME_INTERVAL ); // 10ms |
igor_v | 5:02e9f559395c | 185 | enable_timer1(); |
igor_v | 5:02e9f559395c | 186 | Init_TIM2(); |
igor_v | 5:02e9f559395c | 187 | enable_timer2(); |
igor_v | 5:02e9f559395c | 188 | close_all_loops(); |
igor_v | 0:8ad47e2b6f00 | 189 | |
igor_v | 13:e2a1d18677b8 | 190 | |
igor_v | 5:02e9f559395c | 191 | LPC_GPIO0->FIOCLR = (1<<5); |
igor_v | 5:02e9f559395c | 192 | |
igor_v | 3:ed8744c5f67a | 193 | |
igor_v | 3:ed8744c5f67a | 194 | Pulse_8Point = 0; |
igor_v | 3:ed8744c5f67a | 195 | Pulse_16Point = 0; |
igor_v | 3:ed8744c5f67a | 196 | Pulse_32Point = 0; |
igor_v | 0:8ad47e2b6f00 | 197 | |
igor_v | 3:ed8744c5f67a | 198 | Temp_AMP=0; |
igor_v | 3:ed8744c5f67a | 199 | Temp_ADC_2=0; |
igor_v | 3:ed8744c5f67a | 200 | Temp_ADC_3=0; |
igor_v | 3:ed8744c5f67a | 201 | Temp_ADC_4=0; |
igor_v | 3:ed8744c5f67a | 202 | Temp_ADC_5=0; |
igor_v | 0:8ad47e2b6f00 | 203 | |
igor_v | 3:ed8744c5f67a | 204 | for (y = 0; y < 256; y++ ) { |
igor_v | 5:02e9f559395c | 205 | Buff_16Point[y] = 0xffff; |
igor_v | 5:02e9f559395c | 206 | Buff_8Point[y] = 0xffff; |
igor_v | 5:02e9f559395c | 207 | Buff_32Point[y] = 0xffff; |
igor_v | 5:02e9f559395c | 208 | Buff_ADC_1[y] = 0; // ���� ���. |
igor_v | 5:02e9f559395c | 209 | Buff_ADC_2[y] = 0; |
igor_v | 5:02e9f559395c | 210 | Buff_ADC_3[y] = 0; |
igor_v | 5:02e9f559395c | 211 | Buff_ADC_4[y] = 0; |
igor_v | 5:02e9f559395c | 212 | Buff_ADC_5[y] = 0; |
igor_v | 0:8ad47e2b6f00 | 213 | |
igor_v | 3:ed8744c5f67a | 214 | } |
igor_v | 0:8ad47e2b6f00 | 215 | |
igor_v | 0:8ad47e2b6f00 | 216 | |
igor_v | 0:8ad47e2b6f00 | 217 | |
igor_v | 12:74bd0ecf7f83 | 218 | |
igor_v | 13:e2a1d18677b8 | 219 | WriteCon("\n\r ...GL start programm uart0.... "); |
igor_v | 13:e2a1d18677b8 | 220 | sprintf(Time,"\r\nCompiled: %s %s.",__DATE__, __TIME__ ); //Подготовка даты и времени компиляции Полной |
igor_v | 13:e2a1d18677b8 | 221 | WriteCon(Time); |
igor_v | 11:af609f6dee46 | 222 | |
igor_v | 11:af609f6dee46 | 223 | |
igor_v | 11:af609f6dee46 | 224 | |
igor_v | 3:ed8744c5f67a | 225 | do { //�������� ����. |
igor_v | 3:ed8744c5f67a | 226 | if (OutBufConCount) OutBufConCount--; |
igor_v | 3:ed8744c5f67a | 227 | Concol (); |
igor_v | 13:e2a1d18677b8 | 228 | // Concol1 (); |
igor_v | 3:ed8744c5f67a | 229 | Read_CMD(); |
igor_v | 3:ed8744c5f67a | 230 | |
igor_v | 3:ed8744c5f67a | 231 | // VibroOut(); |
igor_v | 3:ed8744c5f67a | 232 | |
igor_v | 3:ed8744c5f67a | 233 | if(Time_1kHz>100) { |
igor_v | 3:ed8744c5f67a | 234 | |
igor_v | 3:ed8744c5f67a | 235 | SEC++; |
igor_v | 5:02e9f559395c | 236 | if(Rate_Flag==1 && SEC>500) { |
igor_v | 3:ed8744c5f67a | 237 | SEC-=500; |
igor_v | 12:74bd0ecf7f83 | 238 | // CMD_Rate(); |
igor_v | 3:ed8744c5f67a | 239 | } |
igor_v | 3:ed8744c5f67a | 240 | |
igor_v | 3:ed8744c5f67a | 241 | Time_1kHz-=100; |
igor_v | 3:ed8744c5f67a | 242 | if(LightUpCount) { |
igor_v | 3:ed8744c5f67a | 243 | LightUpCount--; |
igor_v | 3:ed8744c5f67a | 244 | LightUpON |
igor_v | 3:ed8744c5f67a | 245 | } |
igor_v | 0:8ad47e2b6f00 | 246 | |
igor_v | 3:ed8744c5f67a | 247 | else { |
igor_v | 3:ed8744c5f67a | 248 | LightUpOFF; |
igor_v | 3:ed8744c5f67a | 249 | } |
igor_v | 3:ed8744c5f67a | 250 | if(BackLightCount) { |
igor_v | 3:ed8744c5f67a | 251 | BackLightCount--; |
igor_v | 3:ed8744c5f67a | 252 | BackLightON |
igor_v | 3:ed8744c5f67a | 253 | } else { |
igor_v | 3:ed8744c5f67a | 254 | BackLightOFF; |
igor_v | 3:ed8744c5f67a | 255 | } |
igor_v | 3:ed8744c5f67a | 256 | } |
igor_v | 3:ed8744c5f67a | 257 | ButtonLightUP(); |
igor_v | 3:ed8744c5f67a | 258 | //Device_blk.Str. |
igor_v | 12:74bd0ecf7f83 | 259 | // TakeFromBuff(); |
igor_v | 3:ed8744c5f67a | 260 | |
igor_v | 3:ed8744c5f67a | 261 | //���������� �������. |
igor_v | 3:ed8744c5f67a | 262 | // paramV=TakeParam(1); |
igor_v | 3:ed8744c5f67a | 263 | |
igor_v | 3:ed8744c5f67a | 264 | |
igor_v | 3:ed8744c5f67a | 265 | if (LPC_PWM1->IR & 0x0001) { // ���� � �������� ���������� ���1 (������� PWM1IR) ���� ���� ���������� ���������� �������� � ����� (lim0 ?) ��: |
igor_v | 3:ed8744c5f67a | 266 | /* ResetCS(ADC); //prepare ADC for sampling |
igor_v | 3:ed8744c5f67a | 267 | SetDAC(DAC); |
igor_v | 3:ed8744c5f67a | 268 | LPC_GPIO2->FIOSET |= 0x0000004; // turn on the LED |
igor_v | 3:ed8744c5f67a | 269 | LPC_GPIO2->FIOSET |= 0x0000004; // turn on the LED |
igor_v | 3:ed8744c5f67a | 270 | LPC_GPIO2->FIOSET |= 0x0000004; // turn on the LED |
igor_v | 3:ed8744c5f67a | 271 | SetCS(ADC); //start ADC sampling |
igor_v | 3:ed8744c5f67a | 272 | ResetDAC(DAC); //start DAC prepearing for writing |
igor_v | 3:ed8744c5f67a | 273 | |
igor_v | 3:ed8744c5f67a | 274 | */ |
igor_v | 3:ed8744c5f67a | 275 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 276 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 277 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 3:ed8744c5f67a | 278 | |
igor_v | 3:ed8744c5f67a | 279 | |
igor_v | 3:ed8744c5f67a | 280 | secPuls++; |
igor_v | 3:ed8744c5f67a | 281 | tmpSec++; |
igor_v | 3:ed8744c5f67a | 282 | mSec++; |
igor_v | 0:8ad47e2b6f00 | 283 | |
igor_v | 3:ed8744c5f67a | 284 | i1++; |
igor_v | 3:ed8744c5f67a | 285 | if(i1>10000) |
igor_v | 3:ed8744c5f67a | 286 | //if(CountV31>30) |
igor_v | 3:ed8744c5f67a | 287 | { |
igor_v | 14:555e68b5413b | 288 | WriteCon("."); |
igor_v | 3:ed8744c5f67a | 289 | i1=0; |
igor_v | 3:ed8744c5f67a | 290 | /* |
igor_v | 3:ed8744c5f67a | 291 | SendToBuffStr("\n\r"); |
igor_v | 3:ed8744c5f67a | 292 | // if (Buff_ADC_1 [y] > 65535)SendToBuffStr(" 0 "); else SendToBuffStr(" 1 "); |
igor_v | 3:ed8744c5f67a | 293 | sprintf (BuffTemp,"<%05d> <%05d> <%05d> <%05d> <%05d>", Temp_AMP>>5,Temp_ADC_2>>5,Temp_ADC_3>>5,Temp_ADC_4>>5,Temp_ADC_5>>5); |
igor_v | 3:ed8744c5f67a | 294 | // sprintf (BuffTemp,"<%07d> <%07d> <%07d> <%07d> <%07d>", Spi.ADC1,Spi.ADC2,Spi.ADC3,Spi.ADC4,Spi.ADC5); |
igor_v | 3:ed8744c5f67a | 295 | SendToBuffStr(BuffTemp); |
igor_v | 3:ed8744c5f67a | 296 | */ |
igor_v | 3:ed8744c5f67a | 297 | /* |
igor_v | 3:ed8744c5f67a | 298 | WriteConByte (Main.T_Vib&0xff00); |
igor_v | 3:ed8744c5f67a | 299 | WriteConByte (Main.T_Vib&0x00ff); |
igor_v | 3:ed8744c5f67a | 300 | WriteConByte (Main.T_Vib); |
igor_v | 3:ed8744c5f67a | 301 | */ |
igor_v | 3:ed8744c5f67a | 302 | /* |
igor_v | 3:ed8744c5f67a | 303 | |
igor_v | 3:ed8744c5f67a | 304 | for (y = 0; y < 32; y++ ) |
igor_v | 3:ed8744c5f67a | 305 | { |
igor_v | 3:ed8744c5f67a | 306 | |
igor_v | 3:ed8744c5f67a | 307 | WriteCon(BuffTemp); |
igor_v | 3:ed8744c5f67a | 308 | } WriteCon("\n\r"); |
igor_v | 0:8ad47e2b6f00 | 309 | |
igor_v | 3:ed8744c5f67a | 310 | */ |
igor_v | 3:ed8744c5f67a | 311 | /* |
igor_v | 3:ed8744c5f67a | 312 | Main.T_Vib=((7680000*16/Main.Frq)*4096); |
igor_v | 3:ed8744c5f67a | 313 | th= Main.T_Vib&0xff00; |
igor_v | 3:ed8744c5f67a | 314 | tt= Main.T_Vib&0x00ff; |
igor_v | 3:ed8744c5f67a | 315 | sprintf(BuffTemp,"<%07d >",( (Main.T_Vib&0xff00))); |
igor_v | 3:ed8744c5f67a | 316 | SendToBuffStr(BuffTemp); |
igor_v | 3:ed8744c5f67a | 317 | |
igor_v | 3:ed8744c5f67a | 318 | sprintf(BuffTemp,"<%07d >",( ( Main.T_Vib&0x00ff))); |
igor_v | 3:ed8744c5f67a | 319 | SendToBuffStr(BuffTemp); |
igor_v | 13:e2a1d18677b8 | 320 | |
igor_v | 3:ed8744c5f67a | 321 | CuruAngleOld=CuruAngle;*/ |
igor_v | 3:ed8744c5f67a | 322 | // Spi.ADC1=Spi.ADC1*0.000061; |
igor_v | 3:ed8744c5f67a | 323 | |
igor_v | 3:ed8744c5f67a | 324 | |
igor_v | 3:ed8744c5f67a | 325 | |
igor_v | 3:ed8744c5f67a | 326 | |
igor_v | 3:ed8744c5f67a | 327 | /* |
igor_v | 3:ed8744c5f67a | 328 | |
igor_v | 3:ed8744c5f67a | 329 | sprintf(BuffTemp,"\n\r<%05d><%05d><%05d><%05d><%05d>",Spi.ADC1,Spi.ADC2,Spi.ADC3,Spi.ADC4,Spi.ADC5); |
igor_v | 3:ed8744c5f67a | 330 | SendToBuffStr(BuffTemp); |
igor_v | 3:ed8744c5f67a | 331 | |
igor_v | 3:ed8744c5f67a | 332 | */ |
igor_v | 3:ed8744c5f67a | 333 | |
igor_v | 3:ed8744c5f67a | 334 | /* sprintf(BuffTemp,"<%d>",(FrecTemp)); |
igor_v | 3:ed8744c5f67a | 335 | SendToBuffStr(BuffTemp); |
igor_v | 3:ed8744c5f67a | 336 | for (y = 0; y < 32; y++ ) |
igor_v | 3:ed8744c5f67a | 337 | { |
igor_v | 3:ed8744c5f67a | 338 | sprintf(BuffTemp," <%07d>", (Buff_16PointD [y]-65535)); |
igor_v | 3:ed8744c5f67a | 339 | SendToBuffStr(BuffTemp); |
igor_v | 3:ed8744c5f67a | 340 | } */ |
igor_v | 14:555e68b5413b | 341 | |
igor_v | 3:ed8744c5f67a | 342 | } |
igor_v | 3:ed8744c5f67a | 343 | |
igor_v | 3:ed8744c5f67a | 344 | |
igor_v | 3:ed8744c5f67a | 345 | |
igor_v | 3:ed8744c5f67a | 346 | |
igor_v | 0:8ad47e2b6f00 | 347 | |
igor_v | 0:8ad47e2b6f00 | 348 | |
igor_v | 0:8ad47e2b6f00 | 349 | |
igor_v | 0:8ad47e2b6f00 | 350 | |
igor_v | 0:8ad47e2b6f00 | 351 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 352 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 353 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
igor_v | 0:8ad47e2b6f00 | 354 | |
igor_v | 0:8ad47e2b6f00 | 355 | |
igor_v | 0:8ad47e2b6f00 | 356 | |
igor_v | 3:ed8744c5f67a | 357 | |
igor_v | 3:ed8744c5f67a | 358 | LPC_GPIO2->FIOSET |= 0x0000004; // turn on the LED |
igor_v | 3:ed8744c5f67a | 359 | |
igor_v | 0:8ad47e2b6f00 | 360 | |
igor_v | 3:ed8744c5f67a | 361 | Curr_Cnt_Vib = LPC_QEI->POS; // �������� � ���������� Curr_Cnt_Vib ������� ��������� ��������. (������� ���������� ���������) |
igor_v | 3:ed8744c5f67a | 362 | Latch_Event(); //����������� ������� |
igor_v | 3:ed8744c5f67a | 363 | |
igor_v | 3:ed8744c5f67a | 364 | clc_Pulses(); // ������� ���������. RATE_REPER_OR_REFMEANDR ��� RATE_VIBRO_1 |
igor_v | 0:8ad47e2b6f00 | 365 | |
igor_v | 0:8ad47e2b6f00 | 366 | |
igor_v | 3:ed8744c5f67a | 367 | //ADC_Input(); // �������� ������ ���������� ������ � ������� Thermo1, Thermo2, HF_out � ����� Input.ArrayIn[n]. |
igor_v | 3:ed8744c5f67a | 368 | //DAC_ADC_Exchange();// �������� ������ ���������� ������ � ����� � ����. |
igor_v | 3:ed8744c5f67a | 369 | ServiceTime();//��������� ������. |
igor_v | 3:ed8744c5f67a | 370 | clc_ThermoSensors();//������ ������� ����������� �� ������� |
igor_v | 3:ed8744c5f67a | 371 | clc_HFO(); //������ �������� ��� �������� � ������ ���(�� ���). |
igor_v | 3:ed8744c5f67a | 372 | clc_PLC(); |
igor_v | 3:ed8744c5f67a | 373 | // clc_Dith_regulator(); |
igor_v | 3:ed8744c5f67a | 374 | clc_OutFreq_regulator(); |
igor_v | 3:ed8744c5f67a | 375 | Output.Str.WP_sin = clc_WP_sin(); |
igor_v | 3:ed8744c5f67a | 376 | contrl_GLD(); |
igor_v | 3:ed8744c5f67a | 377 | G_Photo_Exchange(); |
igor_v | 3:ed8744c5f67a | 378 | // Output.Str.T_Vibro = paramV*48; |
igor_v | 0:8ad47e2b6f00 | 379 | |
igor_v | 3:ed8744c5f67a | 380 | |
igor_v | 3:ed8744c5f67a | 381 | Line_1_Rcv(); |
igor_v | 3:ed8744c5f67a | 382 | decode_CMD(); |
igor_v | 3:ed8744c5f67a | 383 | transm_DAT(); |
igor_v | 12:74bd0ecf7f83 | 384 | //îòêëþ÷åíèå ïîäæèãà. |
igor_v | 3:ed8744c5f67a | 385 | |
igor_v | 3:ed8744c5f67a | 386 | |
igor_v | 13:e2a1d18677b8 | 387 | // data_Rdy &= ~RESET_PERIOD; |
igor_v | 0:8ad47e2b6f00 | 388 | |
igor_v | 0:8ad47e2b6f00 | 389 | |
igor_v | 3:ed8744c5f67a | 390 | LPC_PWM1->IR = 0x0001; //e. clear interrupt flag |
igor_v | 13:e2a1d18677b8 | 391 | LPC_GPIO2->FIOCLR |= 0x0000004; // turn off the LED |
igor_v | 0:8ad47e2b6f00 | 392 | |
igor_v | 0:8ad47e2b6f00 | 393 | // WDTFeed(); |
igor_v | 0:8ad47e2b6f00 | 394 | //SPI_Exchange(); |
igor_v | 3:ed8744c5f67a | 395 | |
igor_v | 3:ed8744c5f67a | 396 | } |
igor_v | 3:ed8744c5f67a | 397 | |
igor_v | 3:ed8744c5f67a | 398 | } while ( 1 ); // main infinie loop |
igor_v | 0:8ad47e2b6f00 | 399 | } |
igor_v | 0:8ad47e2b6f00 | 400 | |
igor_v | 0:8ad47e2b6f00 | 401 | /****************************************************************************** |
igor_v | 0:8ad47e2b6f00 | 402 | ** End Of File |
igor_v | 0:8ad47e2b6f00 | 403 | ******************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 404 | |
igor_v | 0:8ad47e2b6f00 | 405 |