![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
theteaman
Joined: 04 Aug 2006 Posts: 98
|
It seems not possible to use 'stream' with #int_rda |
Posted: Sun Apr 12, 2009 1:57 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
FvM
Joined: 27 Aug 2008 Posts: 2337 Location: Germany
|
|
Posted: Sun Apr 12, 2009 2:48 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
theteaman
Joined: 04 Aug 2006 Posts: 98
|
|
Posted: Sun Apr 12, 2009 6:41 am |
|
|
FvM, replacing the getc with fgetc(stream) worked.. thanks for your help! ![Smile](images/smiles/icon_smile.gif) |
|
![](templates/subSilver/images/spacer.gif) |
|
|
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
|