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