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

Please Help me about RS232

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







Please Help me about RS232
PostPosted: Fri Dec 19, 2003 12:38 am     Reply with quote

How i get String from RS232 in interrupt --> #int_RDA. When i write this code it receive one char but i want whole string.
Please example code. I must do it as soon as i can. Please help me......
example: i sent Data from terminal ----> "This is DATA"
but i receive T only one char
Please help me...

#int_RDA
void RDA_isr()
{
char string1[20],string2;
char Data;
int c ;
get_string(string1,20);

strcpy(string2,string1);
printf("%S",string2);

}
Kieran



Joined: 28 Nov 2003
Posts: 39
Location: Essex UK

View user's profile Send private message

PostPosted: Fri Dec 19, 2003 3:38 am     Reply with quote

Every char in the incomming string will cause an interrupt. You need to store each one in a buffer. See the CCS example Ex_sisr.c
Define the strings globally no locally as in the example.
joe
Guest







strings
PostPosted: Fri Dec 19, 2003 10:25 am     Reply with quote

give this a try.... it worked well for me.

Code:
char input_string[5] = {0};         // global variable [5] was the width i needed, it [] could be anything
int news=0;                         // i used it to test if if the string i was reading
                                    // was the newest string recieved

#INT_RDA                            // recieve data interupt    
isr_rda()
{                                   // when data is detected on the rx pin this
     restart_wdt();                 // function clears the watchdog timer and
     gets(input_string);            // pulls the characters off UNTIL it gets
     news = 1;                      // a carrage return <0x0D>. 
     return;                        // it then stores it in a global variable.
}

// good luck!
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