|
|
View previous topic :: View next topic |
Author |
Message |
sohailkhanonline
Joined: 06 Mar 2008 Posts: 35 Location: pakistan
|
gets help!!! |
Posted: Thu Apr 03, 2008 1:33 am |
|
|
Code: | #include <18F452.h>
#use delay(clock=20000000)
#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,stream=App,bits=8)
#use rs232(baud=9600,parity=N,xmit=PIN_B1,stream=PC,bits=8) |
i am using int_RDA for stream App but i am not successful to use it for stream PC.
if interrupt is only allowed for hardware UART. How can i get string from other stream.... |
|
|
Matro Guest
|
|
Posted: Thu Apr 03, 2008 1:39 am |
|
|
#int_RDA is an interrupt trigerred when receiving a byte.
Your PC stream hasn't a receive PIN.
So I can't understand your question.
Matro. |
|
|
Guest
|
|
Posted: Thu Apr 03, 2008 2:41 am |
|
|
i am sorry i forget to mention
Code: | #use rs232(baud=9600,parity=N,xmit=PIN_B1,rcv=PIN_B4,stream=PC,bits=8) |
|
|
|
Matro Guest
|
|
Posted: Thu Apr 03, 2008 3:05 am |
|
|
The fact is that an interrupt can't be generated if you use a "software" serial communication engine.
You have to poll it.
But personally I would have use the B4 pin for TX and B1 for RX. Because B1 is an external interrupt pin, you should have activated the corresponding interrupt and use it to detect the start condition of a new byte.
Matro. |
|
|
Audi80
Joined: 07 Sep 2007 Posts: 41
|
|
Posted: Thu Apr 03, 2008 10:27 am |
|
|
Hi there i would suggest a usage of a pic with 2 uarts if that´s what you want do you want to interrupt is anything comes from the both serial ports?? if so you can use a 18f8723 that has 2 uarts, that´s what i use for most projects and the you could do something like this:
Code: |
#include <18F8722.h>
#fuses INTRC,NOPROTECT,NOWDT
#DEVICE HIGH_INTS=TRUE
#use delay(clock=32000000)
#use rs232(baud=9600, xmit=PIN_G1,rcv=PIN_G2,ERRORS,UART2,STREAM=COM2,BRGH1OK)
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,ERRORS,UART1,STREAM=COM1,BRGH1OK)
/////////////////////////////////////////////////////////////
#INT_RDA2
void something2(){
fputc(fgetc(COM2),COM2);
}
/////////////////////////////////////////////////////////////
#INT_RDA
void something1(){
fputc(fgetc(COM1),COM1);
}
/////////////////////////////////////////////////////////////
void main() {
setup_oscillator(OSC_32MHZ);
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
enable_interrupts(INT_RDA2);
for(;;){}
}
|
Hope it helps... |
|
|
Guest
|
|
Posted: Thu Apr 03, 2008 10:39 pm |
|
|
thank you!! |
|
|
|
|
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
|