Go to the source code of this file.
Defines | |
#define | DEFAULT_BAUDRATE 57600 |
#define | DEFAULT_BRGH 0 |
#define | DEFAULT_BAUDRATE1 DEFAULT_BAUDRATE |
#define | DEFAULT_BRGH1 DEFAULT_BRGH |
#define | IS_CHAR_READY_UART1() U1STAbits.URXDA |
#define | IS_TRANSMIT_BUFFER_FULL_UART1() U1STAbits.UTXBF |
#define | IS_TRANSMIT_COMPLETE_UART1() U1STAbits.TRMT |
Constants for the UxMODE.PDSEL bitfield | |
#define | UXMODE_PDSEL_8DATA_NOPARITY 0 |
#define | UXMODE_PDSEL_8DATA_EVENPARITY 1 |
#define | UXMODE_PDSEL_8DATA_ODDPARITY 2 |
#define | UXMODE_PDSEL_9DATA_NOPARITY 3 |
Functions | |
static void | CONFIG_BAUDRATE_UART1 (uint32 baudRate) |
static void | CONFIG_PDSEL_UART1 (uint8 u8_pdsel) |
static void | CONFIG_STOPBITS_UART1 (uint8 u8_numStopbits) |
static void | ENABLE_UART1 () |
static void | WAIT_UNTIL_TRANSMIT_COMPLETE_UART1 () |
void | outChar1 (uint8 u8_c) |
uint8 | inChar1 (void) |
void | configUART1 (uint32 u32_baudRate) |
uint8 | isCharReady1 (void) |
void | checkRxErrorUART1 (void) |
Definition in file pic24_uart.h.
#define DEFAULT_BAUDRATE 57600 |
Default baud rate used by configBasic() to configure the DEFAULT_UART.
Definition at line 53 of file pic24_uart.h.
#define DEFAULT_BAUDRATE1 DEFAULT_BAUDRATE |
Chose a default baud rate for UART1, used by configUART1 to set up UART1.
Definition at line 75 of file pic24_uart.h.
#define DEFAULT_BRGH 0 |
Default BRGH value used by CONFIG_BAUDRATE_UART1 when configurating a UART. This value may be overridden on a per-UART basis by #defineing DEFAULT_BRGH1 to 4. Allowed values:
Definition at line 64 of file pic24_uart.h.
#define DEFAULT_BRGH1 DEFAULT_BRGH |
Chose a default BRGH for UART1, used by CONFIG_BAUDRATE_UART1 to set up UART1.
Definition at line 82 of file pic24_uart.h.
#define IS_CHAR_READY_UART1 | ( | ) | U1STAbits.URXDA |
Determine if a character is available in the UART's receive buffer.
Definition at line 149 of file pic24_uart.h.
#define IS_TRANSMIT_BUFFER_FULL_UART1 | ( | ) | U1STAbits.UTXBF |
Determine if a the transmit buffer is full.
Definition at line 155 of file pic24_uart.h.
#define IS_TRANSMIT_COMPLETE_UART1 | ( | ) | U1STAbits.TRMT |
Determines if all characters placed in the UART have been sent. Returns 1 if the last transmission has completed, or 0 if a transmission is in progress or queued in the transmit buffer.
Definition at line 162 of file pic24_uart.h.
void checkRxErrorUART1 | ( | void | ) |
Check UART1 RX for error, call reportError() if error found.
Definition at line 71 of file pic24_uart.c.
static void CONFIG_BAUDRATE_UART1 | ( | uint32 | baudRate | ) | [inline, static] |
Configure UART baud rate, based on FCY. Note that the value computed is truncated, not rounded, since this is done using integer arithmetic. That is, BRG = truncate(FCY/16/baud - 1), giving an actual baud rate of FCY/16/(reg + 1), assuming BRGH=0.
NOTE: this code uses as default a value of BRGH=0 (16 clocks for each bit). Be careful about using BRGH=1 - this uses only four clock periods to sample each bit and can be very intolerant of baud rate error - you may see framing errors.
baudRate | Desired baud rate. |
Definition at line 98 of file pic24_uart.h.
static void CONFIG_PDSEL_UART1 | ( | uint8 | u8_pdsel | ) | [inline, static] |
Select the parity and number of data bits for the UART. Use constants UXMODE_PDSEL_8DATA_NOPARITY and following.
u8_pdsel | Parity and number of data bits. |
Definition at line 124 of file pic24_uart.h.
static void CONFIG_STOPBITS_UART1 | ( | uint8 | u8_numStopbits | ) | [inline, static] |
Select the number of stop bits for this UART. Valid values are 1 or 2.
u8_numStopbits | Number of stop bits. |
Definition at line 133 of file pic24_uart.h.
static void ENABLE_UART1 | ( | ) | [inline, static] |
Enable RX, TX for UART.
Definition at line 139 of file pic24_uart.h.
uint8 inChar1 | ( | void | ) |
Wait for a byte to be available from UART1 RX.
Definition at line 215 of file pic24_uart.c.
uint8 isCharReady1 | ( | void | ) |
Return true if character is ready to be read
Definition at line 207 of file pic24_uart.c.
void outChar1 | ( | uint8 | u8_c | ) |
Output u8_c to UART1 TX.
u8_c | Character to write |
Definition at line 146 of file pic24_uart.c.
static void WAIT_UNTIL_TRANSMIT_COMPLETE_UART1 | ( | ) | [inline, static] |
Waits until all characters placed in the UART have been sent.
Definition at line 165 of file pic24_uart.h.