![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
Global.c@88:b5c1d9d338d1, 2016-03-24 (annotated)
- Committer:
- Kovalev_D
- Date:
- Thu Mar 24 10:15:56 2016 +0000
- Revision:
- 88:b5c1d9d338d1
- Parent:
- 87:7e575d26d6d0
- Child:
- 89:a0d344db227e
Event
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 0:8ad47e2b6f00 | 1 | #include "Global.h" |
igor_v | 0:8ad47e2b6f00 | 2 | |
igor_v | 0:8ad47e2b6f00 | 3 | |
igor_v | 0:8ad47e2b6f00 | 4 | |
igor_v | 21:bc8c1cec3da6 | 5 | unsigned int VibroReg = 0; //регистр состаяния вибропривода. |
Kovalev_D | 86:398da56ef751 | 6 | unsigned long Global_Time, Time_UART,Time_Sec,Time_vibro,Time_1kHz; |
igor_v | 0:8ad47e2b6f00 | 7 | unsigned long MaxAmp=0; |
igor_v | 0:8ad47e2b6f00 | 8 | unsigned char BuffTemp[100]; |
igor_v | 51:81f47b817071 | 9 | unsigned char Time[500]; |
Kovalev_D | 86:398da56ef751 | 10 | unsigned int Event1Hz; |
Kovalev_D | 88:b5c1d9d338d1 | 11 | unsigned int Event1K ; |
Kovalev_D | 88:b5c1d9d338d1 | 12 | unsigned int Event100K; |
Kovalev_D | 88:b5c1d9d338d1 | 13 | unsigned int EventVibro; |
Kovalev_D | 88:b5c1d9d338d1 | 14 | unsigned int Time1K; |
Kovalev_D | 88:b5c1d9d338d1 | 15 | unsigned int Time100K; |
Kovalev_D | 88:b5c1d9d338d1 | 16 | unsigned int Time1Hz; |
Kovalev_D | 88:b5c1d9d338d1 | 17 | unsigned int Clock1Hz; |
Kovalev_D | 86:398da56ef751 | 18 | unsigned int ShiftD; |
Kovalev_D | 86:398da56ef751 | 19 | unsigned int ShiftL; |
Kovalev_D | 86:398da56ef751 | 20 | |
Kovalev_D | 86:398da56ef751 | 21 | void GLD_Init(void) |
Kovalev_D | 86:398da56ef751 | 22 | { |
Kovalev_D | 86:398da56ef751 | 23 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 24 | ///////////обнуление счетчиков/////////////// |
Kovalev_D | 86:398da56ef751 | 25 | ///////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 26 | Global_Time = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 27 | Time_UART = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 28 | Time_Sec = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 29 | Time_vibro = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 30 | Time_1kHz = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 31 | Event1Hz = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 32 | Event1K = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 33 | Event100K = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 34 | EventVibro = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 35 | Time1K = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 36 | Time100K = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 37 | Time1Hz = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 38 | Clock1Hz = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 39 | ShiftD = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 40 | ShiftL = 0; |
Kovalev_D | 86:398da56ef751 | 41 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 42 | ///////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 43 | |
Kovalev_D | 88:b5c1d9d338d1 | 44 | |
Kovalev_D | 88:b5c1d9d338d1 | 45 | |
Kovalev_D | 88:b5c1d9d338d1 | 46 | |
Kovalev_D | 88:b5c1d9d338d1 | 47 | |
Kovalev_D | 88:b5c1d9d338d1 | 48 | |
Kovalev_D | 88:b5c1d9d338d1 | 49 | |
Kovalev_D | 88:b5c1d9d338d1 | 50 | |
Kovalev_D | 88:b5c1d9d338d1 | 51 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 52 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 53 | ///////////расчета значений буферов ВП/////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 54 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 55 | /////////////инициализация переменных в структ вибро///////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 56 | Gyro.FrqHZ=449; |
Kovalev_D | 88:b5c1d9d338d1 | 57 | Gyro.Frq = Gyro.FrqHZ<<16; |
Kovalev_D | 88:b5c1d9d338d1 | 58 | Gyro.AmpPer=20; |
Kovalev_D | 88:b5c1d9d338d1 | 59 | Gyro.AmpPerDel=10; |
Kovalev_D | 88:b5c1d9d338d1 | 60 | Gyro.Amp = 10*65535; |
Kovalev_D | 88:b5c1d9d338d1 | 61 | Gyro.AmpMin =10;// минимальное значение AmpT; |
Kovalev_D | 88:b5c1d9d338d1 | 62 | Gyro.AmpTD =30;// максимальное значение AmpT; (AmpT частота ошумления) |
Kovalev_D | 88:b5c1d9d338d1 | 63 | ////////////////////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 64 | CuruAngle = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 65 | Pulse_8Point = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 66 | Pulse_16Point = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 67 | Pulse_16PointD = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 68 | Pulse_32Point = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 69 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 70 | /////////////предварительное заполнение////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 71 | ////////////////буферов вибропривода///////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 72 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 73 | for (int i = 0; i < 32; i++ ) { |
Kovalev_D | 88:b5c1d9d338d1 | 74 | Buff_16Point[i] = 0x00; |
Kovalev_D | 88:b5c1d9d338d1 | 75 | Buff_8Point[i] = 0x00; |
Kovalev_D | 88:b5c1d9d338d1 | 76 | Buff_32Point[i] = 0x00; |
Kovalev_D | 88:b5c1d9d338d1 | 77 | Buff_16PointD[i] = 0x00; |
Kovalev_D | 88:b5c1d9d338d1 | 78 | } |
Kovalev_D | 88:b5c1d9d338d1 | 79 | //////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 80 | //////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 81 | |
Kovalev_D | 88:b5c1d9d338d1 | 82 | |
Kovalev_D | 88:b5c1d9d338d1 | 83 | |
Kovalev_D | 88:b5c1d9d338d1 | 84 | |
Kovalev_D | 88:b5c1d9d338d1 | 85 | |
Kovalev_D | 88:b5c1d9d338d1 | 86 | |
Kovalev_D | 88:b5c1d9d338d1 | 87 | |
Kovalev_D | 88:b5c1d9d338d1 | 88 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 89 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 90 | //////////////////переменных АЦП///////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 91 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 92 | Temp_AMP=0; |
Kovalev_D | 88:b5c1d9d338d1 | 93 | Temp_ADC_2=0; |
Kovalev_D | 88:b5c1d9d338d1 | 94 | Temp_ADC_3=0; |
Kovalev_D | 88:b5c1d9d338d1 | 95 | Temp_ADC_4=0; |
Kovalev_D | 88:b5c1d9d338d1 | 96 | Temp_ADC_5=0; |
Kovalev_D | 88:b5c1d9d338d1 | 97 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 98 | /////////////предварительное заполнение////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 99 | /////////////////////буферов АЦП///////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 100 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 101 | for (int i = 0; i < 16; i++ ) { |
Kovalev_D | 88:b5c1d9d338d1 | 102 | Buff_ADC_1[i] = 0; // ампл ацп. |
Kovalev_D | 88:b5c1d9d338d1 | 103 | Buff_ADC_2[i] = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 104 | Buff_ADC_3[i] = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 105 | Buff_ADC_4[i] = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 106 | Buff_ADC_5[i] = 0; |
Kovalev_D | 88:b5c1d9d338d1 | 107 | } |
Kovalev_D | 88:b5c1d9d338d1 | 108 | //////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 109 | //////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 110 | |
Kovalev_D | 88:b5c1d9d338d1 | 111 | |
Kovalev_D | 88:b5c1d9d338d1 | 112 | |
Kovalev_D | 88:b5c1d9d338d1 | 113 | |
Kovalev_D | 88:b5c1d9d338d1 | 114 | |
Kovalev_D | 88:b5c1d9d338d1 | 115 | /* |
Kovalev_D | 88:b5c1d9d338d1 | 116 | Gyro.SOC_Out=0xDD; |
Kovalev_D | 86:398da56ef751 | 117 | Gyro.Firmware_Version =0x15; //версия программы |
Kovalev_D | 86:398da56ef751 | 118 | Gyro.GLD_Serial = 0x20; //серийный номер |
Kovalev_D | 86:398da56ef751 | 119 | Gyro.My_Addres = 0; //адрес глд |
Kovalev_D | 86:398da56ef751 | 120 | Gyro.Discharg = StartDischarg; |
Kovalev_D | 86:398da56ef751 | 121 | Gyro.BackLight = StartBackLight; |
Kovalev_D | 88:b5c1d9d338d1 | 122 | */ |
Kovalev_D | 88:b5c1d9d338d1 | 123 | |
Kovalev_D | 88:b5c1d9d338d1 | 124 | |
Kovalev_D | 88:b5c1d9d338d1 | 125 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 126 | //////инициализация цап_LPC (р0.26 цап выход)//////// |
Kovalev_D | 88:b5c1d9d338d1 | 127 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 128 | LPC_PINCON->PINSEL1 = 0x00200000; |
Kovalev_D | 88:b5c1d9d338d1 | 129 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 130 | ////////////начальное значение для цап/////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 131 | //////////////////середина шкалы///////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 132 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 133 | Spi.DAC_A = 0x7fff; |
Kovalev_D | 86:398da56ef751 | 134 | Spi.DAC_B = 0x7fff; |
Kovalev_D | 86:398da56ef751 | 135 | //////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 136 | /////////////поправочный коэффициент///////////////// |
Kovalev_D | 86:398da56ef751 | 137 | /////////для цапов (граници +-12.5 вольт)//////////// |
Kovalev_D | 86:398da56ef751 | 138 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 139 | K_DAC=65535.0/(65535.0+(deltaDAC+deltaDAC/2)); |
Kovalev_D | 86:398da56ef751 | 140 | K_DAC=0.8; |
Kovalev_D | 88:b5c1d9d338d1 | 141 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 142 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 143 | |
igor_v | 16:18e3fd7b92d0 | 144 | |
igor_v | 16:18e3fd7b92d0 | 145 | |
Kovalev_D | 86:398da56ef751 | 146 | secPuls =0;// переменная для конопки поджига аск глд(временная) |
Kovalev_D | 88:b5c1d9d338d1 | 147 | |
Kovalev_D | 86:398da56ef751 | 148 | |
Kovalev_D | 86:398da56ef751 | 149 | ///////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 150 | /////////////обнуление переменых для///////////////// |
Kovalev_D | 86:398da56ef751 | 151 | ///////////////переменных энкодера/////////////////// |
Kovalev_D | 86:398da56ef751 | 152 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 153 | Cur_QEI=0; |
Kovalev_D | 86:398da56ef751 | 154 | Last_QEI=0; |
Kovalev_D | 86:398da56ef751 | 155 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 156 | /////////////инициализация энкодера////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 157 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 158 | LPC_SC->PCONP |= (1<<18);//0x00040000; включение квадратурного энкодера. |
Kovalev_D | 87:7e575d26d6d0 | 159 | LPC_SC->PCLKSEL1 |= 0x00000001; // выбор частоты для кв.э. CLK=100MHz |
Kovalev_D | 87:7e575d26d6d0 | 160 | LPC_PINCON->PINSEL3 &= ~0x4100; |
Kovalev_D | 87:7e575d26d6d0 | 161 | LPC_PINCON->PINSEL3 |= 0x4100; //P1.20, p1.23 установить как входы кв.э |
Kovalev_D | 87:7e575d26d6d0 | 162 | LPC_PINCON->PINMODE3 |= 0x3C300; //P1.20, p1.23, p1.24 ??are pulled-down??(притянуть к питанию)???? |
Kovalev_D | 86:398da56ef751 | 163 | |
Kovalev_D | 87:7e575d26d6d0 | 164 | LPC_QEI->MAXPOS = MAX_QEI_CNT; //LPC_QEI->"регистор максимального положения" = 2147483646 |
Kovalev_D | 87:7e575d26d6d0 | 165 | LPC_QEI->FILTER = 2; // фильтр( ?? ) |
Kovalev_D | 87:7e575d26d6d0 | 166 | LPC_QEI->CON = 0xF; //сбросить в ноль все счетчики кв.э. (скорость, направление, позицию и тд) |
Kovalev_D | 87:7e575d26d6d0 | 167 | LPC_QEI->CONF = (0<<2) |(0<<1); //Quadrature inputs, no inverting,only A pulses are counted |
Kovalev_D | 87:7e575d26d6d0 | 168 | |
Kovalev_D | 87:7e575d26d6d0 | 169 | LPC_QEI->CLR = 0x1fff; //r. сбросить все прерывания |
Kovalev_D | 87:7e575d26d6d0 | 170 | LPC_QEI->IEC = 0x1fff; //r. запретить прерывание при изменении направления |
Kovalev_D | 87:7e575d26d6d0 | 171 | |
Kovalev_D | 87:7e575d26d6d0 | 172 | NVIC_SetPriority(QEI_IRQn, 0); |
Kovalev_D | 87:7e575d26d6d0 | 173 | NVIC_EnableIRQ(QEI_IRQn); |
Kovalev_D | 88:b5c1d9d338d1 | 174 | ////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 175 | ////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 176 | |
Kovalev_D | 88:b5c1d9d338d1 | 177 | |
Kovalev_D | 88:b5c1d9d338d1 | 178 | |
Kovalev_D | 87:7e575d26d6d0 | 179 | |
Kovalev_D | 88:b5c1d9d338d1 | 180 | |
Kovalev_D | 88:b5c1d9d338d1 | 181 | |
Kovalev_D | 86:398da56ef751 | 182 | |
Kovalev_D | 88:b5c1d9d338d1 | 183 | |
Kovalev_D | 86:398da56ef751 | 184 | |
Kovalev_D | 88:b5c1d9d338d1 | 185 | |
Kovalev_D | 86:398da56ef751 | 186 | |
Kovalev_D | 86:398da56ef751 | 187 | |
Kovalev_D | 86:398da56ef751 | 188 | |
Kovalev_D | 86:398da56ef751 | 189 | |
Kovalev_D | 86:398da56ef751 | 190 | |
Kovalev_D | 86:398da56ef751 | 191 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 192 | /////////////////инициализация ног/////////////////// |
Kovalev_D | 86:398da56ef751 | 193 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 194 | Gyro.PinRegOld = 0xffffffff; |
Kovalev_D | 88:b5c1d9d338d1 | 195 | Gyro.PinReg = 0; // всЁ выключенно |
Kovalev_D | 88:b5c1d9d338d1 | 196 | PinCheng(); |
Kovalev_D | 86:398da56ef751 | 197 | |
Kovalev_D | 86:398da56ef751 | 198 | |
Kovalev_D | 87:7e575d26d6d0 | 199 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 200 | //////////////отладочный светодиод/////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 201 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 202 | LPC_PINCON->PINSEL0 = (0x00<<28); // а нужно, ведь по умолчаниб у них 0 функция. попробоввать без них потом убрать |
Kovalev_D | 87:7e575d26d6d0 | 203 | LPC_PINCON->PINMODE0 = (0x3<<28); |
Kovalev_D | 87:7e575d26d6d0 | 204 | LPC_GPIO1->FIODIR |= (1<<30); |
Kovalev_D | 87:7e575d26d6d0 | 205 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 206 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 207 | |
Kovalev_D | 88:b5c1d9d338d1 | 208 | |
Kovalev_D | 87:7e575d26d6d0 | 209 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 210 | ////////////////управление уартом//////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 211 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 212 | LPC_GPIO2->FIODIR |= (1<<7); |
Kovalev_D | 87:7e575d26d6d0 | 213 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 214 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 215 | |
Kovalev_D | 88:b5c1d9d338d1 | 216 | |
Kovalev_D | 88:b5c1d9d338d1 | 217 | |
Kovalev_D | 87:7e575d26d6d0 | 218 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 219 | ////////////////?????????????????//////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 220 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 221 | LPC_PINCON->PINSEL0 &= ~(3<<8); //e. P0.4 is GPIO pin (запись ( 00 ) в 9:8 бит PISEL0 выбор P0.4 как GPIO) |
Kovalev_D | 87:7e575d26d6d0 | 222 | LPC_PINCON->PINMODE0 |= (3<<8); //e. P0.4 is GPIO pin (запись ( 11 ) в 9:8 бит PINMODE0 "для включения подтягивающего резистора") |
Kovalev_D | 87:7e575d26d6d0 | 223 | LPC_GPIO0->FIODIR |= (1<<4); //e. P0.4 is output (запись ( 1 ) в 5 бит FIODIR выбор P0.4 как выход) |
Kovalev_D | 87:7e575d26d6d0 | 224 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 225 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 226 | |
Kovalev_D | 88:b5c1d9d338d1 | 227 | |
Kovalev_D | 88:b5c1d9d338d1 | 228 | |
Kovalev_D | 87:7e575d26d6d0 | 229 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 230 | /////////////////////вибро 1///////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 231 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 232 | LPC_PINCON->PINSEL3 = (0x00<<18); //e. P1.25 is GPIO pin |
Kovalev_D | 87:7e575d26d6d0 | 233 | LPC_PINCON->PINMODE3 |= (3<<18); //e. P1.25 (включениe подтягивающего резистора") |
Kovalev_D | 87:7e575d26d6d0 | 234 | LPC_GPIO1->FIODIR |= (1<<25); //e. P0.5 is output (запись ( 1 ) в 5 бит FIODIR выбор P0.5 как выход) |
Kovalev_D | 87:7e575d26d6d0 | 235 | LPC_GPIO1->FIOCLR |= (1<<25); |
Kovalev_D | 88:b5c1d9d338d1 | 236 | ////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 237 | /////////////////////вибро 2///////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 238 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 239 | LPC_PINCON->PINSEL3 = (0x00<<24); //e. P1.28 is GPIO pin |
Kovalev_D | 87:7e575d26d6d0 | 240 | LPC_PINCON->PINMODE3 |= (3<<24); //e. P1.28 is GPIO pin (запись ( 11 ) в бит PINMODE0 "для включения подтягивающего резистора") |
Kovalev_D | 87:7e575d26d6d0 | 241 | LPC_GPIO1->FIODIR |= (1<<28); //e. P1.28 is output (запись ( 1 ) в 5 бит FIODIR выбор P0.5 как выход) |
Kovalev_D | 87:7e575d26d6d0 | 242 | LPC_GPIO1->FIOCLR |= (1<<28); |
Kovalev_D | 87:7e575d26d6d0 | 243 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 244 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 245 | |
Kovalev_D | 88:b5c1d9d338d1 | 246 | |
Kovalev_D | 88:b5c1d9d338d1 | 247 | |
Kovalev_D | 87:7e575d26d6d0 | 248 | ///////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 249 | /////////////инициализация подсветки///////////////// |
Kovalev_D | 87:7e575d26d6d0 | 250 | ///////////////////////////////////////////////////// |
Kovalev_D | 87:7e575d26d6d0 | 251 | LPC_PINCON->PINSEL2 = (0x00<<24); //e. P2.12 is GPIO pin |
Kovalev_D | 87:7e575d26d6d0 | 252 | LPC_PINCON->PINMODE3 |= (3<<24); //e. P1.28 is GPIO pin (запись ( 11 ) в бит PINMODE0 "для включения подтягивающего резистора") |
Kovalev_D | 87:7e575d26d6d0 | 253 | LPC_GPIO2->FIODIR |= (1<<12); //e. P1.28 is output (запись ( 1 ) в 5 бит FIODIR выбор P0.5 как выход) |
Kovalev_D | 87:7e575d26d6d0 | 254 | LPC_GPIO2->FIOCLR |= (1<<12); |
Kovalev_D | 88:b5c1d9d338d1 | 255 | /////////////////////////////////////////////////////// |
Kovalev_D | 86:398da56ef751 | 256 | /////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 257 | |
Kovalev_D | 88:b5c1d9d338d1 | 258 | |
Kovalev_D | 88:b5c1d9d338d1 | 259 | |
Kovalev_D | 88:b5c1d9d338d1 | 260 | |
Kovalev_D | 88:b5c1d9d338d1 | 261 | |
Kovalev_D | 88:b5c1d9d338d1 | 262 | /////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 263 | /////////////////////////////////////////////////////// |
Kovalev_D | 88:b5c1d9d338d1 | 264 | ///инициализация таймеров/// |
Kovalev_D | 88:b5c1d9d338d1 | 265 | /// 9 и 100 кГц /// |
Kovalev_D | 88:b5c1d9d338d1 | 266 | //////////////////////////// |
Kovalev_D | 86:398da56ef751 | 267 | init_timer(TIME_INTERVAL ); //Timer 1: CCLK / 7812 = 12800.819Hz; Vibro: Timer1/32 = 400.025Hz; 10ms??? |
Kovalev_D | 86:398da56ef751 | 268 | enable_timer1(); |
Kovalev_D | 86:398da56ef751 | 269 | Init_TIM2(); //Timer 2: CCLK / 4 / 250 = 100kHz |
Kovalev_D | 86:398da56ef751 | 270 | enable_timer2(); |
Kovalev_D | 88:b5c1d9d338d1 | 271 | |
Kovalev_D | 87:7e575d26d6d0 | 272 | LPC_GPIO0->FIOCLR = (1<<5);/////////////?????????????????????????? |
Kovalev_D | 86:398da56ef751 | 273 | } |
igor_v | 13:e2a1d18677b8 | 274 | |
igor_v | 0:8ad47e2b6f00 | 275 | |
igor_v | 0:8ad47e2b6f00 | 276 | |
igor_v | 0:8ad47e2b6f00 | 277 | |
igor_v | 0:8ad47e2b6f00 | 278 |