Hi group,<br><br>I'm trying to create a helper function to convert a floating point number to a group of bytes<br><br>For example I have this value: 146.52000<br>I think I need it change to something like 0x01,0x04,0x06,0x05,0x02,0x00,0x00,0x00<br>
<br>The first thing I beieve I need to do is shift the decimal point to the right 5 places. So I did this<br><br> real_freq *= 100000.0<br><br>I believe this gets me 14652000<br><br>Now I think I need to do something like this to separate the individual digits<br>
<br> digits =[int(i) for i in str(real_freq)]<br><br>I'm not positive, but I think this makes an array something like<br><br>digits[0] = 1<br>digits[1] = 4<br>digits[2] = 6<br>digits[3] = 5<br>digits[4] = 2<br>digits[5] = 0<br>
digits[6] = 0<br>digits[7] = 0<br><br>Here is where I'm stuck. I've tried a few think but so far no luck. I've searched the other drivers to see if I could locate something similar. If there is, I missed it.<br>
<br>Then ultimately, I think I need to end with<br><br> return bytes<br><br>So am I on the right track? Any advice on what I need to do next.<br><br>Thanks,<br>Jim<br><br><br>