|
PIC24 Support Libraries
|
This file contains macros, prototypes, and definitions for Microchip PIC24 Family specific communications on ESOS. More...
Go to the source code of this file.
Macros | |
| #define | DEFAULT_BAUDRATE 57600 |
| #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 | |
Use with CONFIG_PDSEL_UART1. | |
| #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 () |
| void | configUART1 (uint32 u32_baudRate) |
| static void | WAIT_UNTIL_TRANSMIT_COMPLETE_UART1 () |
This file contains macros, prototypes, and definitions for Microchip PIC24 Family specific communications on ESOS.
This file contains routines which configure and use the UARTs on the PIC. See pic24_serial.h for higher-level routines, which should typically be called by the user rather than these routines.
Definition in file esos_pic24_rs232.h.
| #define DEFAULT_BAUDRATE 57600 |
Chose a default baud rate for the UART, used by configUART1 to set up the UART.
Definition at line 74 of file esos_pic24_rs232.h.
| #define IS_CHAR_READY_UART1 | ( | ) | U1STAbits.URXDA |
Determine if a character is available in the UART's receive buffer.
Definition at line 135 of file esos_pic24_rs232.h.
| #define IS_TRANSMIT_BUFFER_FULL_UART1 | ( | ) | U1STAbits.UTXBF |
Determine if a the transmit buffer is full.
Definition at line 141 of file esos_pic24_rs232.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 148 of file esos_pic24_rs232.h.
Referenced by WAIT_UNTIL_TRANSMIT_COMPLETE_UART1().
|
inlinestatic |
Configure the UART's 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).
NOTE: this code sets 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 89 of file esos_pic24_rs232.h.
Referenced by configUART1().
|
inlinestatic |
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 110 of file esos_pic24_rs232.h.
Referenced by configUART1().
|
inlinestatic |
Select the number of stop bits for this UART. Valid values are 1 or 2.
| u8_numStopbits | Number of stop bits. |
Definition at line 119 of file esos_pic24_rs232.h.
Referenced by configUART1().
|
inlinestatic |
Enable RX, TX for UART.
Definition at line 125 of file esos_pic24_rs232.h.
Referenced by configUART1().
|
inlinestatic |
Waits until all characters placed in the UART have been sent.
Definition at line 162 of file esos_pic24_rs232.h.
1.8.4