View previous topic :: View next topic |
Author |
Message |
nibu
Joined: 12 Jan 2007 Posts: 7
|
How can i implement two hw interrupt driven Serial ports |
Posted: Fri Jan 12, 2007 5:53 am |
|
|
hi
i am working with 18f8520. i am getting only one serial interrupt.
how can i use second serial interrupt simultaniously with the first |
|
![](templates/subSilver/images/spacer.gif) |
treitmey
Joined: 23 Jan 2004 Posts: 1094 Location: Appleton,WI USA
|
|
![](templates/subSilver/images/spacer.gif) |
nibu
Joined: 12 Jan 2007 Posts: 7
|
|
Posted: Mon Jan 15, 2007 2:45 am |
|
|
thank u for your replay
i am using pch v4. its .h file have both #int_rda,#int_rda2
is there any separate setting for #int_rda2 |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Jan 15, 2007 4:02 am |
|
|
Code: |
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, stream=Comm_A)
#use rs232(baud=9600, xmit=PIN_G1, rcv=PIN_G2, stream=Comm_B)
#INT_RDA
void Comm_A_handler()
{
int c;
c = fgetc(Comm_A);
...................
...................
// your code
}
#INT_RDA2
void Comm_B_handler()
{
int c;
c = fgetc(Comm_B);
...................
...................
// your code
}
|
The same criteria is applicable for the USART transmitter:
It will be mandatory to redirect the output and tell the compiler which of the USART
are you going to use:
fputc(data, Comm_A);
fputc(data, Comm_B);
fprintf (Comm_A, cstring, values...)
fprintf (Comm_B, cstring, values...)
Humberto
Last edited by Humberto on Mon Jan 15, 2007 4:35 am; edited 2 times in total |
|
![](templates/subSilver/images/spacer.gif) |
nibu
Joined: 12 Jan 2007 Posts: 7
|
|
Posted: Mon Jan 15, 2007 4:24 am |
|
|
Humberto, ...thank u for ur code example
i have used the same type of code sequence.....
but only #int_rda interrupt is getting
#int_rda2 receive interrupt is not getting
is there any additional settings for #int_rda2?????
#device High_ints=True is necessary here???? |
|
![](templates/subSilver/images/spacer.gif) |
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Mon Jan 15, 2007 4:40 am |
|
|
Quote: |
#int_rda2 receive interrupt is not getting
is there any additional settings for #int_rda2?????
#device High_ints=True is necessary here????
|
Well, without more info it will be very difficult to help you.
http://www.ccsinfo.com/forum/viewtopic.php?t=29483
Humberto |
|
![](templates/subSilver/images/spacer.gif) |
nibu
Joined: 12 Jan 2007 Posts: 7
|
|
Posted: Mon Jan 15, 2007 5:15 am |
|
|
My code
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, stream=Com1)
#use rs232(baud=9600, xmit=PIN_G1, rcv=PIN_G2, stream=Com2)
enable_interrups(int_RDA);
enable_interrupts(int_rda2);
enable_interrupts(global);
#INT_RDA
void Com1_int()
{
int c;
c = fgetc(Com1);
fputc(c,Com1);
}
#INT_RDA2
void Com2_int()
{
int c;
c = fgetc(Com2);
fputc(c,Com2);
}
but only the #int_RDA interrupt is getting
but #int_rda2 interrupt is not getting |
|
![](templates/subSilver/images/spacer.gif) |
mpfj
Joined: 09 Sep 2003 Posts: 95 Location: UK
|
|
Posted: Mon Jan 15, 2007 7:16 am |
|
|
nibu
Is it possible to post the listing file ? |
|
![](templates/subSilver/images/spacer.gif) |
nibu
Joined: 12 Jan 2007 Posts: 7
|
|
Posted: Mon Jan 29, 2007 3:52 am |
|
|
i have checked the PIE3,PIR3 register
it is working as normal
but the interrupt is not working
help me pls...!!! |
|
![](templates/subSilver/images/spacer.gif) |
nibu
Joined: 12 Jan 2007 Posts: 7
|
|
Posted: Mon Jan 29, 2007 5:30 am |
|
|
now the interrupt is working correctly
for that set interrupt priority level
Eg:#priority RDA2,rtcc ,RDA,......
NIBU |
|
![](templates/subSilver/images/spacer.gif) |
|