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

How can I use software RS232 get data

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



Joined: 15 Jan 2009
Posts: 8

View user's profile Send private message MSN Messenger

How can I use software RS232 get data
PostPosted: Thu Feb 12, 2009 3:12 am     Reply with quote

I want to use more RS232 to Receive & Conveyance.
I have consulted the example of CCS.
Code:
#USE RS232(BAUD=4800, XMIT=PIN_B0, RCV=PIN_B1, STREAM=COM_A)    //software Port1
#USE RS232(BAUD=4800, XMIT=PIN_B2, RCV=PIN_B3, STREAM=COM_B)      //software Port2 & a Hardware RS232  C6 C7  Pin

Total : *3 RS232 (one Hardware two Software)

Now ~

My Software RS232 can only convey and can't receive.
Code:
#int_RDA
void RDA_isr()
{
Com1_buf = getc();
printf("%c",Com1_buf);

}

while(TRUE) {
Com3_buf = fgetc(COM_A);
fprintf(COM_A,"%c",Com3_buf);   
}

Software Rs232 NO work ; Hardware 232 can use
Could you tell me how to do ?
karthickiw



Joined: 09 Aug 2007
Posts: 82
Location: TN, India

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

software RS232
PostPosted: Sun Feb 22, 2009 7:59 am     Reply with quote

hi,

#int_RDA is not working in software UART...
Ttelmah
Guest







PostPosted: Sun Feb 22, 2009 10:25 am     Reply with quote

You don't say 'what PIC'.

It is possible to use a software UART, in a 'semi interrupt' mode, by connecting the incoming serial line to a pin that has a hardware interrupt, and receiving when this triggers.
So, assuming your PIC, has the INT line on B0, if you swapped the xmit/receive definitions on your first serial, then programmed B0 to interrupt on a falling edge, you could perform a software receive in the INT_EXT interrupt handler.

_But_ you have to remember that software serials, are very restrictive. If a receive occurs, while you are transmitting on another software serial, _this transmission will be garbage_. The CCS code, can only ever handle, one software reception, _or_ one software transmission at any time. Also, the software serial, _must_ start to sample incoming data, within one half a bit time of the first falling edge. It takes typically 30+ instructions minimum to actually get 'into' an interrupt handler, and if the PIC was (for example), inside another interrupt handler, at the moment the edge arrived, this could easily increase to 100+ instructions. So the ability to do this, is _very_ dependant on your clock rate, relative to the baud rate.

A search here, will find code examples for using the software serial 'interrupt driven'.

Best Wishes
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