CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

How can i implement two hw interrupt driven Serial ports

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

How can i implement two hw interrupt driven Serial ports
PostPosted: Fri Jan 12, 2007 5:53 am     Reply with quote

hi

i am working with 18f8520. i am getting only one serial interrupt.

how can i use second serial interrupt simultaniously with the first
treitmey



Joined: 23 Jan 2004
Posts: 1094
Location: Appleton,WI USA

View user's profile Send private message Visit poster's website

PostPosted: Fri Jan 12, 2007 8:42 am     Reply with quote

http://www.ccsinfo.com/forum/viewtopic.php?t=18538&highlight=two+intrda
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jan 15, 2007 2:45 am     Reply with quote

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
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jan 15, 2007 4:02 am     Reply with quote

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
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jan 15, 2007 4:24 am     Reply with quote

Humberto, ...thank u for ur code example Smile

i have used the same type of code sequence.....
but only #int_rda interrupt is getting Sad
#int_rda2 receive interrupt is not getting
is there any additional settings for #int_rda2?????
#device High_ints=True is necessary here????
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Mon Jan 15, 2007 4:40 am     Reply with quote

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
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jan 15, 2007 5:15 am     Reply with quote

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
mpfj



Joined: 09 Sep 2003
Posts: 95
Location: UK

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Mon Jan 15, 2007 7:16 am     Reply with quote

nibu

Is it possible to post the listing file ?
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jan 29, 2007 3:52 am     Reply with quote

i have checked the PIE3,PIR3 register
it is working as normal
but the interrupt is not working
help me pls...!!!
nibu



Joined: 12 Jan 2007
Posts: 7

View user's profile Send private message

PostPosted: Mon Jan 29, 2007 5:30 am     Reply with quote

now the interrupt is working correctly
for that set interrupt priority level

Eg:#priority RDA2,rtcc ,RDA,......

NIBU
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group