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 CCS Technical Support

It seems not possible to use 'stream' with #int_rda

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



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

It seems not possible to use 'stream' with #int_rda
PostPosted: Sun Apr 12, 2009 1:57 am     Reply with quote

Hi,

It seems that including a stream identifier in a use rs232, such as
Code:

#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7, PARITY=N, STREAM=B1)

causes a serial hardware interrupt to never be triggered. Removing the stream identifier, makes everything work! Eg.
Code:

#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7, PARITY=N)

The stream identifier is not currently used in any way so it cannot be causing the code to fail somehow.. can anyone explain a way around this? Below is the code:

Code:

#use rs232(baud=38400, xmit=PIN_C0, PARITY=N, STREAM=B2)
#use rs232(baud=38400, xmit=PIN_C6, rcv=PIN_C7, PARITY=N)

#INT_RDA
void rda_isr(void)
{
      unsigned char c = getc();
      if(c=='a') output_high(PIN_B7);
}

void main(void)
{
   enable_interrupts(global);
   enable_interrupts(int_rda);

   set_tris_b(0);
   set_tris_c(0b10000000);

        while(1);
}


As stated above, removing the 'stream=b2' makes everything work with the interrupt being called properly. Any help appreciated, thanks.
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Sun Apr 12, 2009 2:48 am     Reply with quote

Unfortunately, you didn't either mention a chip or a compiler version.

Generally, when you use a stream identifier with the hardware UART, also the ISR getch() must be changed to fgetc(). Did you?

To save us further guesses, please give a complete (minimal) code example of the non-working stream version.
theteaman



Joined: 04 Aug 2006
Posts: 98

View user's profile Send private message

PostPosted: Sun Apr 12, 2009 6:41 am     Reply with quote

FvM, replacing the getc with fgetc(stream) worked.. thanks for your help! Smile
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