Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


<LIBRARYFILE Name="RF Controller">
     <LIBRARY Name="RF_Controller">
          <STRUCTURE Name="PID_Gain_Struct">
               <FLOAT Name="f_Kc"/>
               <FLOAT Name="f_Ti"/>
               <FLOAT Name="f_Td"/>
          </STRUCTURE> 
      <STRUCTURE Name="RF_Controller_Struct">
              <FLOAT Name="f_State"/>
              <FLOAT Name="f_SetPoint"/>
              <FLOAT Name="f_Temperature"/>
              <FLOAT Name="f_FanSpeed"/>
              <BOOL Name="b_EStop"/>
              <Structure Name="PID_Gains" Data="PID_Gain_Struct">
                   </Structure>
       </STRUCTURE>
       <STRUCTURE Name="Ports">
              < BOOL <BOOL Name="b_InUse"/>
              <U8 Name="f_Status"/>
              <FLOAT Name="f_PortActivity"/>
              <STRUCTURE Name="Port_Details">
                   <U32 Name="f_Errors"/>
                   <U16 Name="f_Resends"/>
                   <U16 Name="f_Failures"/>
               </STRUCTURE>
          </STRUCTURE>
     </LIBRARY>
</LIBRARYFILE>

...

Each variable type allowed in the structure definition maps to a variable type in a Design Pad schema:

Structure type

Schema type

BOOL

Boolean

FLOAT

Float

U8

Float

U16

Float

U32

Float

 

Note: The U32 data type cannot be translated to/from a FLOAT data type with complete accuracy unless the value is an integer between 0 and 16,777,216.  FLOAT values, while having a large range, also have a limited precision of 23 bits.  As a result numbers above this value will not resolve into an exact FLOAT value.  For example, 16,777,216 or 16,777,217 when converted to FLOAT both resolve to the same number, 16,777,216.  Literally, the number 16,777,217 does not exist in FLOAT as it cannot be represent by its limited precision.  As the number increases towards the limit of a U32 (4,294,967,295) the quantity of "missing" values numbers will increase and the gaps between numbers that a FLOAT can represent will become wider.  Apply both caution and logic to how you utilize U32 values.

Structures Overview Image Added Image Modified