caramoan tour package

caramoan tour package

Author Topic: Help about this code on UART receiving string..  (Read 141 times)

Offline carlsfootprints

  • Lead Acid Battery
  • *******
  • Posts: 629
  • Pogi/Ganda Points: 25
Help about this code on UART receiving string..
« on: January 16, 2011, 08:05:10 PM »
mga sirs :)

di ko po magets ung function na ito..
galing din po ito dito sa thread ng elab..

Quote
unsigned char *ser_gets(void)
{
   unsigned char s[16];
   unsigned char index = 0x00;    

   while(rxoptr!=rxiptr)
   {
      s[index] = ser_getch();
      index++;
   }
   
    while(1)

   return s;
}


eto po ung questions ko: (andami);D

1. tanong ko po ung  * ser_gets.. ibig sabihin po ba eh pointer ito?
2. tama po bang idagdag ko ito sa circular fifo serial routine ni sir zer0w1ng.
3. tapos pano po ko maitatransmit ulit ung string na nareceive? di ko kasi alam kung pano ko maiiistore ung received string tapos send ulit.. nagbasa ako about malloc() kaso di ko alam kung tama ba na un ang gamitin ko.. hehe.. hitech C compler ang gamit ko..

maraming salamat po  :)
never saturate..

Philippine Electronics Forum

Help about this code on UART receiving string..
« on: January 16, 2011, 08:05:10 PM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3032
  • Pogi/Ganda Points: 208
Re: Help about this code on UART receiving string..
« Reply #1 on: January 17, 2011, 10:23:06 AM »
Have you tested if its working? 

I dont think it will work  ....  when the function returns, it will return the address of the variable s but the contents of s would no longer be there.  If you declare s to be a variable in main or as a global variable, then it should work.

Philippine Electronics Forum

Re: Help about this code on UART receiving string..
« Reply #1 on: January 17, 2011, 10:23:06 AM »

 

Privacy Policy

Contact Us: elabph@yahoo.com