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
PIC18F4620 RS232 CUSTOM INT
- 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
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.
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.
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC18F4620 RS232 CUSTOM INT
Thanks vey much Benj
I will try it tomorow and let you know
Thanks once againe
Best regards
Alan cilia
I will try it tomorow and let you know
Thanks once againe
Best regards
Alan cilia
Re: PIC18F4620 RS232 CUSTOM INT
hello Benj
The custom int works 100% tested thanks !
Just another question will the same interrupt work for other 18f MCU's ?
Alan
The custom int works 100% tested thanks !
Just another question will the same interrupt work for other 18f MCU's ?
Alan
- 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
Hello Alan
Yes the interrupt should work for pretty much any 18F or 16F device that has a hardware UART.
Yes the interrupt should work for pretty much any 18F or 16F device that has a hardware UART.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC18F4620 RS232 CUSTOM INT
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
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
- 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
Hello
Have you done this in your program?
Have you done this in your program?
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.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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: PIC18F4620 RS232 CUSTOM INT
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
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