strncmp and uart

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
kang99
Posts: 46
Joined: 25 Mar 2011 15:52

strncmp and uart

#1 Post by kang99 » 13 May 2011 07:38

hi, I'm not working the command "strncmp" on string assembled from RS232, I do not recognize the string "get"

Code: Select all

void interrupt()
     {
     if (PIR1.RCIF == 1)
             {
             PIR1.RCIF = 0 ;
             uart_rd = UART1_Read();
             if (uart_rd == 13)
                   {
                   PORTB.B4 = ~PORTB.B4 ;                    //activity 1 green ok
                   if (strncmp(testo,"get",3) == 0)
                          {
                          PORTB.B6 = ~PORTB.B6 ;             //activity 2 yellow kkkko!
                          }
                   }
                   else
                   {
                   testo[puntatore] = uart_rd ; puntatore++ ;        //accumula input da key computer
                   }
             }
      }
I created two tests to monitor the operational, in the first passes when I do "Enter" in the second never why ?

drdoug
Posts: 1074
Joined: 16 Aug 2007 03:49
Location: St. Louis, MO

Re: strncmp and uart

#2 Post by drdoug » 13 May 2011 13:03

I think we might need to see more code.
Also, can you explain again the problem?

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

Re: strncmp and uart

#3 Post by Mince-n-Tatties » 16 May 2011 08:55

you will have to look at your array testo to see if it holds the string as you expect.
Best Regards

Mince

Post Reply

Return to “mikroC PRO for PIC General”