Difficult to set UART on 16(L)F18346 SOLVED

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Difficult to set UART on 16(L)F18346 SOLVED

#1 Post by leo73 » 20 Oct 2022 10:16

Hello to Every One,
Before set Remappable UART on my pic 16(L)F18346 i tried to give a look to MIkroe forum and i found one paulfjujo Post about problem to mab right UART pins; unfortunatelli he used another MCU 16(K)F1619, he found a bug in PPS mapping mikroC library
For my Case is different i have difficult to mag my pic UART, below ther's datasheet tables.
I attached my configuration PPS (Peripherial pin select)
What is to wrong?
Thank you to you help.
Leonardo.

Code: Select all

////////////////////////////// UART TEST ///////////////////
 //
 // PIN OUT:
 // RC5 --> TX
 // RC4 --> RX
 //
 //
 //////////////////////////////////////////////////////////////


#define CLS 12
#define CR 13
#define LF 10
#define TAB 9


void CRLF1()
{
 UART1_Remappable_Write(CR);
 UART1_Remappable_Write(LF);
}

void UART1_Write_CText(const char *txt)
 {
   while (*txt)
      UART1_Remappable_Write(*txt++);
      Delay_us(5);
}


void main() {
// here MCU init
// set oscon reg (set clock it work fine!!! )
// Pin direction, port reset, switch off comparator


// USART1 RX, TX
// ---------- Peripheral PIN and EUSART configuration ----------------------
//PPS_Mapping_NoLock(_RC5, _OUTPUT, 18); // .<--------------------------------correctif !
PPS_Mapping_NoLock(_RC5, _OUTPUT, 14);  //10100(TX/CK) pag.163 Datasheet TX/CK
PPS_Mapping_NoLock(_RC4, _INPUT, _RXPPS);

UART1_Remappable_Init(9600); //19200
 
UART1_Write_CText (" Test : \r\n");

}
Attachments
TestRemappableUart16F18346-V1.0.zip
(52.1 KiB) Downloaded 29 times
UART-Table16(L)F18346.jpg
UART-Table16(L)F18346.jpg (575.23 KiB) Viewed 648 times
Last edited by leo73 on 20 Oct 2022 14:23, edited 1 time in total.

hexreader
Posts: 1786
Joined: 27 Jun 2010 12:07
Location: England

Re: Difficult to set UART on 16(L)F18346

#2 Post by hexreader » 20 Oct 2022 10:59

Working project attached
Attachments
Forum.zip
(37.07 KiB) Downloaded 35 times
Start every day with a smile...... (get it over with) :)

leo73
Posts: 252
Joined: 09 Jan 2014 15:45

Re: Difficult to set UART on 16(L)F18346

#3 Post by leo73 » 20 Oct 2022 14:23

hello hexreader,
Many thanks for it.
Is so complicated to program litle thinks every time i change PIC family :wink:

Post Reply

Return to “mikroC PRO for PIC General”