RX2 INT not working PIC18F26K22[Resolved]

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

RX2 INT not working PIC18F26K22[Resolved]

Post by AbhijitR »

Hello! Martin
medelec35 wrote: If RXINT0 is used before UART Initilise, then RX interrupt will not work.
May I request you to point out where can I possibly go wrong?

Let me brief quickly, I am using PIC18F26K22, 16Mhz external crystal, UART on channel 2 (Tx-B.6, Rx-B.7), rest all the settings like your example, I am using the channel 1 UART for MODBUS Slave.

I am communicating with NEXTION display, I am able to send the command from PIC to Nextion well but not able to receive the command from Nextion, in the past (maybe Sep 2019) I was able to communicate both ways only the difference is I used PIC18F46K22

I first did the same mistake of placing the Initialize after RXINT0, then I corrected like you but still no success, I am only able to communicate one way. Is there any method to check if the Interrupt is working or not?

Thank you, hear you soon.

Abhi

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello! Martin and Ben

Following my previous post I have checked/observed that channel 1 of PIC18F26K22 works well, i.e. transmit and receive and when I change to channel 2 (hardware as well software) only transmit (from PIC to NEXTION display) works correct receiving from display do not work.

Unfortunately I am not able to change the channel from 2 to 1 for UART as I am using channel 1 for MODBUS Slave and the hardware is ready.

NOTE: the Tx and Rx pins of channel 2 are for PGC and PGD respectively, could this be the issue, I don't know!

Any idea where are things going wrong, please advise.

Abhi

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: RX2 INT not working PIC18F26K22

Post by medelec35 »

What I do to check if interrupt is working or not is to add a calculation box within interrupt.
Within calculation box add something like

Code: Select all

InterruptTriggered = InterruptTriggered + 1
using a global variable.
Then keep send to value via UART or a display every second.
If value stays at 0 you know interrupt is not being triggered.
Martin

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello! Martin

Many thanks for the answer,
medelec35 wrote:What I do to check if interrupt is working or not is to add a calculation box within interrupt.
Within calculation box add something like

Code: Select all

InterruptTriggered = InterruptTriggered + 1
using a global variable.

Then keep send to value via UART or a display every second.
If value stays at 0 you know interrupt is not being triggered.
I did as you suggested about adding the variable and it works perfect for channel 1 but as I said previously channel 2 only one way communication from PIC to display nothing comes from display so the variable do not increment, any idea what is going wrong.

Abhi

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: RX2 INT not working PIC18F26K22

Post by medelec35 »

Sorry i was answering
AbhijitR wrote:Is there any method to check if the Interrupt is working or not?

Thank you, hear you soon.

Abhi
It would help if you can upload flowchart.
Martin

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello! Martin
good morning
medelec35 wrote:Sorry i was answering
Please don't say so, to be honest with you it is only forum for the moment where I interact with someone in this difficult time, so feel happy to receive. :)

As you said attached is the chart, I will quickly brief,

1) channel 1 works correct both ways, PIC <--> Nextion, also the variable "Int_Rec_Check" increment correct and the LED A2 flash
2) channel 2 works only one way, PIC --> Nextion, the variable do not increment as nothing is receiving

I also tried the software option for channel 2 but without success.

If I assume the Rx pin of channel 2 is damaged so do not receive the data from Nextion, but then the data transfer I mean the *.hex file would not be loaded in the chip, isn't it? but the loading or transfer works correct. Or do you think I am making some mistake in the parameters setting.

Thank you.

Abhi
Attachments
Nextion_28Pin_06-04-2020_Martin.fcfx
(20.02 KiB) Downloaded 168 times

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello!

Following my last post regarding the UART on channel 2 for PIC18F26K22, I somehow managed to get the spare new chip from my office and tested again (assuming that my previous chip was faulty) but the results are the same like mentioned before, communication is one way only, from PIC to Nextion display, on contrary channel 1 works correct. For this project I need to use both the UART so I am trying to find the answer.

May I request if someone could help me on that, did anyone had the same problem before, or am I doing any mistake in parameters setting.

Thank you.

Abhi

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: RX2 INT not working PIC18F26K22

Post by medelec35 »

Latest flowchart you uploaded only has channel 1.
Can you post the flowchart that i not working with channel 2 and I will see if I can spot something?
Martin

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by chipfryer27 »

Hi Abhi

I don't have your chip but I do have it's big brother the 18F46K22. Whilst your chip has the second UART on Port B, mine has is on Port D. Other than that the differences don't matter for testing the ports.

I created a small test program which I have attached.

I'm using a Combo Board which has an LCD and various input/outputs and I have added two UARTS on channels 1 and 2.

In my test I initialise everything then print a message on the LCD

Line 0: Rx1 Test
Line 1: Rx2 Test

It waits for 5 seconds then clears, before enabling the RXINT interrupts and goes into a loop waiting for some Receive action.

If it receives on channel 1 then it displays the character on Line 0 and illuminates an LED on Port A1
If it receives on channel 2 then it displays the character on Line 1 and illiminates an LED on Port A2

(note the LEDs are to establish if the Macros are ever called and won't switch off if triggered).

This works fine on my hardware, tested with a Terminal program(s) linked to the chip itself. I'm using the latest FC8 and files. It may be worth checking you are too as a few days ago I had issues with RXINT which I suspect were due to an incomplete update (didn't notice it hadn't completed).

Hope this helps.

Regards
Attachments
UART_Test.fcfx
(16.19 KiB) Downloaded 155 times

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello! Martin
medelec35 wrote: Can you post the flowchart that i not working with channel 2 and I will see if I can spot something?
I have changed the properties of UART1 to channel 2 (RB6 and RB7) in the attached chart, in the same chart if I change the properties to channel 1 (RC6 and RC7) it works correct. I do not understand what is the problem to receive in channel 2.

Thank you.

Abhi
Attachments
Nextion_28Pin_09-04-2020_Martin.fcfx
(20.01 KiB) Downloaded 155 times

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by chipfryer27 »

Abhi

In the program above you have the UART on Channel 2 but your Interrupt is set for Channel 1 (RXINT0) instead of 2 (RXINT1). Your Macro won't get called.

Regards

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hello! Chipfryer
chipfryer27 wrote: I don't have your chip but I do have it's big brother the 18F46K22.
Thank you for the post, fortunately even I have the big brother, I will check if it is with me (at home) or in the office. If I have not mistaken I have tried to use both the UART on the chip 18F46K22 in the past, one for RS232 and another for MODBUS Slave (same like this 26K22) and both works well, but I think there is some problem with 18F26K22 chip's channel 2 when it comes to receive, transmit works correct.

Any ways I will check the availability and give a try to make sure 46K22 works correct, I shall keep you posted.

Thank you.

Abhi

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

chipfryer27 wrote: UART on Channel 2 but your Interrupt is set for Channel 1 (RXINT0) instead of 2 (RXINT1).
Chipfryer my friend, you spot the problem, and how foolish of me, humbly thank you for correcting my mistake, cheers....

Thank you again.

Abhi

chipfryer27
Valued Contributor
Valued Contributor
Posts: 617
Joined: Fri Jun 06, 2014 3:53 pm
Has thanked: 184 times
Been thanked: 195 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by chipfryer27 »

Hi Abhi

Very easy to overlook. Numerous times I've not "seen what's in front of my nose" :)

Glad to hear it's working.

Regards

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: RX2 INT not working PIC18F26K22

Post by medelec35 »

Hi Abhi,
I have split & & created a new topic as it was not RX of 16F1825 you had an issue with.
Martin

User avatar
AbhijitR
Posts: 298
Joined: Fri Nov 07, 2014 12:48 pm
Location: Pune, India
Has thanked: 279 times
Been thanked: 78 times
Contact:

Re: RX2 INT not working PIC18F26K22

Post by AbhijitR »

Hi! Martin

Thanks for the efforts, finally solved, cheers....

Abhi

Post Reply