ACF Library

DisplaySMDCompValue

Back to List

Description: Convert 3- or 4 digit SMD component value to readable format

FileMaker Prototype:

Set Variable [$res; ACF_Run("DisplaySMDCompValue"; string_val;  string_Type)]

Category: MATH

Dependencies

Function source:

function DisplaySMDCompValue ( string val , string Type)
   val = trimboth(val); 
   float value; 
   string result; 
   int exp,num; 
   if ( Type != "X") then
      // 104 = 100nF
      if (Upper(Type)=="C") then
         exp =  int(right(val,1))-12;
      elseif (Upper(Type)=="I") then   
         exp =  int(right(val,1))-9;
      else
         exp =  int(right(val,1));
      end if
      num= left(val, length(val)-1); 
      value = num*10^exp; 
   else 
      value = float(val); 
   end if
   
   case
      :(Type == "C")
         result = DisplayEngSciFormat ( Format("%E",value), "EK", "F"); 
      :(Type == "R")
         result = DisplayEngSciFormat ( Format("%E",value), "EK", "Ohm"); 
      :(Type == "I")
         result = DisplayEngSciFormat ( Format("%E",value), "EK", "H"); 
      default
         result = DisplayEngSciFormat ( Format("%E",value), "EK", ""); 
   end case
   return result; 
end

The DisplaySMDCompValue function converts a 3- or 4-digit SMD (Surface-Mount Device) component value into a human-readable format using SI units. This function helps to interpret standard resistor, capacitor, and inductor values from their coded representation.

Parameters:

  • value: A string representing a 3- or 4-digit SMD code. Using a string ensures that leading zeros are preserved.
  • type: A character that specifies the component type:
    • R for Resistors
    • C for Capacitors
    • I for Inductors

Example Usage:

  1. For Resistors: R-SMD-4-7-kilo-ohm
  Set Variable [$res; ACF_Run("DisplaySMDCompValue"; "472";  "R")]
  => "4.7 KOhm"
  1. For Capacitors:

    Set Variable [$res; ACF_Run("DisplaySMDCompValue"; "473";  "C")]
    => "47 nF"
  2. For Inductors:

    Set Variable [$res; ACF_Run("DisplaySMDCompValue"; "472";  "I")]
    => "4.7 µH"

Conclusion

This function streamlines the conversion of SMD component values into a format that is easier to read and understand, supporting various electronic components while ensuring proper SI unit representation.

Back to List