binary - Difficulty coverting unsigned int16 and unsigned int32 in javascript -
i'm working api sends data in series of base64 strings i'm converting array of bytes. i'm been able parse time values sent in data (year, day, hour etc. api lists datatype unsigned char). i'm using parseint(..., 2) in javascript.
the difficulty i'm having converting signed int32 , unsigned int16 decimal values. example, these bit stings voltage , power:
voltage (unsigned int16 ) 01101010 00001001 - should around 120.0 power (signed int32) 10101010 00010110 00000000 00000000 - should 0-10 kwh
does know how can convert these values? also, wrote simple function convert base64 array of bytes i'm pretty sure correct, above values don't make sense maybe isn't. if that's case, know of plugin converts base64 binary.
thanks, tristan
i can't see how 0110101000001001 converts 120... it's either 27415 or 2410 depending on endianness
Comments
Post a Comment