PIC18F26K22 Not reading data UART [SOLVED]

Moderator: Benj

Post Reply
User avatar
celebriums
Posts: 125
Joined: Sun Sep 25, 2016 3:50 pm
Has thanked: 71 times
Been thanked: 33 times
Contact:

PIC18F26K22 Not reading data UART [SOLVED]

Post 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?
Attachments
PIC_WIFI_V1 only wifi.fcfx
(21.09 KiB) Downloaded 117 times
Last edited by celebriums on Tue Sep 21, 2021 9:26 am, edited 1 time in total.
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: PIC18F26K22 Not reading data UART

Post 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.
Martin

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC18F26K22 Not reading data UART

Post 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

User avatar
celebriums
Posts: 125
Joined: Sun Sep 25, 2016 3:50 pm
Has thanked: 71 times
Been thanked: 33 times
Contact:

Re: PIC18F26K22 Not reading data UART

Post 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 3725 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 3725 times
Attachments
PIC_WIFI_V2 only wifi.fcfx
(22.44 KiB) Downloaded 115 times
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

stefan.erni
Valued Contributor
Valued Contributor
Posts: 654
Joined: Fri Aug 19, 2016 2:09 pm
Location: switzerland
Has thanked: 182 times
Been thanked: 179 times
Contact:

Re: PIC18F26K22 Not reading data UART

Post 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

User avatar
celebriums
Posts: 125
Joined: Sun Sep 25, 2016 3:50 pm
Has thanked: 71 times
Been thanked: 33 times
Contact:

Re: PIC18F26K22 Not reading data UART

Post 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.
Sincerely Regards
Sadık SUME

www.kaandesign.com.tr

Post Reply