10 Replies Latest reply on Jul 20, 2013 10:03 AM by user_14586677

    PSoC 3 sprintf and integer variable problem




      Programming on PSoC Creator I went int trouble about the conversion from  float to ASCII, i searched and found this:




      I give it a try with this code:


      #include <stdio.h>
      const float PI = 3.1416;
      int n=0; byteswritten = 0;
      float x = 0;
      char str[6];

      void main()
                     while (1)
                         x= sprintf(str, "%f", PI);


      The conversion went good, have my string.... but "n" went affected, debug shows n = 12337, i tried changing the name... but no solution, its a big problem for me because i'll use "n" on next step, and it gets affected always in the cicle.