8 Replies Latest reply on Aug 28, 2015 9:53 AM by user_1377889

    Convert string to int in PSOC designer

    yao.chen

      Hi everyone,

         

      I try to receive some parameter through UART and convert them into int, but when I try to assign the conversion value to the internal registers, there is a error message;  I guess I missed something important about the data type, can anyone give me some suggestion?  Thank you!

         

       

         

      char * string;

         

      int parameter = 0;

         

      while(string = UART_szGetParam()) {
                         
                          for (j=0; j<4; j++)
                            UART_CPutString(" <");
                            UART_PutString(string); // Print each parameter
                            UART_CPutString(">\r\n");                 
                      }
                      
                     parameter = atoi(string);  // this is where get error message

         


      !E main.c(278): operands of = have illegal types `array 7 of char' and `int'
      !E main.c(278): lvalue required
      make: *** [obj/main.o] Error 1