PIC18F4620 RS232 CUSTOM INT

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

Moderators: Benj, Mods

Post Reply
ALAN_26
Posts: 84
Joined: Sat Apr 29, 2006 3:36 pm
Location: MALTA
Contact:

PIC18F4620 RS232 CUSTOM INT

Post by ALAN_26 »

HELLO

I'm trying to work with rs232 at the moment i managed to work connecting INT0 to the RX of the pic and trigger the interrupt
with falling the edge of the start bit , but sometimes the rs232 stops working and only restating the pic will get the rs232 to work again . so i think there must be a better way to do it

Anyone got any idea on how to make an rs232 custom interrupt for the 4620 please ?


Thanks in advance

Alan

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by Benj »

Hello Alan

The RS232 has a built in interrupt that will tell you when you have received a byte.

Create a custom interrupt with the following settings.
CustomInt.JPG
CustomInt.JPG (23.88 KiB) Viewed 6935 times
Once you have done this you may also have to call the RS232 read macro at the start of your program to ensure that any errors are cleared from the system before allowing the interrupt to run.

Inside your interrupt macro you can use the RS232 read macro to collect the byte that caused the interrupt.

ALAN_26
Posts: 84
Joined: Sat Apr 29, 2006 3:36 pm
Location: MALTA
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by ALAN_26 »

Thanks vey much Benj

I will try it tomorow and let you know

Thanks once againe

Best regards

Alan cilia

ALAN_26
Posts: 84
Joined: Sat Apr 29, 2006 3:36 pm
Location: MALTA
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by ALAN_26 »

hello Benj

The custom int works 100% tested thanks !
Just another question will the same interrupt work for other 18f MCU's ?


Alan

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by Benj »

Hello Alan

Yes the interrupt should work for pretty much any 18F or 16F device that has a hardware UART.

beckemic
Posts: 3
Joined: Tue Dec 08, 2009 11:21 am
Been thanked: 1 time
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by beckemic »

Hi!
I have the ECIO28 and ECIO40 MCU with PICs. I try to write the custom interrupt. But on the hardware it does not work. I think there is a problem in the chip setting. Can you tell me whether I should have a special chip setting? What else I can do wrong? The other Interrupts work well. Perhaps you can me tell more...
Thank you
Michaek

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by Benj »

Hello

Have you done this in your program?
You may also have to call the RS232 read macro at the start of your program to ensure that any errors are cleared from the system before allowing the interrupt to run.
If this doesnt allow the interrupt to work correctly then please can you attach your program to the forum and I will take a look for you.

beckemic
Posts: 3
Joined: Tue Dec 08, 2009 11:21 am
Been thanked: 1 time
Contact:

Re: PIC18F4620 RS232 CUSTOM INT

Post by beckemic »

Edit postDelete postReport this postReply with quote ECIO 24/40 PIC Problem with RX interrupt
by beckemic on Thu Dec 10, 2009 1:09 pm

Hi!

The Problem seems to be solved. But it only works if:
1. Before the interrupt is enabled the port must be read out.
2. The implemented RXINT does not work. It must be written as a customer interrupt:
enable code:
set_bit(intcon, GIE);
set_bit(intcon, PEIE);
set_bit(pie1, RCIE);
handler code:
if (test_bit(pir1, RCIF) && test_bit(pie1, RCIE))
{
cr_bit(pir1,RCIF);
FCM_%n();
}
Thank to the people of Matrix Multimedia for the nice help.
Bye
Michael

Post Reply