View previous topic :: View next topic |
Author |
Message |
Mrinmoy Dey
Joined: 23 Jan 2018 Posts: 44
|
PIC18F66K40 UART3 receive issue |
Posted: Sun Jun 14, 2020 7:48 am |
|
|
Hi,
I am using PIC18F66K40 in one of my projects where I need to use two UARTs as per requirement; UART1 & UART3. UART1 is working fine but UART3 is not able to receive any data; only sending is done.
My send and receive process is same for both UARTs but my observation is, as UART3 is on analog pins(Tx-ANE0 & Rx- ANE1) but UART1 is not that; there is some problem in software to receive data through UART3.
My compiler version is 5.083 using mplab x ide.
Can anyone give me any idea about my observation? Because the datasheet says -
"Important: The ANSELx bits default to the Analog mode after Reset. To use any pins as digital
general purpose or peripheral inputs, the corresponding ANSEL bits must be initialized to ‘0’ by
user software."
So I tried up with "setup_adc_ports" function with "NO_ANALOG" parameter, but still didn't work.
Can anyone help me?
Thank you. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19520
|
|
Posted: Sun Jun 14, 2020 8:28 am |
|
|
The pins for UART3, are PPS. This means they _must_ be configured
using #PIN_SELECT.
So:
Code: |
#PIN_SELECT U3RX=PIN_E1
#PIN_SELECT U3TX=PIN_E0
#use RS232(UART3, baud=yourbaud, ERRORS, stream=yourstream)
|
The sticky at the top of the forum covers how to do this.
You are currently using a software UART, which is why only transmit
works. |
|
|
|