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

#INT_RDA with two Stream Serial Ports

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



Joined: 17 Nov 2004
Posts: 26
Location: University of Cantabria -SPAIN

View user's profile Send private message Send e-mail MSN Messenger

#INT_RDA with two Stream Serial Ports
PostPosted: Fri Jan 14, 2005 11:21 am     Reply with quote

I would like ask to you the next question,

If I'm using two serial ports as,

#use rs232(STREAM=BT_id, baud=9600,parity=N,xmit=BT_TX,rcv=BT_RX,bits=8,FORCE_SW,ERRORS)

#use rs232(STREAM= HOST_id, baud=9600,parity=N,xmit=HOST_TX,rcv=HOST_RX,bits=8,ERRORS)

If I want to detect incoming bytes by using interrupt #INT_RDA...

Each byte incoming over the two diferent Rcv ports are reading ???

#INT_RDA
void Read_Serial{
if kbhit(BT_id)
Rx=fgetc(BT_id);
if kbhit(HOST_id)
Rx=fgetc(HOST_id);
}


Is this correct???

thanks in advance
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

#INT_RDA
PostPosted: Fri Jan 14, 2005 11:39 am     Reply with quote

#INT_RDA is the receive interrupt from the hardware UART so it only works when you use the UART and only for that one RS232 stream.

If you specify the UART TX/RX I/O pins but use the FORCE_SW parameter then the UART again will not be used and the INT_RDA won't work.
Humberto



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

View user's profile Send private message

PostPosted: Fri Jan 14, 2005 11:57 am     Reply with quote

bertronicom wrote:

Quote:

If I want to detect incoming bytes by using interrupt #INT_RDA...


Assuming you are using a microcontroller with single UART, #INT_RDA applies only for
receiving characters in the corresponding UART receiver pin. The dedicated Rx pin
of the hardware UART.

Quote:

#use rs232(STREAM=BT_id, baud=9600,parity=N,xmit=BT_TX,rcv=BT_RX,bits=8,FORCE_SW,ERRORS

#use rs232(STREAM= HOST_id, baud=9600,parity=N,xmit=HOST_TX,rcv=HOST_RX,bits=8,ERRORS)


In this directives we donīt know the corresponding PINīs for BT_RX and HOST_RX
so we canīt tell you what is the valid stream that will trigger #INT_RDA.

Unless you specify another parameters, by default the compiler set
8 Data Bits, No Parity, 1 STOP Bit (8N1).
ERRORS apply only using hardaware UART.

Hope this help. Very Happy

Humberto
bertronicom



Joined: 17 Nov 2004
Posts: 26
Location: University of Cantabria -SPAIN

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Jan 14, 2005 12:58 pm     Reply with quote

Sorry, I forget to add more details

BT_id stream is conected to hardware UART (Rx and Tx pins)
HOST_id stream is conected to general purpose I/O pins.

I'm using PIC18LF252 with only one UART.

Then I' going to do getc(BT_id) in ISR because this is hardware UART

Thanks a lot
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Jan 14, 2005 1:09 pm     Reply with quote

bertronicom wrote:
Sorry, I forget to add more details

BT_id stream is conected to hardware UART (Rx and Tx pins)
HOST_id stream is conected to general purpose I/O pins.

I'm using PIC18LF252 with only one UART.

Then I' going to do getc(BT_id) in ISR because this is hardware UART

Thanks a lot


You specified force_sw in your #use rs232 for BT_id so you probably aren't going to get an interrupt.
dyeatman



Joined: 06 Sep 2003
Posts: 1923
Location: Norman, OK

View user's profile Send private message

Remove FORCE_SW
PostPosted: Fri Jan 14, 2005 1:11 pm     Reply with quote

As I said above you CANNOT include the FORCE_SW parameter if you are going to use the hardware UART. That parameter must be removed from the BT_id RS232 stream definition.
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