5 Replies Latest reply on Sep 29, 2016 12:26 AM by userc_38927

    Sending floats across SPI



      I have used some sample code to send a float across an SPI connection. To reconstruct the float from a buffer I have used a union.


          float floatx;
          int8 b[4];    
          } x;


      x.b[0] = rxBuffer[4];
      x.b[1] = rxBuffer[3];
      x.b[2] = rxBuffer[2];
      x.b[3] = rxBuffer[1];


      but when I compare the value sent to the value of x  (x.floatx == -9.9999) they aren't the same even thought the bytes printed on the LCD look correct (in hex). Have I done this correctly?