![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
fork
Fork of LG by
uart_m.c@202:c03b7b128e11, 2016-11-18 (annotated)
- Committer:
- Kovalev_D
- Date:
- Fri Nov 18 06:07:37 2016 +0000
- Revision:
- 202:c03b7b128e11
- Parent:
- 193:a0fe8bfc97e4
not work
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
igor_v | 0:8ad47e2b6f00 | 1 | /****************************************Copyright (c)**************************************************** |
igor_v | 0:8ad47e2b6f00 | 2 | ** http://www.PowerAVR.com |
igor_v | 0:8ad47e2b6f00 | 3 | ** http://www.PowerMCU.com |
igor_v | 0:8ad47e2b6f00 | 4 | **--------------File Info--------------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 5 | ** File name: uart.c |
igor_v | 0:8ad47e2b6f00 | 6 | ** Last modified Date: 2010-05-12 |
igor_v | 0:8ad47e2b6f00 | 7 | ** Last Version: V1.00 |
igor_v | 0:8ad47e2b6f00 | 8 | ** Descriptions: |
igor_v | 0:8ad47e2b6f00 | 9 | ** |
igor_v | 0:8ad47e2b6f00 | 10 | **-------------------------------------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 11 | ** Created by: PowerAVR |
igor_v | 0:8ad47e2b6f00 | 12 | ** Created date: 2010-05-10 |
igor_v | 0:8ad47e2b6f00 | 13 | ** Version: V1.00 |
igor_v | 21:bc8c1cec3da6 | 14 | ** Descriptions: |
igor_v | 0:8ad47e2b6f00 | 15 | ** |
igor_v | 0:8ad47e2b6f00 | 16 | *-------------------------------------------------------------------------------------------------------- YJVTHF |
igor_v | 0:8ad47e2b6f00 | 17 | |
igor_v | 0:8ad47e2b6f00 | 18 | *********************************************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 19 | |
Kovalev_D | 47:d902ef6f7564 | 20 | /* LPC17xx definitions */ |
igor_v | 0:8ad47e2b6f00 | 21 | #include "uart_m.h" |
Kovalev_D | 47:d902ef6f7564 | 22 | #include "Global.h" |
Kovalev_D | 7:078abbed4565 | 23 | //555 |
igor_v | 0:8ad47e2b6f00 | 24 | |
igor_v | 0:8ad47e2b6f00 | 25 | //#define FPCLK (100000000) //� pll |
igor_v | 0:8ad47e2b6f00 | 26 | //#define FPCLK (12000000) //� pll |
igor_v | 0:8ad47e2b6f00 | 27 | #define FOSC 12000000 /* ������Ƶ�� */ |
igor_v | 0:8ad47e2b6f00 | 28 | #define FCCLK (FOSC * 8) /* ��ʱ��Ƶ��<=100Mhz */ |
igor_v | 0:8ad47e2b6f00 | 29 | /* FOSC�������� */ |
igor_v | 0:8ad47e2b6f00 | 30 | #define FCCO (FCCLK * 3) /* PLLƵ��(275Mhz~550Mhz) */ |
igor_v | 0:8ad47e2b6f00 | 31 | |
igor_v | 0:8ad47e2b6f00 | 32 | //#define FPCLK (FCCLK / 4) //� pll |
igor_v | 0:8ad47e2b6f00 | 33 | |
igor_v | 0:8ad47e2b6f00 | 34 | |
Kovalev_D | 117:eefe61968528 | 35 | //#define FPCLK (100000000 / 4) //� pll |
Kovalev_D | 124:9ae09249f842 | 36 | //#define FPCLK (100000000) //� pll |
Kovalev_D | 124:9ae09249f842 | 37 | #define FPCLK (103200000) |
igor_v | 0:8ad47e2b6f00 | 38 | //#define FPCLK (25000000) //� pll |
igor_v | 0:8ad47e2b6f00 | 39 | |
igor_v | 0:8ad47e2b6f00 | 40 | |
igor_v | 0:8ad47e2b6f00 | 41 | |
igor_v | 0:8ad47e2b6f00 | 42 | |
igor_v | 30:17c84ed091b3 | 43 | int UART0_BPS = 9600 ; /* ����0ͨ�Ų����� */ |
igor_v | 0:8ad47e2b6f00 | 44 | int UART1_BPS = 4800; /* ����0ͨ�Ų����� */ |
igor_v | 30:17c84ed091b3 | 45 | int UART2_BPS = 9600 ; /* ����0ͨ�Ų����� */ |
igor_v | 0:8ad47e2b6f00 | 46 | int UART3_BPS = 19200 ; /* ����0ͨ�Ų����� */ |
igor_v | 0:8ad47e2b6f00 | 47 | |
igor_v | 0:8ad47e2b6f00 | 48 | #define UART_LCR_ODD 0x0b |
igor_v | 0:8ad47e2b6f00 | 49 | #define UART_LCR_EVEN 0x1b |
igor_v | 0:8ad47e2b6f00 | 50 | |
igor_v | 91:a2bb81eaa183 | 51 | |
igor_v | 0:8ad47e2b6f00 | 52 | int UART_LCR = UART_LCR_EVEN ; |
igor_v | 0:8ad47e2b6f00 | 53 | |
igor_v | 91:a2bb81eaa183 | 54 | |
igor_v | 91:a2bb81eaa183 | 55 | |
igor_v | 91:a2bb81eaa183 | 56 | |
igor_v | 0:8ad47e2b6f00 | 57 | char InCon[1024]; |
igor_v | 0:8ad47e2b6f00 | 58 | char OutCon[1024]; |
igor_v | 0:8ad47e2b6f00 | 59 | |
igor_v | 0:8ad47e2b6f00 | 60 | unsigned int ConInPnt = 0; |
igor_v | 0:8ad47e2b6f00 | 61 | unsigned int ConInCur = 0; |
igor_v | 0:8ad47e2b6f00 | 62 | unsigned int ConOutPnt = 0; |
igor_v | 0:8ad47e2b6f00 | 63 | unsigned int ConOutCur = 0; |
igor_v | 0:8ad47e2b6f00 | 64 | |
igor_v | 0:8ad47e2b6f00 | 65 | |
igor_v | 0:8ad47e2b6f00 | 66 | char InCon1[1024]; |
igor_v | 0:8ad47e2b6f00 | 67 | char OutCon1[1024]; |
igor_v | 0:8ad47e2b6f00 | 68 | |
igor_v | 0:8ad47e2b6f00 | 69 | unsigned int ConInPnt1 = 0; |
igor_v | 0:8ad47e2b6f00 | 70 | unsigned int ConInCur1 = 0; |
igor_v | 0:8ad47e2b6f00 | 71 | unsigned int ConOutPnt1 = 0; |
igor_v | 0:8ad47e2b6f00 | 72 | unsigned int ConOutCur1 = 0; |
igor_v | 0:8ad47e2b6f00 | 73 | |
igor_v | 0:8ad47e2b6f00 | 74 | |
igor_v | 0:8ad47e2b6f00 | 75 | char InCon2[1024]; |
igor_v | 0:8ad47e2b6f00 | 76 | char OutCon2[1024]; |
igor_v | 0:8ad47e2b6f00 | 77 | |
igor_v | 0:8ad47e2b6f00 | 78 | unsigned int ConInPnt2 = 0; |
igor_v | 0:8ad47e2b6f00 | 79 | unsigned int ConInCur2 = 0; |
igor_v | 0:8ad47e2b6f00 | 80 | unsigned int ConOutPnt2 = 0; |
igor_v | 0:8ad47e2b6f00 | 81 | unsigned int ConOutCur2 = 0; |
igor_v | 0:8ad47e2b6f00 | 82 | |
igor_v | 0:8ad47e2b6f00 | 83 | char InCon3[1024]; |
igor_v | 0:8ad47e2b6f00 | 84 | char OutCon3[1024]; |
igor_v | 0:8ad47e2b6f00 | 85 | |
igor_v | 0:8ad47e2b6f00 | 86 | unsigned int ConInPnt3 = 0; |
igor_v | 0:8ad47e2b6f00 | 87 | unsigned int ConInCur3 = 0; |
igor_v | 0:8ad47e2b6f00 | 88 | unsigned int ConOutPnt3 = 0; |
igor_v | 0:8ad47e2b6f00 | 89 | unsigned int ConOutCur3 = 0; |
igor_v | 0:8ad47e2b6f00 | 90 | |
igor_v | 0:8ad47e2b6f00 | 91 | |
igor_v | 0:8ad47e2b6f00 | 92 | |
igor_v | 0:8ad47e2b6f00 | 93 | unsigned int InCon2M[16]; |
igor_v | 0:8ad47e2b6f00 | 94 | unsigned int OutCon2M[16]; |
igor_v | 0:8ad47e2b6f00 | 95 | |
igor_v | 0:8ad47e2b6f00 | 96 | unsigned int ConInPnt2M = 0; |
igor_v | 0:8ad47e2b6f00 | 97 | unsigned int ConInCur2M = 0; |
igor_v | 0:8ad47e2b6f00 | 98 | unsigned int ConOutPnt2M = 0; |
igor_v | 0:8ad47e2b6f00 | 99 | unsigned int ConOutCur2M = 0; |
igor_v | 0:8ad47e2b6f00 | 100 | |
igor_v | 0:8ad47e2b6f00 | 101 | unsigned int InCon3M[16]; |
igor_v | 0:8ad47e2b6f00 | 102 | unsigned int OutCon3M[16]; |
igor_v | 0:8ad47e2b6f00 | 103 | |
igor_v | 0:8ad47e2b6f00 | 104 | unsigned int ConInPnt3M = 0; |
igor_v | 0:8ad47e2b6f00 | 105 | unsigned int ConInCur3M = 0; |
igor_v | 0:8ad47e2b6f00 | 106 | unsigned int ConOutPnt3M = 0; |
igor_v | 0:8ad47e2b6f00 | 107 | unsigned int ConOutCur3M = 0; |
igor_v | 0:8ad47e2b6f00 | 108 | |
igor_v | 0:8ad47e2b6f00 | 109 | |
igor_v | 0:8ad47e2b6f00 | 110 | |
igor_v | 0:8ad47e2b6f00 | 111 | |
igor_v | 0:8ad47e2b6f00 | 112 | |
igor_v | 0:8ad47e2b6f00 | 113 | unsigned int OutBufConCount = 0; |
igor_v | 0:8ad47e2b6f00 | 114 | unsigned int OutBufCon1Count = 0; |
igor_v | 0:8ad47e2b6f00 | 115 | unsigned int OutBufCon2Count = 0; |
igor_v | 0:8ad47e2b6f00 | 116 | unsigned int OutBufCon3Count = 0; |
igor_v | 0:8ad47e2b6f00 | 117 | |
igor_v | 0:8ad47e2b6f00 | 118 | |
igor_v | 0:8ad47e2b6f00 | 119 | |
igor_v | 0:8ad47e2b6f00 | 120 | /********************************************************************************************************* |
igor_v | 0:8ad47e2b6f00 | 121 | ** Function name: UART0_Init |
igor_v | 0:8ad47e2b6f00 | 122 | ** Descriptions: ��Ĭ��ֵ��ʼ������0�����ź�ͨѶ����������Ϊ8λ����λ��1λֹͣλ������żУ�� |
igor_v | 0:8ad47e2b6f00 | 123 | ** input parameters: �� |
igor_v | 0:8ad47e2b6f00 | 124 | ** output parameters: �� |
igor_v | 0:8ad47e2b6f00 | 125 | ** Returned value: �� |
igor_v | 0:8ad47e2b6f00 | 126 | *********************************************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 127 | void UART0_Init (void) |
igor_v | 0:8ad47e2b6f00 | 128 | { |
igor_v | 0:8ad47e2b6f00 | 129 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 130 | LPC_PINCON->PINSEL0 |= (1 << 4); /* Pin P0.2 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 131 | LPC_PINCON->PINSEL0 |= (1 << 6); /* Pin P0.3 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 132 | LPC_UART0->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 133 | |
igor_v | 0:8ad47e2b6f00 | 134 | // LPC_UART0->FDR = 0x00000085; // c�� ��� LPC17xx-User-Manual_0[1].05 �� ��� 311 |
igor_v | 0:8ad47e2b6f00 | 135 | //���������� �� 8 �������� �� 5 |
igor_v | 0:8ad47e2b6f00 | 136 | // usFdiv = 4; |
igor_v | 30:17c84ed091b3 | 137 | |
igor_v | 0:8ad47e2b6f00 | 138 | usFdiv = (FPCLK / 16) / UART0_BPS; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 139 | LPC_UART0->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 140 | LPC_UART0->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 141 | LPC_UART0->LCR = 0x03; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 142 | LPC_UART0->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 143 | } |
igor_v | 0:8ad47e2b6f00 | 144 | void UART1_Init_temp (void) |
igor_v | 0:8ad47e2b6f00 | 145 | { |
igor_v | 0:8ad47e2b6f00 | 146 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 147 | LPC_PINCON->PINSEL4 |= (2 << 0); /* Pin P2.0 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 148 | LPC_PINCON->PINSEL4 |= (2 << 2); /* Pin P2.1 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 149 | LPC_UART1->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 150 | usFdiv = (FPCLK / 16) / UART1_BPS; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 151 | LPC_UART1->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 152 | LPC_UART1->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 153 | LPC_UART1->LCR = 0x03; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 154 | LPC_UART1->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 155 | } |
igor_v | 0:8ad47e2b6f00 | 156 | |
igor_v | 0:8ad47e2b6f00 | 157 | void UART2_Init (void) |
igor_v | 0:8ad47e2b6f00 | 158 | { |
igor_v | 0:8ad47e2b6f00 | 159 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 160 | LPC_PINCON->PINSEL0 |= (1 << 20); /* Pin P0.10 used as TXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 161 | LPC_PINCON->PINSEL0 |= (1 << 22); /* Pin P0.11 used as RXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 162 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<24); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 163 | |
igor_v | 0:8ad47e2b6f00 | 164 | LPC_UART2->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 165 | usFdiv = (FPCLK / 16) / 9600; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 166 | LPC_UART2->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 167 | LPC_UART2->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 168 | LPC_UART2->LCR = 0x03; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 169 | LPC_UART2->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 170 | } |
igor_v | 0:8ad47e2b6f00 | 171 | |
igor_v | 0:8ad47e2b6f00 | 172 | |
igor_v | 0:8ad47e2b6f00 | 173 | void UART3_Init (void) |
igor_v | 0:8ad47e2b6f00 | 174 | { |
igor_v | 0:8ad47e2b6f00 | 175 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 176 | /* UART0 */ |
igor_v | 0:8ad47e2b6f00 | 177 | LPC_PINCON->PINSEL1 |= (3 << 18); /* Pin P0.25 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 178 | LPC_PINCON->PINSEL1 |= (3 << 20); /* Pin P0.26 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 179 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<25); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 180 | |
igor_v | 0:8ad47e2b6f00 | 181 | LPC_UART3->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 182 | usFdiv = (FPCLK / 16) / UART3_BPS; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 183 | LPC_UART3->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 184 | LPC_UART3->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 185 | LPC_UART3->LCR = UART_LCR; |
igor_v | 0:8ad47e2b6f00 | 186 | LPC_UART3->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 187 | } |
igor_v | 0:8ad47e2b6f00 | 188 | |
igor_v | 0:8ad47e2b6f00 | 189 | void UART2_InitSet (unsigned int speed, unsigned int SetLsr) |
igor_v | 0:8ad47e2b6f00 | 190 | { |
igor_v | 0:8ad47e2b6f00 | 191 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 192 | |
igor_v | 0:8ad47e2b6f00 | 193 | LPC_PINCON->PINSEL0 |= (1 << 20); /* Pin P0.10 used as TXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 194 | LPC_PINCON->PINSEL0 |= (1 << 22); /* Pin P0.11 used as RXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 195 | |
igor_v | 0:8ad47e2b6f00 | 196 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<24); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 197 | |
igor_v | 0:8ad47e2b6f00 | 198 | LPC_UART2->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 199 | usFdiv = (FPCLK / 16) / speed; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 200 | LPC_UART2->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 201 | LPC_UART2->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 202 | LPC_UART2->LCR = SetLsr; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 203 | LPC_UART2->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 204 | |
igor_v | 0:8ad47e2b6f00 | 205 | } |
igor_v | 0:8ad47e2b6f00 | 206 | |
igor_v | 0:8ad47e2b6f00 | 207 | |
igor_v | 0:8ad47e2b6f00 | 208 | void UART3_InitSet (unsigned int speed, unsigned int SetLsr) |
igor_v | 0:8ad47e2b6f00 | 209 | { |
igor_v | 0:8ad47e2b6f00 | 210 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 211 | /* UART0 */ |
igor_v | 0:8ad47e2b6f00 | 212 | LPC_PINCON->PINSEL1 |= (3 << 18); /* Pin P0.25 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 213 | LPC_PINCON->PINSEL1 |= (3 << 20); /* Pin P0.26 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 214 | |
igor_v | 0:8ad47e2b6f00 | 215 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<25); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 216 | LPC_UART3->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 217 | usFdiv = (FPCLK / 16) / speed; /* ������ */ |
igor_v | 0:8ad47e2b6f00 | 218 | LPC_UART3->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 219 | LPC_UART3->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 220 | LPC_UART3->LCR = SetLsr; |
Kovalev_D | 124:9ae09249f842 | 221 | LPC_UART3->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 222 | } |
igor_v | 0:8ad47e2b6f00 | 223 | |
igor_v | 91:a2bb81eaa183 | 224 | |
igor_v | 91:a2bb81eaa183 | 225 | |
igor_v | 91:a2bb81eaa183 | 226 | |
igor_v | 0:8ad47e2b6f00 | 227 | void UART_InitSet (unsigned int Num,unsigned int Speed, unsigned int SetLsr) |
igor_v | 0:8ad47e2b6f00 | 228 | { |
igor_v | 0:8ad47e2b6f00 | 229 | uint16_t usFdiv; |
igor_v | 0:8ad47e2b6f00 | 230 | |
Kovalev_D | 92:c892f0311aa7 | 231 | usFdiv = ((FPCLK / 16) / Speed) +1; |
Kovalev_D | 92:c892f0311aa7 | 232 | //usFdiv = ((FPCLK / 4) / Speed) + 1 ; |
igor_v | 0:8ad47e2b6f00 | 233 | |
Kovalev_D | 92:c892f0311aa7 | 234 | if (Num == 0) |
igor_v | 0:8ad47e2b6f00 | 235 | { |
igor_v | 0:8ad47e2b6f00 | 236 | LPC_PINCON->PINSEL0 |= (1 << 4); /* Pin P0.2 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 237 | LPC_PINCON->PINSEL0 |= (1 << 6); /* Pin P0.3 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 238 | LPC_UART0->LCR = 0x83; /* ���������� */ |
igor_v | 91:a2bb81eaa183 | 239 | // LPC_UART0->FDR = 0x00000085; // c�� ��� LPC17xx-User-Manual_0[1].05 �� ��� 311 |
igor_v | 91:a2bb81eaa183 | 240 | //���������� �� 8 �������� �� 5 |
igor_v | 0:8ad47e2b6f00 | 241 | // usFdiv = 4; |
igor_v | 0:8ad47e2b6f00 | 242 | LPC_UART0->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 243 | LPC_UART0->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 244 | LPC_UART0->LCR = SetLsr; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 245 | LPC_UART0->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 246 | } |
igor_v | 0:8ad47e2b6f00 | 247 | if (Num == 1) |
igor_v | 0:8ad47e2b6f00 | 248 | { |
igor_v | 0:8ad47e2b6f00 | 249 | LPC_PINCON->PINSEL4 |= (2 << 0); /* Pin P2.0 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 250 | LPC_PINCON->PINSEL4 |= (2 << 2); /* Pin P2.1 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 251 | |
igor_v | 0:8ad47e2b6f00 | 252 | LPC_UART1->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 253 | LPC_UART1->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 254 | LPC_UART1->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 255 | LPC_UART1->LCR = SetLsr; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 256 | LPC_UART1->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 257 | } |
igor_v | 0:8ad47e2b6f00 | 258 | if (Num == 2) |
igor_v | 0:8ad47e2b6f00 | 259 | { |
igor_v | 0:8ad47e2b6f00 | 260 | LPC_PINCON->PINSEL0 |= (1 << 20); /* Pin P0.10 used as TXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 261 | LPC_PINCON->PINSEL0 |= (1 << 22); /* Pin P0.11 used as RXD2 (Com2) */ |
igor_v | 0:8ad47e2b6f00 | 262 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<24); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 263 | LPC_UART2->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 264 | LPC_UART2->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 265 | LPC_UART2->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 266 | LPC_UART2->LCR = SetLsr; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 267 | LPC_UART2->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 268 | } |
igor_v | 0:8ad47e2b6f00 | 269 | if (Num == 3) |
igor_v | 0:8ad47e2b6f00 | 270 | { |
igor_v | 0:8ad47e2b6f00 | 271 | LPC_PINCON->PINSEL1 |= (3 << 18); /* Pin P0.25 used as TXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 272 | LPC_PINCON->PINSEL1 |= (3 << 20); /* Pin P0.26 used as RXD0 (Com0) */ |
igor_v | 0:8ad47e2b6f00 | 273 | LPC_SC->PCONP = LPC_SC->PCONP|(1<<25); /*����UART2��Դ����λ */ |
igor_v | 0:8ad47e2b6f00 | 274 | LPC_UART3->LCR = 0x83; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 275 | LPC_UART3->DLM = usFdiv / 256; |
igor_v | 0:8ad47e2b6f00 | 276 | LPC_UART3->DLL = usFdiv % 256; |
igor_v | 0:8ad47e2b6f00 | 277 | LPC_UART3->LCR = SetLsr; /* ���������� */ |
igor_v | 0:8ad47e2b6f00 | 278 | LPC_UART3->FCR = 0x07; |
igor_v | 0:8ad47e2b6f00 | 279 | } |
igor_v | 0:8ad47e2b6f00 | 280 | } |
igor_v | 0:8ad47e2b6f00 | 281 | |
igor_v | 0:8ad47e2b6f00 | 282 | |
igor_v | 0:8ad47e2b6f00 | 283 | |
igor_v | 0:8ad47e2b6f00 | 284 | |
igor_v | 0:8ad47e2b6f00 | 285 | |
igor_v | 0:8ad47e2b6f00 | 286 | |
igor_v | 0:8ad47e2b6f00 | 287 | |
igor_v | 91:a2bb81eaa183 | 288 | |
igor_v | 91:a2bb81eaa183 | 289 | |
igor_v | 91:a2bb81eaa183 | 290 | |
igor_v | 0:8ad47e2b6f00 | 291 | |
igor_v | 0:8ad47e2b6f00 | 292 | |
igor_v | 0:8ad47e2b6f00 | 293 | |
igor_v | 0:8ad47e2b6f00 | 294 | |
igor_v | 0:8ad47e2b6f00 | 295 | |
igor_v | 0:8ad47e2b6f00 | 296 | |
igor_v | 0:8ad47e2b6f00 | 297 | |
igor_v | 0:8ad47e2b6f00 | 298 | |
igor_v | 0:8ad47e2b6f00 | 299 | |
igor_v | 0:8ad47e2b6f00 | 300 | |
igor_v | 0:8ad47e2b6f00 | 301 | |
igor_v | 0:8ad47e2b6f00 | 302 | |
igor_v | 0:8ad47e2b6f00 | 303 | |
igor_v | 0:8ad47e2b6f00 | 304 | |
igor_v | 0:8ad47e2b6f00 | 305 | |
igor_v | 0:8ad47e2b6f00 | 306 | |
igor_v | 0:8ad47e2b6f00 | 307 | |
igor_v | 0:8ad47e2b6f00 | 308 | /********************************************************************************************************* |
igor_v | 0:8ad47e2b6f00 | 309 | ** Function name: UART0_SendByte |
igor_v | 0:8ad47e2b6f00 | 310 | ** Descriptions: �Ӵ���0�������� |
igor_v | 0:8ad47e2b6f00 | 311 | ** input parameters: data: ���͵����� |
igor_v | 0:8ad47e2b6f00 | 312 | ** output parameters: �� |
igor_v | 0:8ad47e2b6f00 | 313 | ** Returned value: �� |
igor_v | 0:8ad47e2b6f00 | 314 | *********************************************************************************************************/ |
igor_v | 0:8ad47e2b6f00 | 315 | int UART0_SendByte (int ucData) |
igor_v | 0:8ad47e2b6f00 | 316 | { |
igor_v | 0:8ad47e2b6f00 | 317 | while (!(LPC_UART0->LSR & 0x20)); |
igor_v | 0:8ad47e2b6f00 | 318 | return (LPC_UART0->THR = ucData); |
igor_v | 0:8ad47e2b6f00 | 319 | |
igor_v | 0:8ad47e2b6f00 | 320 | } |
igor_v | 0:8ad47e2b6f00 | 321 | |
igor_v | 0:8ad47e2b6f00 | 322 | |
igor_v | 0:8ad47e2b6f00 | 323 | |
igor_v | 0:8ad47e2b6f00 | 324 | |
igor_v | 0:8ad47e2b6f00 | 325 | |
igor_v | 0:8ad47e2b6f00 | 326 | |
igor_v | 0:8ad47e2b6f00 | 327 | /*---------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 328 | Read character from Serial Port (blocking read) |
igor_v | 0:8ad47e2b6f00 | 329 | *----------------------------------------------------------------------------*/ |
igor_v | 0:8ad47e2b6f00 | 330 | int UART0_GetChar (void) |
igor_v | 0:8ad47e2b6f00 | 331 | { |
igor_v | 0:8ad47e2b6f00 | 332 | while (!(LPC_UART0->LSR & 0x01)); |
igor_v | 0:8ad47e2b6f00 | 333 | return (LPC_UART0->RBR); |
igor_v | 0:8ad47e2b6f00 | 334 | } |
igor_v | 0:8ad47e2b6f00 | 335 | /*---------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 336 | Read character from Serial Port (blocking read) |
igor_v | 0:8ad47e2b6f00 | 337 | *----------------------------------------------------------------------------*/ |
igor_v | 0:8ad47e2b6f00 | 338 | int UART1_GetChar (void) |
igor_v | 0:8ad47e2b6f00 | 339 | { |
igor_v | 0:8ad47e2b6f00 | 340 | while (!(LPC_UART1->LSR & 0x01)); |
igor_v | 0:8ad47e2b6f00 | 341 | return (LPC_UART1->RBR); |
igor_v | 0:8ad47e2b6f00 | 342 | } |
igor_v | 0:8ad47e2b6f00 | 343 | |
igor_v | 0:8ad47e2b6f00 | 344 | /*---------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 345 | Read character from Serial Port (blocking read) |
igor_v | 0:8ad47e2b6f00 | 346 | *----------------------------------------------------------------------------*/ |
igor_v | 0:8ad47e2b6f00 | 347 | int UART2_GetChar (void) |
igor_v | 0:8ad47e2b6f00 | 348 | { |
igor_v | 0:8ad47e2b6f00 | 349 | while (!(LPC_UART2->LSR & 0x01)); |
igor_v | 0:8ad47e2b6f00 | 350 | return (LPC_UART2->RBR); |
igor_v | 0:8ad47e2b6f00 | 351 | } |
igor_v | 0:8ad47e2b6f00 | 352 | /*---------------------------------------------------------------------------- |
igor_v | 0:8ad47e2b6f00 | 353 | Read character from Serial Port (blocking read) |
igor_v | 0:8ad47e2b6f00 | 354 | *----------------------------------------------------------------------------*/ |
igor_v | 0:8ad47e2b6f00 | 355 | int UART3_GetChar (void) |
igor_v | 0:8ad47e2b6f00 | 356 | { |
igor_v | 0:8ad47e2b6f00 | 357 | while (!(LPC_UART3->LSR & 0x01)); |
igor_v | 0:8ad47e2b6f00 | 358 | return (LPC_UART3->RBR); |
igor_v | 0:8ad47e2b6f00 | 359 | } |
igor_v | 0:8ad47e2b6f00 | 360 | |
igor_v | 0:8ad47e2b6f00 | 361 | int UART0_Chek (void) |
igor_v | 0:8ad47e2b6f00 | 362 | { |
igor_v | 0:8ad47e2b6f00 | 363 | if (LPC_UART0->LSR & 0x01) return 1; else return 0; |
igor_v | 0:8ad47e2b6f00 | 364 | } |
igor_v | 0:8ad47e2b6f00 | 365 | |
igor_v | 0:8ad47e2b6f00 | 366 | int UART1_Chek (void) |
igor_v | 0:8ad47e2b6f00 | 367 | { |
igor_v | 0:8ad47e2b6f00 | 368 | if (LPC_UART1->LSR & 0x01)return 1; else return 0; |
igor_v | 0:8ad47e2b6f00 | 369 | } |
igor_v | 0:8ad47e2b6f00 | 370 | |
igor_v | 0:8ad47e2b6f00 | 371 | |
igor_v | 0:8ad47e2b6f00 | 372 | int UART2_Chek (void) |
igor_v | 0:8ad47e2b6f00 | 373 | { |
igor_v | 0:8ad47e2b6f00 | 374 | |
igor_v | 0:8ad47e2b6f00 | 375 | if (LPC_UART2->LSR & 0x01)return 1; else return 0; |
igor_v | 0:8ad47e2b6f00 | 376 | } |
igor_v | 0:8ad47e2b6f00 | 377 | |
igor_v | 0:8ad47e2b6f00 | 378 | int UART3_Chek (void) |
igor_v | 0:8ad47e2b6f00 | 379 | { |
igor_v | 0:8ad47e2b6f00 | 380 | if (LPC_UART3->LSR & 0x01)return 1; else return 0; |
igor_v | 0:8ad47e2b6f00 | 381 | |
igor_v | 0:8ad47e2b6f00 | 382 | } |
igor_v | 0:8ad47e2b6f00 | 383 | |
igor_v | 0:8ad47e2b6f00 | 384 | |
igor_v | 0:8ad47e2b6f00 | 385 | |
igor_v | 0:8ad47e2b6f00 | 386 | |
igor_v | 0:8ad47e2b6f00 | 387 | |
igor_v | 0:8ad47e2b6f00 | 388 | |
igor_v | 0:8ad47e2b6f00 | 389 | void UART0_SendString (char *s) |
igor_v | 0:8ad47e2b6f00 | 390 | { |
igor_v | 0:8ad47e2b6f00 | 391 | while (*s != 0) |
igor_v | 0:8ad47e2b6f00 | 392 | { |
igor_v | 0:8ad47e2b6f00 | 393 | UART0_SendByte(*s++); |
igor_v | 0:8ad47e2b6f00 | 394 | } |
igor_v | 0:8ad47e2b6f00 | 395 | } |
igor_v | 0:8ad47e2b6f00 | 396 | |
igor_v | 0:8ad47e2b6f00 | 397 | |
igor_v | 0:8ad47e2b6f00 | 398 | |
igor_v | 0:8ad47e2b6f00 | 399 | |
igor_v | 0:8ad47e2b6f00 | 400 | |
igor_v | 0:8ad47e2b6f00 | 401 | int UART2_SendByte (int ucData) |
igor_v | 0:8ad47e2b6f00 | 402 | { |
igor_v | 0:8ad47e2b6f00 | 403 | while (!(LPC_UART2->LSR & 0x20)); |
igor_v | 0:8ad47e2b6f00 | 404 | return (LPC_UART2->THR = ucData); |
igor_v | 0:8ad47e2b6f00 | 405 | } |
igor_v | 0:8ad47e2b6f00 | 406 | |
igor_v | 0:8ad47e2b6f00 | 407 | |
igor_v | 0:8ad47e2b6f00 | 408 | |
igor_v | 0:8ad47e2b6f00 | 409 | void UART0_SendChar(uint16_t disp) |
igor_v | 0:8ad47e2b6f00 | 410 | { |
igor_v | 0:8ad47e2b6f00 | 411 | uint16_t dispbuf[4]; |
igor_v | 0:8ad47e2b6f00 | 412 | uint8_t i; |
igor_v | 0:8ad47e2b6f00 | 413 | |
igor_v | 0:8ad47e2b6f00 | 414 | dispbuf[3] = disp%10 + '0'; |
igor_v | 0:8ad47e2b6f00 | 415 | dispbuf[2] = disp/10%10 + '0'; |
igor_v | 0:8ad47e2b6f00 | 416 | dispbuf[1] = disp/10/10%10 + '0'; |
igor_v | 0:8ad47e2b6f00 | 417 | dispbuf[0] = disp/10/10/10%10 + '0'; |
igor_v | 0:8ad47e2b6f00 | 418 | for(i=0;i<4;i++) |
igor_v | 0:8ad47e2b6f00 | 419 | UART0_SendByte(dispbuf[i]); |
igor_v | 0:8ad47e2b6f00 | 420 | } |
igor_v | 0:8ad47e2b6f00 | 421 | |
igor_v | 0:8ad47e2b6f00 | 422 | |
igor_v | 0:8ad47e2b6f00 | 423 | |
igor_v | 0:8ad47e2b6f00 | 424 | void Concol (void ) |
igor_v | 0:8ad47e2b6f00 | 425 | { |
igor_v | 0:8ad47e2b6f00 | 426 | if (OutBufConCount == 0) |
igor_v | 0:8ad47e2b6f00 | 427 | { |
igor_v | 0:8ad47e2b6f00 | 428 | |
igor_v | 0:8ad47e2b6f00 | 429 | if (ConOutPnt != ConOutCur) |
igor_v | 0:8ad47e2b6f00 | 430 | if (LPC_UART0->LSR & 0x20) |
igor_v | 0:8ad47e2b6f00 | 431 | { |
igor_v | 0:8ad47e2b6f00 | 432 | ConOutCur++; |
igor_v | 0:8ad47e2b6f00 | 433 | ConOutCur = ConOutCur & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 434 | SetDeUART0 (); |
igor_v | 0:8ad47e2b6f00 | 435 | LPC_UART0->THR = OutCon[ConOutCur]; |
igor_v | 0:8ad47e2b6f00 | 436 | } |
igor_v | 0:8ad47e2b6f00 | 437 | } |
igor_v | 0:8ad47e2b6f00 | 438 | if (LPC_UART0->LSR & 0x01) |
igor_v | 0:8ad47e2b6f00 | 439 | { |
igor_v | 0:8ad47e2b6f00 | 440 | ConInCur++; |
igor_v | 0:8ad47e2b6f00 | 441 | ConInCur = ConInCur & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 442 | InCon[ConInCur] = (LPC_UART0->RBR); |
igor_v | 0:8ad47e2b6f00 | 443 | } |
igor_v | 0:8ad47e2b6f00 | 444 | |
igor_v | 0:8ad47e2b6f00 | 445 | if (!(LPC_UART0->LSR & 0x40)) SetDeUART0 (); else ClrDeUART0() ; //���������� 485 |
igor_v | 0:8ad47e2b6f00 | 446 | |
igor_v | 0:8ad47e2b6f00 | 447 | } |
igor_v | 0:8ad47e2b6f00 | 448 | |
igor_v | 0:8ad47e2b6f00 | 449 | |
igor_v | 0:8ad47e2b6f00 | 450 | void Concol1 (void ) |
igor_v | 0:8ad47e2b6f00 | 451 | { |
Kovalev_D | 181:0b022246c43c | 452 | //if (OutBufCon1Count == 0) |
Kovalev_D | 181:0b022246c43c | 453 | if (Time_UART == 0) |
Kovalev_D | 193:a0fe8bfc97e4 | 454 | { |
igor_v | 0:8ad47e2b6f00 | 455 | if (ConOutPnt1 != ConOutCur1) |
igor_v | 0:8ad47e2b6f00 | 456 | if (LPC_UART1->LSR & 0x20) |
igor_v | 0:8ad47e2b6f00 | 457 | { |
igor_v | 0:8ad47e2b6f00 | 458 | ConOutCur1++; |
igor_v | 0:8ad47e2b6f00 | 459 | ConOutCur1 = ConOutCur1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 460 | LPC_UART1->THR = OutCon1[ConOutCur1]; |
igor_v | 0:8ad47e2b6f00 | 461 | } |
Kovalev_D | 47:d902ef6f7564 | 462 | if (!(LPC_UART1->LSR & 0x40)) Gyro.PinReg |= PinRegBitTXE; else Gyro.PinReg &= ~PinRegBitTXE; |
igor_v | 0:8ad47e2b6f00 | 463 | } |
Kovalev_D | 193:a0fe8bfc97e4 | 464 | else if (OutBufCon1Count == 0) |
Kovalev_D | 47:d902ef6f7564 | 465 | { |
Kovalev_D | 193:a0fe8bfc97e4 | 466 | |
Kovalev_D | 47:d902ef6f7564 | 467 | Gyro.PinReg |= PinRegBitTXE; |
Kovalev_D | 47:d902ef6f7564 | 468 | } |
Kovalev_D | 193:a0fe8bfc97e4 | 469 | |
igor_v | 0:8ad47e2b6f00 | 470 | if (LPC_UART1->LSR & 0x01) |
Kovalev_D | 202:c03b7b128e11 | 471 | { |
igor_v | 0:8ad47e2b6f00 | 472 | ConInCur1++; |
igor_v | 0:8ad47e2b6f00 | 473 | ConInCur1 = ConInCur1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 474 | InCon1[ConInCur1] = (LPC_UART1->RBR); |
igor_v | 0:8ad47e2b6f00 | 475 | } |
igor_v | 0:8ad47e2b6f00 | 476 | } |
igor_v | 0:8ad47e2b6f00 | 477 | |
igor_v | 0:8ad47e2b6f00 | 478 | void Concol1Fast (void ) |
igor_v | 0:8ad47e2b6f00 | 479 | { |
igor_v | 0:8ad47e2b6f00 | 480 | if (OutBufCon1Count == 0) |
igor_v | 0:8ad47e2b6f00 | 481 | { |
igor_v | 0:8ad47e2b6f00 | 482 | while((ConOutPnt1 != ConOutCur1) && (LPC_UART1->LSR & 0x20)) |
igor_v | 0:8ad47e2b6f00 | 483 | { |
igor_v | 0:8ad47e2b6f00 | 484 | ConOutCur1++; |
igor_v | 0:8ad47e2b6f00 | 485 | ConOutCur1 = ConOutCur1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 486 | SetDeUART1 (); |
igor_v | 0:8ad47e2b6f00 | 487 | LPC_UART1->THR = OutCon1[ConOutCur1]; |
igor_v | 0:8ad47e2b6f00 | 488 | } |
igor_v | 0:8ad47e2b6f00 | 489 | } |
igor_v | 0:8ad47e2b6f00 | 490 | while (LPC_UART1->LSR & 0x01) |
igor_v | 0:8ad47e2b6f00 | 491 | { |
igor_v | 0:8ad47e2b6f00 | 492 | ConInCur1++; |
igor_v | 0:8ad47e2b6f00 | 493 | ConInCur1 = ConInCur1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 494 | InCon1[ConInCur1] = (LPC_UART1->RBR); |
igor_v | 0:8ad47e2b6f00 | 495 | } |
igor_v | 0:8ad47e2b6f00 | 496 | if (!(LPC_UART1->LSR & 0x40)) SetDeUART1 (); else ClrDeUART1() ; //���������� 485 |
igor_v | 0:8ad47e2b6f00 | 497 | } |
igor_v | 0:8ad47e2b6f00 | 498 | |
igor_v | 0:8ad47e2b6f00 | 499 | |
igor_v | 0:8ad47e2b6f00 | 500 | |
igor_v | 0:8ad47e2b6f00 | 501 | |
igor_v | 0:8ad47e2b6f00 | 502 | void Concol2 (void ) |
igor_v | 0:8ad47e2b6f00 | 503 | { |
igor_v | 0:8ad47e2b6f00 | 504 | if (OutBufCon2Count == 0) |
igor_v | 0:8ad47e2b6f00 | 505 | { |
igor_v | 0:8ad47e2b6f00 | 506 | if (ConOutPnt2 != ConOutCur2) |
igor_v | 0:8ad47e2b6f00 | 507 | if (LPC_UART2->LSR & 0x20) |
igor_v | 0:8ad47e2b6f00 | 508 | { |
igor_v | 0:8ad47e2b6f00 | 509 | ConOutCur2++; |
igor_v | 0:8ad47e2b6f00 | 510 | ConOutCur2 = ConOutCur2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 511 | SetDeUART2 (); |
igor_v | 0:8ad47e2b6f00 | 512 | LPC_UART2->THR = OutCon2[ConOutCur2]; |
igor_v | 0:8ad47e2b6f00 | 513 | } |
igor_v | 0:8ad47e2b6f00 | 514 | } |
igor_v | 0:8ad47e2b6f00 | 515 | if (LPC_UART2->LSR & 0x01) |
igor_v | 0:8ad47e2b6f00 | 516 | { |
igor_v | 0:8ad47e2b6f00 | 517 | ConInCur2++; |
igor_v | 0:8ad47e2b6f00 | 518 | ConInCur2 = ConInCur2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 519 | InCon2[ConInCur2] = (LPC_UART2->RBR); |
igor_v | 0:8ad47e2b6f00 | 520 | } |
igor_v | 0:8ad47e2b6f00 | 521 | if (!(LPC_UART2->LSR & 0x40)) SetDeUART2 (); else ClrDeUART2() ; //���������� 485 |
igor_v | 0:8ad47e2b6f00 | 522 | } |
igor_v | 0:8ad47e2b6f00 | 523 | |
igor_v | 0:8ad47e2b6f00 | 524 | |
igor_v | 0:8ad47e2b6f00 | 525 | |
igor_v | 0:8ad47e2b6f00 | 526 | |
igor_v | 0:8ad47e2b6f00 | 527 | |
igor_v | 0:8ad47e2b6f00 | 528 | void Concol3 (void ) |
igor_v | 0:8ad47e2b6f00 | 529 | { |
igor_v | 0:8ad47e2b6f00 | 530 | if (OutBufCon3Count == 0) |
igor_v | 0:8ad47e2b6f00 | 531 | { |
igor_v | 0:8ad47e2b6f00 | 532 | if (ConOutPnt3 != ConOutCur3) |
igor_v | 0:8ad47e2b6f00 | 533 | if (LPC_UART3->LSR & 0x20) |
igor_v | 0:8ad47e2b6f00 | 534 | { |
igor_v | 0:8ad47e2b6f00 | 535 | ConOutCur3++; |
igor_v | 0:8ad47e2b6f00 | 536 | ConOutCur3 = ConOutCur3 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 537 | SetDeUART3 (); |
igor_v | 0:8ad47e2b6f00 | 538 | LPC_UART3->THR = OutCon3[ConOutCur3]; |
igor_v | 0:8ad47e2b6f00 | 539 | } |
igor_v | 0:8ad47e2b6f00 | 540 | } |
igor_v | 0:8ad47e2b6f00 | 541 | if (LPC_UART3->LSR & 0x01) |
igor_v | 0:8ad47e2b6f00 | 542 | { |
igor_v | 0:8ad47e2b6f00 | 543 | ConInCur3++; |
igor_v | 0:8ad47e2b6f00 | 544 | ConInCur3 = ConInCur3 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 545 | InCon3[ConInCur3] = (LPC_UART3->RBR); |
igor_v | 0:8ad47e2b6f00 | 546 | } |
igor_v | 0:8ad47e2b6f00 | 547 | |
igor_v | 0:8ad47e2b6f00 | 548 | if (!(LPC_UART3->LSR & 0x40)) SetDeUART3 (); else ClrDeUART3() ; //���������� 485 |
igor_v | 0:8ad47e2b6f00 | 549 | } |
igor_v | 0:8ad47e2b6f00 | 550 | |
igor_v | 0:8ad47e2b6f00 | 551 | |
igor_v | 0:8ad47e2b6f00 | 552 | |
igor_v | 0:8ad47e2b6f00 | 553 | void Concol2M (void ) |
igor_v | 0:8ad47e2b6f00 | 554 | { |
igor_v | 0:8ad47e2b6f00 | 555 | if (OutBufCon2Count == 0) |
igor_v | 0:8ad47e2b6f00 | 556 | { |
igor_v | 0:8ad47e2b6f00 | 557 | if (ConOutPnt2M != ConOutCur2M) |
igor_v | 0:8ad47e2b6f00 | 558 | if (LPC_UART2->LSR & 0x20) |
igor_v | 0:8ad47e2b6f00 | 559 | { |
igor_v | 0:8ad47e2b6f00 | 560 | ConOutCur2++; |
igor_v | 0:8ad47e2b6f00 | 561 | ConOutCur2 = ConOutCur2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 562 | SetDeUART2 (); |
igor_v | 0:8ad47e2b6f00 | 563 | LPC_UART2->THR = OutCon2[ConOutCur2]; |
igor_v | 0:8ad47e2b6f00 | 564 | } |
igor_v | 0:8ad47e2b6f00 | 565 | } |
igor_v | 0:8ad47e2b6f00 | 566 | if (LPC_UART2->LSR & 0x01) |
igor_v | 0:8ad47e2b6f00 | 567 | { |
igor_v | 0:8ad47e2b6f00 | 568 | ConInCur2++; |
igor_v | 0:8ad47e2b6f00 | 569 | ConInCur2 = ConInCur2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 570 | InCon2[ConInCur2] = (LPC_UART2->RBR); |
igor_v | 0:8ad47e2b6f00 | 571 | } |
igor_v | 0:8ad47e2b6f00 | 572 | if (!(LPC_UART2->LSR & 0x40)) SetDeUART2 (); else ClrDeUART2() ; //���������� 485 |
igor_v | 0:8ad47e2b6f00 | 573 | } |
igor_v | 0:8ad47e2b6f00 | 574 | |
igor_v | 0:8ad47e2b6f00 | 575 | |
igor_v | 0:8ad47e2b6f00 | 576 | |
igor_v | 0:8ad47e2b6f00 | 577 | |
igor_v | 0:8ad47e2b6f00 | 578 | |
igor_v | 0:8ad47e2b6f00 | 579 | |
igor_v | 0:8ad47e2b6f00 | 580 | void WriteCon (char *s) |
igor_v | 0:8ad47e2b6f00 | 581 | { |
igor_v | 0:8ad47e2b6f00 | 582 | OutBufConCount = 0; |
igor_v | 0:8ad47e2b6f00 | 583 | while (*s != 0) |
igor_v | 0:8ad47e2b6f00 | 584 | { |
igor_v | 0:8ad47e2b6f00 | 585 | ConOutPnt++; |
igor_v | 0:8ad47e2b6f00 | 586 | ConOutPnt = ConOutPnt & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 587 | OutCon[ConOutPnt] = (*s++); |
igor_v | 0:8ad47e2b6f00 | 588 | } |
igor_v | 0:8ad47e2b6f00 | 589 | } |
igor_v | 0:8ad47e2b6f00 | 590 | |
igor_v | 0:8ad47e2b6f00 | 591 | void WriteCon1 (char *s) |
igor_v | 0:8ad47e2b6f00 | 592 | { |
igor_v | 0:8ad47e2b6f00 | 593 | OutBufCon1Count = 0; |
igor_v | 0:8ad47e2b6f00 | 594 | while (*s != 0) |
igor_v | 0:8ad47e2b6f00 | 595 | { |
igor_v | 0:8ad47e2b6f00 | 596 | ConOutPnt1++; |
igor_v | 0:8ad47e2b6f00 | 597 | ConOutPnt1 = ConOutPnt1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 598 | OutCon1[ConOutPnt1] = (*s++); |
igor_v | 0:8ad47e2b6f00 | 599 | } |
igor_v | 0:8ad47e2b6f00 | 600 | } |
igor_v | 0:8ad47e2b6f00 | 601 | |
igor_v | 0:8ad47e2b6f00 | 602 | void WriteConN (char *s, unsigned int N) |
igor_v | 0:8ad47e2b6f00 | 603 | { |
Kovalev_D | 93:b3803774f110 | 604 | OutBufCon1Count = 0; |
Kovalev_D | 181:0b022246c43c | 605 | |
Kovalev_D | 93:b3803774f110 | 606 | while (N != 0) |
Kovalev_D | 93:b3803774f110 | 607 | { |
Kovalev_D | 93:b3803774f110 | 608 | N--; |
Kovalev_D | 93:b3803774f110 | 609 | ConOutPnt1++; |
Kovalev_D | 93:b3803774f110 | 610 | ConOutPnt1 = ConOutPnt1 & 0x3ff; |
Kovalev_D | 93:b3803774f110 | 611 | OutCon1[ConOutPnt1] = (*s++); |
Kovalev_D | 93:b3803774f110 | 612 | } |
Kovalev_D | 181:0b022246c43c | 613 | Time_UART=Gyro.DropDelayGLD; |
Kovalev_D | 181:0b022246c43c | 614 | OutBufCon1Count = 100; |
Kovalev_D | 93:b3803774f110 | 615 | } |
Kovalev_D | 93:b3803774f110 | 616 | |
Kovalev_D | 93:b3803774f110 | 617 | |
Kovalev_D | 93:b3803774f110 | 618 | void WriteCon0N (char *s, unsigned int N) |
Kovalev_D | 93:b3803774f110 | 619 | { |
igor_v | 0:8ad47e2b6f00 | 620 | OutBufConCount = 0; |
igor_v | 0:8ad47e2b6f00 | 621 | while (N != 0) |
igor_v | 0:8ad47e2b6f00 | 622 | { |
igor_v | 0:8ad47e2b6f00 | 623 | N--; |
Kovalev_D | 92:c892f0311aa7 | 624 | ConOutPnt++; |
Kovalev_D | 92:c892f0311aa7 | 625 | ConOutPnt = ConOutPnt & 0x3ff; |
Kovalev_D | 92:c892f0311aa7 | 626 | OutCon[ConOutPnt] = (*s++); |
igor_v | 0:8ad47e2b6f00 | 627 | } |
Kovalev_D | 92:c892f0311aa7 | 628 | OutBufConCount = 10; |
igor_v | 0:8ad47e2b6f00 | 629 | } |
igor_v | 0:8ad47e2b6f00 | 630 | |
igor_v | 0:8ad47e2b6f00 | 631 | |
igor_v | 0:8ad47e2b6f00 | 632 | void WriteCon2 (char *s) |
igor_v | 0:8ad47e2b6f00 | 633 | { |
igor_v | 0:8ad47e2b6f00 | 634 | OutBufCon2Count = 0; |
igor_v | 0:8ad47e2b6f00 | 635 | while (*s != 0) |
igor_v | 0:8ad47e2b6f00 | 636 | { |
igor_v | 0:8ad47e2b6f00 | 637 | ConOutPnt2++; |
igor_v | 0:8ad47e2b6f00 | 638 | ConOutPnt2 = ConOutPnt2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 639 | OutCon2[ConOutPnt2] = (*s++); |
igor_v | 0:8ad47e2b6f00 | 640 | } |
igor_v | 0:8ad47e2b6f00 | 641 | } |
igor_v | 0:8ad47e2b6f00 | 642 | void WriteCon3 (char *s) |
igor_v | 0:8ad47e2b6f00 | 643 | { |
igor_v | 0:8ad47e2b6f00 | 644 | OutBufCon3Count = 0; |
igor_v | 0:8ad47e2b6f00 | 645 | while (*s != 0) |
igor_v | 0:8ad47e2b6f00 | 646 | { |
igor_v | 0:8ad47e2b6f00 | 647 | ConOutPnt3++; |
igor_v | 0:8ad47e2b6f00 | 648 | ConOutPnt3 = ConOutPnt3 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 649 | OutCon3[ConOutPnt3] = (*s++); |
igor_v | 0:8ad47e2b6f00 | 650 | } |
igor_v | 0:8ad47e2b6f00 | 651 | } |
igor_v | 0:8ad47e2b6f00 | 652 | |
igor_v | 0:8ad47e2b6f00 | 653 | |
igor_v | 0:8ad47e2b6f00 | 654 | |
igor_v | 0:8ad47e2b6f00 | 655 | |
igor_v | 0:8ad47e2b6f00 | 656 | void WriteConF (char *s, unsigned int Num) |
igor_v | 0:8ad47e2b6f00 | 657 | { |
igor_v | 0:8ad47e2b6f00 | 658 | if (Num == 0) WriteCon(s); |
igor_v | 0:8ad47e2b6f00 | 659 | if (Num == 1) WriteCon1(s); |
igor_v | 0:8ad47e2b6f00 | 660 | if (Num == 2) WriteCon2(s); |
igor_v | 0:8ad47e2b6f00 | 661 | if (Num == 2) WriteCon3(s); |
igor_v | 0:8ad47e2b6f00 | 662 | |
igor_v | 0:8ad47e2b6f00 | 663 | } |
igor_v | 0:8ad47e2b6f00 | 664 | |
igor_v | 0:8ad47e2b6f00 | 665 | |
igor_v | 0:8ad47e2b6f00 | 666 | |
igor_v | 0:8ad47e2b6f00 | 667 | |
igor_v | 0:8ad47e2b6f00 | 668 | void WriteConByte (unsigned int In) |
igor_v | 0:8ad47e2b6f00 | 669 | { |
igor_v | 0:8ad47e2b6f00 | 670 | ConOutPnt++; |
igor_v | 0:8ad47e2b6f00 | 671 | ConOutPnt = ConOutPnt & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 672 | OutCon[ConOutPnt] = In; |
igor_v | 0:8ad47e2b6f00 | 673 | } |
igor_v | 0:8ad47e2b6f00 | 674 | |
igor_v | 0:8ad47e2b6f00 | 675 | void WriteCon1Byte (unsigned int In) |
igor_v | 0:8ad47e2b6f00 | 676 | { |
igor_v | 0:8ad47e2b6f00 | 677 | ConOutPnt1++; |
igor_v | 0:8ad47e2b6f00 | 678 | ConOutPnt1 = ConOutPnt1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 679 | OutCon1[ConOutPnt1] = In; |
igor_v | 0:8ad47e2b6f00 | 680 | } |
igor_v | 0:8ad47e2b6f00 | 681 | |
igor_v | 0:8ad47e2b6f00 | 682 | |
igor_v | 0:8ad47e2b6f00 | 683 | void WriteCon2Byte (unsigned int temp) |
igor_v | 0:8ad47e2b6f00 | 684 | { |
igor_v | 0:8ad47e2b6f00 | 685 | ConOutPnt2++; |
igor_v | 0:8ad47e2b6f00 | 686 | ConOutPnt2 = ConOutPnt2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 687 | OutCon2[ConOutPnt2] = temp; |
igor_v | 0:8ad47e2b6f00 | 688 | } |
igor_v | 0:8ad47e2b6f00 | 689 | |
igor_v | 0:8ad47e2b6f00 | 690 | void WriteCon3Byte (unsigned int temp) |
igor_v | 0:8ad47e2b6f00 | 691 | { |
igor_v | 0:8ad47e2b6f00 | 692 | ConOutPnt3++; |
igor_v | 0:8ad47e2b6f00 | 693 | ConOutPnt3 = ConOutPnt3 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 694 | OutCon3[ConOutPnt3] = temp; |
igor_v | 0:8ad47e2b6f00 | 695 | } |
igor_v | 0:8ad47e2b6f00 | 696 | |
igor_v | 0:8ad47e2b6f00 | 697 | |
igor_v | 0:8ad47e2b6f00 | 698 | |
igor_v | 0:8ad47e2b6f00 | 699 | |
igor_v | 0:8ad47e2b6f00 | 700 | |
igor_v | 0:8ad47e2b6f00 | 701 | void WriteConByteF (unsigned int In,unsigned int Num ) |
igor_v | 0:8ad47e2b6f00 | 702 | { |
igor_v | 0:8ad47e2b6f00 | 703 | if (Num == 0) WriteConByte(In); |
igor_v | 0:8ad47e2b6f00 | 704 | if (Num == 1) WriteCon1Byte(In); |
igor_v | 0:8ad47e2b6f00 | 705 | if (Num == 2) WriteCon2Byte(In); |
igor_v | 0:8ad47e2b6f00 | 706 | if (Num == 3) WriteCon3Byte(In); |
igor_v | 0:8ad47e2b6f00 | 707 | |
igor_v | 0:8ad47e2b6f00 | 708 | } |
igor_v | 0:8ad47e2b6f00 | 709 | |
igor_v | 0:8ad47e2b6f00 | 710 | |
igor_v | 0:8ad47e2b6f00 | 711 | |
igor_v | 0:8ad47e2b6f00 | 712 | |
igor_v | 0:8ad47e2b6f00 | 713 | |
igor_v | 0:8ad47e2b6f00 | 714 | |
igor_v | 0:8ad47e2b6f00 | 715 | |
igor_v | 0:8ad47e2b6f00 | 716 | |
igor_v | 0:8ad47e2b6f00 | 717 | |
igor_v | 0:8ad47e2b6f00 | 718 | int ReadCon (char *s) |
igor_v | 0:8ad47e2b6f00 | 719 | { |
igor_v | 0:8ad47e2b6f00 | 720 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 721 | while (ConInPnt != ConInCur) |
igor_v | 0:8ad47e2b6f00 | 722 | { |
igor_v | 0:8ad47e2b6f00 | 723 | i++; |
igor_v | 0:8ad47e2b6f00 | 724 | ConInPnt++; |
igor_v | 0:8ad47e2b6f00 | 725 | ConInPnt = ConInPnt & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 726 | (*s++) = InCon[ConInPnt] ; |
igor_v | 0:8ad47e2b6f00 | 727 | } |
igor_v | 0:8ad47e2b6f00 | 728 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 729 | return i; |
igor_v | 0:8ad47e2b6f00 | 730 | } |
igor_v | 0:8ad47e2b6f00 | 731 | |
igor_v | 0:8ad47e2b6f00 | 732 | int ReadCon1 (char *s) |
igor_v | 0:8ad47e2b6f00 | 733 | { |
igor_v | 0:8ad47e2b6f00 | 734 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 735 | while (ConInPnt1 != ConInCur1) |
igor_v | 0:8ad47e2b6f00 | 736 | { |
igor_v | 0:8ad47e2b6f00 | 737 | i++; |
igor_v | 0:8ad47e2b6f00 | 738 | ConInPnt1++; |
igor_v | 0:8ad47e2b6f00 | 739 | ConInPnt1 = ConInPnt1 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 740 | (*s++) = InCon1[ConInPnt1] ; |
igor_v | 0:8ad47e2b6f00 | 741 | } |
igor_v | 0:8ad47e2b6f00 | 742 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 743 | return i; |
igor_v | 0:8ad47e2b6f00 | 744 | } |
igor_v | 0:8ad47e2b6f00 | 745 | |
igor_v | 0:8ad47e2b6f00 | 746 | int ReadCon2 (char *s) |
igor_v | 0:8ad47e2b6f00 | 747 | { |
igor_v | 0:8ad47e2b6f00 | 748 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 749 | while (ConInPnt2 != ConInCur2) |
igor_v | 0:8ad47e2b6f00 | 750 | { |
igor_v | 0:8ad47e2b6f00 | 751 | i++; |
igor_v | 0:8ad47e2b6f00 | 752 | ConInPnt2++; |
igor_v | 0:8ad47e2b6f00 | 753 | ConInPnt2 = ConInPnt2 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 754 | (*s++) = InCon2[ConInPnt2] ; |
igor_v | 0:8ad47e2b6f00 | 755 | } |
igor_v | 0:8ad47e2b6f00 | 756 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 757 | return i; |
igor_v | 0:8ad47e2b6f00 | 758 | |
igor_v | 0:8ad47e2b6f00 | 759 | } |
igor_v | 0:8ad47e2b6f00 | 760 | |
igor_v | 0:8ad47e2b6f00 | 761 | |
igor_v | 0:8ad47e2b6f00 | 762 | int ReadCon3 (char *s) |
igor_v | 0:8ad47e2b6f00 | 763 | { |
igor_v | 0:8ad47e2b6f00 | 764 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 765 | while (ConInPnt3 != ConInCur3) |
igor_v | 0:8ad47e2b6f00 | 766 | { |
igor_v | 0:8ad47e2b6f00 | 767 | i++; |
igor_v | 0:8ad47e2b6f00 | 768 | ConInPnt3++; |
igor_v | 0:8ad47e2b6f00 | 769 | ConInPnt3 = ConInPnt3 & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 770 | (*s++) = InCon3[ConInPnt3] ; |
igor_v | 0:8ad47e2b6f00 | 771 | } |
igor_v | 0:8ad47e2b6f00 | 772 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 773 | return i; |
igor_v | 0:8ad47e2b6f00 | 774 | |
igor_v | 0:8ad47e2b6f00 | 775 | } |
igor_v | 0:8ad47e2b6f00 | 776 | |
igor_v | 0:8ad47e2b6f00 | 777 | |
igor_v | 0:8ad47e2b6f00 | 778 | |
igor_v | 0:8ad47e2b6f00 | 779 | |
igor_v | 0:8ad47e2b6f00 | 780 | |
igor_v | 0:8ad47e2b6f00 | 781 | int ReadChekCon (char *s) |
igor_v | 0:8ad47e2b6f00 | 782 | { |
igor_v | 0:8ad47e2b6f00 | 783 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 784 | int ConInPntTemp = ConInPnt; |
igor_v | 0:8ad47e2b6f00 | 785 | while (ConInPntTemp != ConInCur) |
igor_v | 0:8ad47e2b6f00 | 786 | { |
igor_v | 0:8ad47e2b6f00 | 787 | i++; |
igor_v | 0:8ad47e2b6f00 | 788 | ConInPntTemp++; |
igor_v | 0:8ad47e2b6f00 | 789 | ConInPntTemp = ConInPntTemp & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 790 | (*s++) = InCon[ConInPntTemp] ; |
igor_v | 0:8ad47e2b6f00 | 791 | } |
igor_v | 0:8ad47e2b6f00 | 792 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 793 | return i; |
igor_v | 0:8ad47e2b6f00 | 794 | } |
igor_v | 0:8ad47e2b6f00 | 795 | |
igor_v | 0:8ad47e2b6f00 | 796 | int ReadChekCon1 (char *s) |
igor_v | 0:8ad47e2b6f00 | 797 | { |
igor_v | 0:8ad47e2b6f00 | 798 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 799 | int ConInPntTemp = ConInPnt1; |
igor_v | 0:8ad47e2b6f00 | 800 | while (ConInPntTemp != ConInCur1) |
igor_v | 0:8ad47e2b6f00 | 801 | { |
igor_v | 0:8ad47e2b6f00 | 802 | i++; |
igor_v | 0:8ad47e2b6f00 | 803 | ConInPntTemp++; |
igor_v | 0:8ad47e2b6f00 | 804 | ConInPntTemp = ConInPntTemp & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 805 | (*s++) = InCon1[ConInPntTemp] ; |
igor_v | 0:8ad47e2b6f00 | 806 | } |
igor_v | 0:8ad47e2b6f00 | 807 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 808 | return i; |
igor_v | 0:8ad47e2b6f00 | 809 | } |
igor_v | 0:8ad47e2b6f00 | 810 | |
igor_v | 0:8ad47e2b6f00 | 811 | |
igor_v | 0:8ad47e2b6f00 | 812 | |
igor_v | 0:8ad47e2b6f00 | 813 | |
igor_v | 0:8ad47e2b6f00 | 814 | int ReadChekCon2 (char *s) |
igor_v | 0:8ad47e2b6f00 | 815 | { |
igor_v | 0:8ad47e2b6f00 | 816 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 817 | int ConInPntTemp = ConInPnt2; |
igor_v | 0:8ad47e2b6f00 | 818 | while (ConInPntTemp != ConInCur2) |
igor_v | 0:8ad47e2b6f00 | 819 | { |
igor_v | 0:8ad47e2b6f00 | 820 | i++; |
igor_v | 0:8ad47e2b6f00 | 821 | ConInPntTemp++; |
igor_v | 0:8ad47e2b6f00 | 822 | ConInPntTemp = ConInPntTemp & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 823 | (*s++) = InCon2[ConInPntTemp] ; |
igor_v | 0:8ad47e2b6f00 | 824 | } |
igor_v | 0:8ad47e2b6f00 | 825 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 826 | return i; |
igor_v | 0:8ad47e2b6f00 | 827 | } |
igor_v | 0:8ad47e2b6f00 | 828 | |
igor_v | 0:8ad47e2b6f00 | 829 | |
igor_v | 0:8ad47e2b6f00 | 830 | int ReadChekCon3 (char *s) |
igor_v | 0:8ad47e2b6f00 | 831 | { |
igor_v | 0:8ad47e2b6f00 | 832 | int i = 0; |
igor_v | 0:8ad47e2b6f00 | 833 | int ConInPntTemp = ConInPnt3; |
igor_v | 0:8ad47e2b6f00 | 834 | while (ConInPntTemp != ConInCur3) |
igor_v | 0:8ad47e2b6f00 | 835 | { |
igor_v | 0:8ad47e2b6f00 | 836 | i++; |
igor_v | 0:8ad47e2b6f00 | 837 | ConInPntTemp++; |
igor_v | 0:8ad47e2b6f00 | 838 | ConInPntTemp = ConInPntTemp & 0x3ff; |
igor_v | 0:8ad47e2b6f00 | 839 | (*s++) = InCon3[ConInPntTemp] ; |
igor_v | 0:8ad47e2b6f00 | 840 | } |
igor_v | 0:8ad47e2b6f00 | 841 | (*s++) = 0; |
igor_v | 0:8ad47e2b6f00 | 842 | return i; |
igor_v | 0:8ad47e2b6f00 | 843 | } |
igor_v | 0:8ad47e2b6f00 | 844 | |
igor_v | 0:8ad47e2b6f00 | 845 | |
igor_v | 0:8ad47e2b6f00 | 846 | |
igor_v | 0:8ad47e2b6f00 | 847 | |
igor_v | 0:8ad47e2b6f00 | 848 | |
igor_v | 0:8ad47e2b6f00 | 849 | |
igor_v | 0:8ad47e2b6f00 | 850 | int ChekInCon ( void ) {if (ConInPnt != ConInCur) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 851 | int ChekInCon1 ( void ) {if (ConInPnt1 != ConInCur1) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 852 | int ChekInCon2 ( void ) {if (ConInPnt2 != ConInCur2) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 853 | int ChekInCon3 ( void ) {if (ConInPnt3 != ConInCur3) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 854 | |
igor_v | 0:8ad47e2b6f00 | 855 | int ChekOutCon ( void ) {if (!(LPC_UART0->LSR & 0x40)) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 856 | int ChekOutCon1 ( void ) {if (!(LPC_UART1->LSR & 0x40)) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 857 | int ChekOutCon2 ( void ) {if (!(LPC_UART2->LSR & 0x40)) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 858 | int ChekOutCon3 ( void ) {if (!(LPC_UART3->LSR & 0x40)) return 1; else return 0;} |
igor_v | 0:8ad47e2b6f00 | 859 | |
igor_v | 0:8ad47e2b6f00 | 860 | |
igor_v | 0:8ad47e2b6f00 | 861 | |
igor_v | 0:8ad47e2b6f00 | 862 | |
igor_v | 0:8ad47e2b6f00 | 863 | void Delay(int t) |
igor_v | 0:8ad47e2b6f00 | 864 | { |
igor_v | 0:8ad47e2b6f00 | 865 | } |
igor_v | 0:8ad47e2b6f00 | 866 | |
igor_v | 0:8ad47e2b6f00 | 867 | |
igor_v | 0:8ad47e2b6f00 | 868 | void SetDeUART0 (void) {if ((PortEUART0 & (PinEUART0)) == 0) {PortEUART0 |= (PinEUART0); Delay(10);} } |
igor_v | 0:8ad47e2b6f00 | 869 | void ClrDeUART0 (void) {if ((PortEUART0 & (PinEUART0))) { Delay(10); PortEUART0 &= (~(PinEUART0));}} |
igor_v | 0:8ad47e2b6f00 | 870 | |
igor_v | 0:8ad47e2b6f00 | 871 | void SetDeUART1 (void) {if ((PortEUART1 & (PinEUART1)) == 0) {PortEUART1 |= (PinEUART1); Delay(10);} } |
igor_v | 0:8ad47e2b6f00 | 872 | void ClrDeUART1 (void) {if ((PortEUART1 & (PinEUART1))) { Delay(10); PortEUART1 &= (~(PinEUART1));}} |
igor_v | 0:8ad47e2b6f00 | 873 | |
igor_v | 0:8ad47e2b6f00 | 874 | |
igor_v | 0:8ad47e2b6f00 | 875 | |
igor_v | 0:8ad47e2b6f00 | 876 | void SetDeUART2 (void) {if ((PortEUART2 & (PinEUART2)) == 0) {PortEUART2 |= (PinEUART2); Delay(10);}} |
igor_v | 0:8ad47e2b6f00 | 877 | void ClrDeUART2 (void) {if ((PortEUART2 & (PinEUART2))) {Delay(10); PortEUART2 &= (~(PinEUART2));}} |
igor_v | 0:8ad47e2b6f00 | 878 | |
igor_v | 0:8ad47e2b6f00 | 879 | |
igor_v | 0:8ad47e2b6f00 | 880 | void SetDeUART3 (void) {if ((PortEUART3 & (PinEUART3)) == 0) {PortEUART3 |= (PinEUART3); Delay(10);}} |
igor_v | 0:8ad47e2b6f00 | 881 | void ClrDeUART3 (void) {if ((PortEUART3 & (PinEUART3))) {Delay(10);PortEUART3 &= (~(PinEUART3));}} |
igor_v | 0:8ad47e2b6f00 | 882 | |
igor_v | 0:8ad47e2b6f00 | 883 | |
igor_v | 0:8ad47e2b6f00 | 884 | |
igor_v | 0:8ad47e2b6f00 | 885 | |
igor_v | 0:8ad47e2b6f00 | 886 |