When creating a user-defined PID, you define the data that is sent to the vehicle. This is an advanced feature that requires knowledge of the OBD2 standard, and you are fully responsible for any and all consequences.
When creating a user-defined PID, you must enter the following information.
Use this value to configure the vehicle module to which you want to direct the request. You can enter an acronym such as ECM, TCM, ABS, SRS, or ALL, or you can enter the address of the module (e.g. 7E0). When you enter ECM, TCM, ABS, or SRS, physical addressing is used and the address of the module is determined based on typical addressing used by vehicle manufacturers. However, not all manufacturers address modules the same way, so this is not guaranteed to address the correct module. When you enter ALL, functional addressing is used, which sends the request to all modules that respond to functional addressed requests. Typically, only OBD2 compliant modules will respond to a functional request, and they will only respond when the OBD mode is one of the legislated OBD2 modes (e.g. Mode 01).
Use this value to set the mode byte that is sent with the request. This value is a single byte in hexadecimal format. Typical values are 01, 21 and 22.
Use this value to set the number of the PID that is sent with the request. This value can be one or more bytes in hexadecimal format. For mode 01 PIDs, this value should be a single byte (e.g. 04). For mode 22 PIDs, this value is typically two bytes (e.g. 0200).
Use this value to configure how often the PID is read from the vehicle, related to other PIDs. PIDs whose value changes often can be given a high priority, which PIDs whose value does not change very often can be given a lower priority.
Use this value to set the Metric unit name.
Use this value to set the English unit name.
Min Value/Max Value
Use the min and max values to set the typical range for the PID. These values are used to pre-configure items in the software, such as the range of a dashboard gauge.
Metric to English Scale Factor/Offset
User-defined PIDs are always evaluated in Metric units. Use the Scale Factor and Offset to define the conversion from Metric to English units, when English units are configured in the app Preferences. The Scale Factor and Offset are used as follows
English Value = (Metric Value * Scale Factor) + Offset
The equation is used to convert the raw data from the vehicle into a numeric value. The equation can also be used to combine other SAE PIDs by using the readSaePid function. The format of the equation is described in detail below.
OBD Data Tokens
OBD data tokens are reserved letters that represent data bytes returned from the vehicle. Valid values are A-Z, AA-AZ, which represents data indexes 0 – 51 of the data bytes returned from the vehicle. For example, the token A will be replaced by the first byte of data returned from the vehicle. Token B will be replaced with the second byte of data returned from the vehicle, and so on.
|Token||Vehicle Data Index|
The following mathematical operators are available. Operators with a higher precedence value will be evaluated before operators with a lower precedence. Parentheses can be used to group operations.
|^||Exponent||4||2 ^ 3 = 8|
|*||Multiply||3||3 * 5 = 15|
|/||Divide||3||10 / 2 = 5|
|+||Add||2||2 + 7 = 9|
|–||Subtract||2||8 – 4 = 4|
|:||GetBit by bit number||1||5:2 = 1 (bit 2 is set)
5:1 = 0 (bit 1 is not set)
5:0 = 1 (bit 0 is set)
All data types are implicit and are not declared. Double floating-point calculations are performed when evaluating each equation and the result of each equation is always a double. Functions (as described below) have implicit data types.
The following functions are built into the language and can be used to manipulate data. Also, functions are available to access other PIDs. Note that function names are currently case in-sensitive.
|int16||double int16([int16] value)||Casts the input value to a signed 16-bit integer and returns the result.||int16(4080) = 4080
int16(65535) = -1
|int32||double int32([int132] value)||Casts the input value to a signed 32-bit integer and returns the result.||int32(65535) = 65535
int32(4294967295) = -1
|signed||double signed([byte] value)||Casts the input value to a signed 8-bit integer and returns the result.||signed(10) = 10
signed(255) = -1
|readSaePid||double readSaePid([string] pidID)||Reads the value of another SAE PID based on its unique ID. Used to create PIDs that are combinations of other PIDs. See note (1)||readSaePid(0C) = EngineRPM
readSaePid(14.1) = O2Sensor1ShortTermFuelTrim
(1) The pidID for SAE pids will match the SAE PID number in hexadecimal format. For example, the pidID for engine RPM is 0C. Some SAE PIDs return multiple values. For example, SAE PID 0x14 returns O2 voltage and short term fuel trim. Since O2 voltage is the first part of the response, it’s pidID is 14. Since short term fuel trim is the second part of the response, it’s pidID is 14.1.
The value returned is always in Metric units. You should write your equations to evaluate to Metric units and use the offset and scale factor to define English conversions.