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
Posted: Fri Dec 19, 2003 3:38 am
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
Posted: Fri Dec 19, 2003 10:25 am
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.
}
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