0
\$\begingroup\$

Hello i need help with the Remappable UART communication on pic18f45j50.

so here is my code compiled using Mikroc Pro for pic

 //Set Analog pins as digital...
 ADCON1=0X0F;
 ///////////////////////////////

 //Initialize UART2 module with Peripheral Pin Select
 Unlock_IOLOCK();
 PPS_Mapping_NoLock(0, _INPUT, _RX2_DT2);
 PPS_Mapping_NoLock(1, _OUTPUT, _TX2_CK2);
 Lock_IOLOCK();
 delay_ms(100);
 UART_Remappable_Init(9600);
 ////////////////////////////////////////////////////

 //Initialize UART1 module
 delay_ms(100);
 UART1_Init(9600);
 Delay_ms(300);
 /////////////////////////

 //Infinite Loop...
 while (1) 
 {
     if (UART_Remappable_Data_Ready()==1)
     {
     UART_Remappable_Read_Text(output, "OK", 15);
     UART_Remappable_write_Text(output);
     delay_ms(100);
     }
 }//loop ends......

connected the RP0 and RP1 to the usb-uart module. but it seems only tx is working on the microcontroller..

it means only microcontroller can send data but cannot receive data?

BTW.. RP0 and RP1 represent pin 19 and 20 resp.. which is RB0 and RB1 normally.. so is there i'm missing?

\$\endgroup\$
1
\$\begingroup\$

Set Analog pins as digital... ADCON1=0X0F;

Setting analog port pins to digital is done via the ANCONx registers, not ADCONx.

To enable digital input on RP0 you must set bit PCFG0 in register ANCON0.

BTW.. RP0 and RP1 represent pin 19 and 20 resp.. which is RB0 and RB1 normally..

Pins 19 and 20 on the PIC18F45J50 are RA0 (AN0) and RA1 (AN1).

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.