?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /*
2  
3 UART2 Driver Header File for PIC24.
4  
5 ********************************************************************************
6 FileName: uart2.c
7 Dependencies: HardwareProfile.h
8 Processor: PIC24
9 Compiler: MPLAB C30
10 Linker: MPLAB LINK30
11 Company: Microchip Technology Incorporated
12  
13 Author Date Comment
14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 Anton Alkhimenok 18-Oct-2005
16 KO 11-Oct-2006 v1.0
17 Anton Alkhimenok 17-Feb-2009 Added UART2Char2Hex(), UART2Hex2Char(),
18 UART2ClearError(), UART2DataReceived()
19 PAT 27-Jan-2010 Added UART2GetBaudError() for dynamic checking
20 of baud rate percentage error.
21 ********************************************************************************
22 Software License Agreement
23  
24 Microchip Technology Inc. ("Microchip") licenses to you the right to use, copy,
25 modify and distribute the software - including source code - only for use with
26 Microchip microcontrollers or Microchip digital signal controllers; provided
27 that no open source or free software is incorporated into the Source Code
28 without Microchip’s prior written consent in each instance.
29  
30 The software is owned by Microchip and its licensors, and is protected under
31 applicable copyright laws. All rights reserved.
32  
33 SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
34 EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF
35 MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE.
36 IN NO EVENT SHALL MICROCHIP OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER
37 CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR
38 OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
39 INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT OR
40 CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF
41 SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING
42 BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
43  
44 ********************************************************************************
45 */
46  
47 //******************************************************************************
48 // Function Prototypes
49 //******************************************************************************
50  
51 /*******************************************************************************
52 Function: UART2GetBaudError()
53  
54 Precondition:
55 None.
56  
57 Overview:
58 This routine checks the UART baud rate error percentage and returns it.
59  
60 Input: None.
61  
62 Output: Returns the baud rate error in percent.
63  
64 *******************************************************************************/
65 char UART2GetBaudError();
66  
67 /*********************************************************************
68 Function: char UART2GetChar()
69  
70 PreCondition: none
71  
72 Input: none
73  
74 Output: last character received
75  
76 Side Effects: none
77  
78 Overview: returns last character received
79  
80 Note: none
81  
82 ********************************************************************/
83 char UART2GetChar();
84  
85 /*********************************************************************
86 Function: void UART2PutChar(char ch)
87  
88 PreCondition: none
89  
90 Input: none
91  
92 Output: none
93  
94 Side Effects: none
95  
96 Overview: puts character
97  
98 Note: none
99 ********************************************************************/
100 void UART2PutChar( char ch );
101  
102 /*********************************************************************
103 Function: void UART2Init(void)
104  
105 PreCondition: none
106  
107 Input: none
108  
109 Output: none
110  
111 Side Effects: none
112  
113 Overview: initializes UART
114  
115 Note: none
116 ********************************************************************/
117 void UART2Init();
118  
119 /*******************************************************************************
120 Function: UART2IsPressed()
121  
122 Precondition:
123 UART2Init must be called prior to calling this routine.
124  
125 Overview:
126 This routine checks to see if there is a new byte in UART reception buffer.
127  
128 Input: None.
129  
130 Output:
131  
132 1 : Data is in the receive buffer
133  
134 *******************************************************************************/
135 char UART2IsPressed();
136  
137 /*******************************************************************************
138 Function: UART2PrintString( char *str )
139  
140 Precondition:
141 UART2Init must be called prior to calling this routine.
142  
143 Overview:
144 This function prints a string of characters to the UART.
145  
146 Input: Pointer to a null terminated character string.
147  
148 Output: None.
149  
150 *******************************************************************************/
151 void UART2PrintString( char *str );
152  
153 /*******************************************************************************
154 Function: UART2PutDec(unsigned char dec)
155  
156 Precondition:
157 UART2Init must be called prior to calling this routine.
158  
159 Input: Binary data
160  
161 Output: none
162  
163 Side Effects: none
164  
165 Overview: This function converts decimal data into a string
166 and outputs it to UART.
167  
168 Note: none
169 *******************************************************************************/
170 void UART2PutDec( unsigned char dec );
171  
172 /*******************************************************************************
173 Function: UART2PutHex
174  
175 Precondition:
176 UART2Init must be called prior to calling this routine.
177  
178 Input: Binary data
179  
180 Output: none
181  
182 Side Effects: none
183  
184 Overview: This function converts hex data into a string
185 and outputs it to UART.
186  
187 Note: none
188 *******************************************************************************/
189 void UART2PutHex( int toPrint );
190  
191 /*******************************************************************************
192 Function: UART2PutHexWord(unsigned int toPrint)
193  
194 Precondition:
195 UART2Init must be called prior to calling this routine.
196  
197 Input: Binary data
198  
199 Output: none
200  
201 Side Effects: none
202  
203 Overview: This function converts hex data into a string
204 and outputs it to UART.
205  
206 Note: none
207 *******************************************************************************/
208 #if defined( __C30__ ) || defined( __PIC32MX__ )
209 void UART2PutHexWord( unsigned int toPrint );
210 void UART2PutHexDWord( unsigned long int toPrint );
211 #endif
212  
213 /*********************************************************************
214 Function: char UART2Char2Hex(char ch)
215  
216 PreCondition: none
217  
218 Input: ASCII to be converted
219  
220 Output: number
221  
222 Side Effects: none
223  
224 Overview: converts ASCII coded digit into number
225  
226 Note: none
227  
228 ********************************************************************/
229 char UART2Char2Hex(char ch);
230  
231 /*********************************************************************
232 Function: char UART2Hex2Char(char hex)
233  
234 PreCondition: none
235  
236 Input: number
237  
238 Output: ASCII code
239  
240 Side Effects: none
241  
242 Overview: converts low nibble into ASCII coded digit
243  
244 Note: none
245  
246 ********************************************************************/
247 char UART2Hex2Char(char hex);
248  
249 /*********************************************************************
250 Function: void UART2ClrError(void)
251  
252 PreCondition: none
253  
254 Input: none
255  
256 Output: character received
257  
258 Side Effects: none
259  
260 Overview: wait for character
261  
262 Note: none
263  
264 ********************************************************************/
265 void UART2ClrError(void);
266  
267 /*********************************************************************
268 Macros: UART2DataReceived()
269  
270 PreCondition: none
271  
272 Input: none
273  
274 Output: zero if character is not received
275  
276 Side Effects: none
277  
278 Overview: checks if data is available
279  
280 Note: none
281  
282 ********************************************************************/
283 #define UART2DataReceived() (U2STAbits.URXDA)
284  
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3