| Electronic Components Datasheet Search |
|
PIC24F04KA201 Datasheet(PDF) 137 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC24F04KA201 Datasheet(HTML) 137 Page - Microchip Technology |
|
137 / 224 page ![]() © 2009 Microchip Technology Inc. Preliminary DS39937B-page 135 PIC24F04KA201 FAMILY 17.2 Transmitting in 8-Bit Data Mode 1. Set up the UART: a) Write appropriate values for data, parity and Stop bits. b) Write appropriate baud rate value to the U1BRG register. c) Set up transmit and receive interrupt enable and priority bits. 2. Enable the UART. 3. Set the UTXEN bit (causes a transmit interrupt two cycles after being set). 4. Write data byte to lower byte of U1TXREG word. The value will be immediately transferred to the Transmit Shift Register (TSR), and the serial bit stream will start shifting out with the next rising edge of the baud clock. 5. Alternately, the data byte may be transferred while UTXEN = 0, and then, the user may set UTXEN. This will cause the serial bit stream to begin immediately because the baud clock will start from a cleared state. 6. A transmit interrupt will be generated as per interrupt control bit, UTXISEL1. 17.3 Transmitting in 9-Bit Data Mode 1. Set up the UART (as described in Section 17.2 “Transmitting in 8-Bit Data Mode” ). 2. Enable the UART. 3. Set the UTXEN bit (causes a transmit interrupt two cycles after being set). 4. Write U1TXREG as a 16-bit value only. 5. A word write to U1TXREG triggers the transfer of the 9-bit data to the TSR. The serial bit stream will start shifting out with the first rising edge of the baud clock. 6. A transmit interrupt will be generated as per the setting of control bit, UTXISEL1. 17.4 Break and Sync Transmit Sequence The following sequence will send a message frame header made up of a Break, followed by an auto-baud Sync byte. 1. Configure the UART for the desired mode. 2. Set UTXEN and UTXBRK – sets up the Break character. 3. Load the U1TXREG with a dummy character to initiate transmission (value is ignored). 4. Write ‘55h’ to U1TXREG – loads the Sync character into the transmit FIFO. 5. After the Break has been sent, the UTXBRK bit is reset by hardware. The Sync character now transmits. 17.5 Receiving in 8-Bit or 9-Bit Data Mode 1. Set up the UART (as described in Section 17.2 “Transmitting in 8-Bit Data Mode” ). 2. Enable the UART. 3. A receive interrupt will be generated when one or more data characters have been received as per interrupt control bit, URXISEL1. 4. Read the OERR bit to determine if an overrun error has occurred. The OERR bit must be reset in software. 5. Read U1RXREG. The act of reading the UxRXREG character will move the next character to the top of the receive FIFO, including a new set of PERR and FERR values. 17.6 Operation of U1CTS and U1RTS Control Pins UART1 Clear to Send (U1CTS) and Request to Send (U1RTS) are the two hardware-controlled pins that are associated with the UART module. These two pins allow the UART to operate in Simplex and Flow Control modes. They are implemented to control the transmission and reception between the Data Terminal Equipment (DTE). The UEN<1:0> bits in the U1MODE register configure these pins. 17.7 Infrared Support The UART module provides two types of infrared UART support: one is the IrDA clock output to support an external IrDA encoder and decoder device (legacy module support), and the other is the full implementation of the IrDA encoder and decoder. As the IrDA modes require a 16x baud clock, they will only work when the BRGH bit (U1MODE<3>) is ‘0’. 17.7.1 EXTERNAL IrDA SUPPORT – IrDA CLOCK OUTPUT To support external IrDA encoder and decoder devices, the U1BCLK pin (same as the U1RTS pin) can be configured to generate the 16x baud clock. When UEN<1:0> = 11, the U1BCLK pin will output the 16x baud clock if the UART module is enabled; it can be used to support the IrDA codec chip. 17.7.2 BUILT-IN IrDA ENCODER AND DECODER The UART has full implementation of the IrDA encoder and decoder as part of the UART module. The built-in IrDA encoder and decoder functionality is enabled using the IREN bit (U1MODE<12>). When enabled (IREN = 1), the receive pin (U1RX) acts as the input from the infrared receiver. The transmit pin (U1TX) acts as the output to the infrared transmitter. |
|
Link URL |
| Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link to Datasheet | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |