Page 1 of 1

PIC18F26K22 Not reading data UART [SOLVED]

Posted: Mon Aug 23, 2021 1:48 pm
by celebriums
Hi

Love and respect from Istanbul to everyone. :D

When communicating with UART; I can send data but not read data.
Can you help me please?

Re: PIC18F26K22 Not reading data UART

Posted: Tue Aug 24, 2021 7:53 am
by medelec35
Hi Sadık,
For reliable UART RX communication, You will be best using UART RXINT0 interrupt.
You can then place the UART ReceieveString with the interrupt call macro.

Re: PIC18F26K22 Not reading data UART

Posted: Tue Aug 24, 2021 8:03 am
by stefan.erni
Hi Sadık

Check the length of Your STR_Receive it's just 80 but You wait for 100Bytes.
Change the waiting time.
In the loop use a delay (1mSec)
Use a text to display in the decision under yes, like "receive ok" then You know reciving ist ok but the ASCII are bad.

Try to use what Martin told an IRQ is always the best way.

regards

Stefan

Re: PIC18F26K22 Not reading data UART

Posted: Tue Aug 24, 2021 11:24 am
by celebriums
Thank you for the replies.
@stefan.erni
@medelec35

But I tried everything you said. The result has not changed.

I have set the Led to stay on if any data comes in.

I can see incoming and outgoing data via UART to USB converter. But the PIC cannot see any of these data.

Pictures of incoming and outgoing data to PIC from ESP8266 are attached.

In addition, if I choose the configuration of the UART module as software instead of channel 1, a compilation error occurs.

Data sent by ESP to PIC
Data sent by ESP to PIC. .png
Data sent by ESP to PIC. .png (184.06 KiB) Viewed 4142 times
outgoing data from PIC (Data from PIC to ESP )
outgoing data from PIC (Data from PIC to ESP ) .png
outgoing data from PIC (Data from PIC to ESP ) .png (72.91 KiB) Viewed 4142 times

Re: PIC18F26K22 Not reading data UART

Posted: Wed Aug 25, 2021 12:37 pm
by stefan.erni
Hi Sadık

I compiled your program and the error was like this
(103) #error: "Software UART Baud Rate Not Available At This Clock Speed" ^


So if I go down with the Baudrate to 19200 I can compile with softwaremode uart.

Try if its working to receive some byte.


regards

Re: PIC18F26K22 Not reading data UART

Posted: Fri Sep 17, 2021 8:10 am
by celebriums
Hello dear friends...
Hello flowcode family
Everybody greeatings from istanbul

I found the error about the software. Since the B5 pin is 0, communication reading stops.
Once I did the B5, all settings went back to normal.
Thank you to all those who showed interest, replied and read.