|
|
View previous topic :: View next topic |
Author |
Message |
pilar
Joined: 30 Jan 2008 Posts: 197
|
Is possible to have several #INT_RDA of different STREAM? |
Posted: Wed Sep 30, 2009 8:32 am |
|
|
Hi, I am using the PIC18F452 and I need to capture the strings of three peripherals, they have different speeds (KB) and number of characters, I am taking this example like reference, where is implemented 2 UARTS by software, I doubt it, I can get different interruption (#INT_RDA)?
Code: | #USE RS232(BAUD=9600, XMIT=PIN_B0, RCV=PIN_B1, STREAM=COM_A)
#USE RS232(BAUD=9600, XMIT=PIN_B2, RCV=PIN_B3, STREAM=COM_B)
#INT_RDA (COM_A)
.
.
.
#INT_RDA (COM_B)
.
.
.
main() {
char c;
fprintf(COM_A,"Online\n\r");
fprintf(COM_B,"Online\n\r");
while(TRUE) {
c = fgetc(COM_A);
fputc(c, COM_A); fputc(c, COM_B);
}
} |
|
|
|
Ttelmah Guest
|
|
Posted: Wed Sep 30, 2009 8:45 am |
|
|
INT_RDA, is a _hardware_ feature, for the hardware UART.
If you choose a chip that has multiple hardware UARTs, then you get INT_RDA, and INT_RDA2. On a chip like yours, with only one hardware UART, you can only have one INT_RDA.
For the software UART, you don't get an INT_RDA (INT_RDA, says there is a character waiting in the hardware buffer - software UART, no hardware buffer....).
You can use the interrupt input line(s), and program an interrupt on this/these falling, to say that the 'start' bit has arrived on a particular serial line, (search here many examples posted in the past) _but_ while receiving this, you _will_ miss anything happening on other lines.
The alternative is to use external hardware UARTs, with buffers, and use these to interrupt the main chip.
Best Wishes |
|
|
|
|
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
|