Home AMX User Forum NetLinx Studio

Proper Use of FLOAT


I am working on a project in which I am monitoring analog to digital convertors. The convertor resolution is 12-bit (4,095 possible values).

In the process of calculation, I need to arrive at a decimal value less than one. I always thought that this would be the place for a FLOAT variable.


Removing the /4095 will return a 12-bit range integer value for fVOLTS, but trying to divide that value by 4095 gives zero. I am observing the zero value in debug as well as with an FTOA sent to a touchpanel.

Any help appreciated. Thank you.


  • Options
    dchristodchristo Posts: 177
    If you change your array cTrans_Message to be a Float it will work as expected.

  • Options
    TurnipTruckTurnipTruck Posts: 1,485
    Thank you. Worked like a champ.

    Is there an easy way to truncate a FLOAT value down to a pre-determined number of decimal places?

    I need not display beyond .xx for my purposes.

  • Options
    GSLogicGSLogic Posts: 562
    Did you try the FORMAT command?

    FORMAT('%-5.2f',123.234) '123.23'

    Check the Netlinx Keyword Help: Index - FORMAT
Sign In or Register to comment.