Jump to content

Component: OBD2 ECU (Server) (Misc): Difference between revisions

From Flowcode Help
No edit summary
No edit summary
Line 17: Line 17:
==Component Source Code==
==Component Source Code==


Please click here for the component source code: [https://www.flowcode.co.uk/wikicopy/componentsource/FC_Comp_Source_OBD2_ECU.fcfx FC_Comp_Source_OBD2_ECU.fcfx]
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_OBD2_ECU.fcfx FC_Comp_Source_OBD2_ECU.fcfx]


==Detailed description==
==Detailed description==




Line 32: Line 34:


==Examples==
==Examples==




Line 46: Line 50:


==Macro reference==
==Macro reference==
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_VIN'''
|-
| colspan="2" | Set the 17 character VIN 
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | VIN
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_Engine_Speed'''
|-
| colspan="2" | 0  to 16,383.75 (rpm) 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Speed in RPM 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_Engine_Coolant_Temperature'''
|-
| colspan="2" | -40 to 215 (deg C) 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Value range -40 to 215 deg C 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Process'''
|-
| colspan="2" | Does the message processing. Call this often. 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | TimeElapsed
|-
| colspan="2" | Time elapsed since last call, in mS. Can be zero for frequent calling. 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DTC_Clear'''
|-
| colspan="2" | Clears the DTC store 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DTC_Get'''
|-
| colspan="2" | Get the DTC from the store at Index 
|-
|-
| width="10%" align="center" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" | Index
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DTC_Count'''
|-
| colspan="2" | Returns the number of stored DTCs 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_ECU_Name'''
|-
| colspan="2" | Set the ECU Name 
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | Name
|-
| colspan="2" |  
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetNumberBytes'''
|-
| colspan="2" | Returns the number of valid data bytes currently inside the buffer. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_Vehicle_Speed'''
|-
| colspan="2" | 0 - 255 (km/h) 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Speed in RPM 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_MAF_Rate'''
|-
| colspan="2" | 0 to 655.35 grams/sec 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | MAF air flow rate in grams/sec 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_Engine_Load'''
|-
| colspan="2" | 0 to 100 (%) 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Speed in RPM 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''DTC_Add'''
|-
| colspan="2" | Adds a DTC to the store (e.g. "B1318") Checks to see if the DTC string is already in the store before adding. 
|-
|-
| width="10%" align="center" | [[File:Fc9-string-icon.png]] - STRING
| width="90%" | DTC_String
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-bool-icon.png]] - BOOL
| width="90%" | CheckExists
|-
| colspan="2" | Checks to see if error code already exists 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetByte'''
|-
| colspan="2" | Reads the next available byte from the circular buffer, Returns 255 if the buffer is empty. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u16-icon.png]] - UINT
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Set_Throttle_Position'''
|-
| colspan="2" | 0 - 100 (%) 
|-
|-
| width="10%" align="center" | [[File:Fc9-f32-icon.png]] - FLOAT
| width="90%" | Value
|-
| colspan="2" | Position value as a percentage (0 - 100%) 
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''FlushBuffer'''
|-
| colspan="2" | Clears the contents of the buffer and re-initialises the index locations. 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise'''
|-
| colspan="2" | Initialise the CAN network 
|-
|-
| width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE
| width="90%" style="border-top: 2px solid #000;" | ''Return''
|}
==Property reference==
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
|-
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''
|-
|-
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
| width="90%" | DTC Store Size
|-
| colspan="2" | Maximum number of DTC codes to store 
|-
| width="10%" align="center" | [[File:Fc9-type-10-icon.png]]
| width="90%" | VIN
|-
| colspan="2" | 17 character Vehicle Identification Number 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | CAN
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Channel
|-
| colspan="2" | Switches between Internal CAN peripheral and External CAN controller IC MCP2515. 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Controller Osc
|-
| colspan="2" |  
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Bus Rate
|-
| colspan="2" | Data rate of the bus specified in thousand bits per second, Kbps. 
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
|-
|-
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | SPI
|-
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | CHANNEL
|-
| colspan="2" | SPI Channel selector 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | MOSI
|-
| colspan="2" | SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | MISO
|-
| colspan="2" | SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | CLK
|-
| colspan="2" | SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
|-
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
| width="90%" | SS
|-
| colspan="2" | Chip Select / Slave Select Pin  Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Prescale
|-
| colspan="2" | Prescale option selector 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Sample Point
|-
| colspan="2" | Data bit read sample point 
|-
| width="10%" align="center" | [[File:Fc9-type-16-icon.png]]
| width="90%" | Config Delay
|-
| colspan="2" |  
|}==Macro reference==


{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 15:16, 20 January 2023

Author
Version 1.0
Category Misc


OBD2 ECU (Server) component

Implements an ECU side OBD-II server

Component Source Code

Please click here to view the component source code (Beta): FC_Comp_Source_OBD2_ECU.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples


Macro reference

Set_VIN
Set the 17 character VIN 
- STRING VIN
 
- VOID Return


Set_Engine_Speed
0 to 16,383.75 (rpm) 
- FLOAT Value
Speed in RPM 
- VOID Return


Set_Engine_Coolant_Temperature
-40 to 215 (deg C) 
- FLOAT Value
Value range -40 to 215 deg C 
- VOID Return


Process
Does the message processing. Call this often. 
- UINT TimeElapsed
Time elapsed since last call, in mS. Can be zero for frequent calling. 
- BYTE Return


DTC_Clear
Clears the DTC store 
- VOID Return


DTC_Get
Get the DTC from the store at Index 
- UINT Index
 
- STRING Return


DTC_Count
Returns the number of stored DTCs 
- UINT Return


Set_ECU_Name
Set the ECU Name 
- STRING Name
 
- VOID Return


GetNumberBytes
Returns the number of valid data bytes currently inside the buffer. 
- UINT Return


Set_Vehicle_Speed
0 - 255 (km/h) 
- FLOAT Value
Speed in RPM 
- VOID Return


Set_MAF_Rate
0 to 655.35 grams/sec 
- FLOAT Value
MAF air flow rate in grams/sec 
- VOID Return


Set_Engine_Load
0 to 100 (%) 
- FLOAT Value
Speed in RPM 
- VOID Return


DTC_Add
Adds a DTC to the store (e.g. "B1318") Checks to see if the DTC string is already in the store before adding. 
- STRING DTC_String
 
- BOOL CheckExists
Checks to see if error code already exists 
- BYTE Return


GetByte
Reads the next available byte from the circular buffer, Returns 255 if the buffer is empty. 
- UINT Return


Set_Throttle_Position
0 - 100 (%) 
- FLOAT Value
Position value as a percentage (0 - 100%) 
- VOID Return


FlushBuffer
Clears the contents of the buffer and re-initialises the index locations. 
- VOID Return


Initialise
Initialise the CAN network 
- BYTE Return



Property reference

Properties
DTC Store Size
Maximum number of DTC codes to store 
VIN
17 character Vehicle Identification Number 
CAN
Channel
Switches between Internal CAN peripheral and External CAN controller IC MCP2515. 
Controller Osc
 
Bus Rate
Data rate of the bus specified in thousand bits per second, Kbps. 
Connections
SPI
CHANNEL
SPI Channel selector 
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Prescale
Prescale option selector 
Sample Point
Data bit read sample point 
Config Delay
 

==Macro reference==

Set_VIN
Set the 17 character VIN 
- STRING VIN
 
- VOID Return


Set_Engine_Speed
0 to 16,383.75 (rpm) 
- FLOAT Value
Speed in RPM 
- VOID Return


Set_Engine_Coolant_Temperature
-40 to 215 (deg C) 
- FLOAT Value
Value range -40 to 215 deg C 
- VOID Return


Process
Does the message processing. Call this often. 
- UINT TimeElapsed
Time elapsed since last call, in mS. Can be zero for frequent calling. 
- BYTE Return


DTC_Clear
Clears the DTC store 
- VOID Return


DTC_Get
Get the DTC from the store at Index 
- UINT Index
 
- STRING Return


DTC_Count
Returns the number of stored DTCs 
- UINT Return


Set_ECU_Name
Set the ECU Name 
- STRING Name
 
- VOID Return


GetNumberBytes
Returns the number of valid data bytes currently inside the buffer. 
- UINT Return


Set_Vehicle_Speed
0 - 255 (km/h) 
- FLOAT Value
Speed in RPM 
- VOID Return


Set_MAF_Rate
0 to 655.35 grams/sec 
- FLOAT Value
MAF air flow rate in grams/sec 
- VOID Return


Set_Engine_Load
0 to 100 (%) 
- FLOAT Value
Speed in RPM 
- VOID Return


DTC_Add
Adds a DTC to the store (e.g. "B1318") Checks to see if the DTC string is already in the store before adding. 
- STRING DTC_String
 
- BOOL CheckExists
Checks to see if error code already exists 
- BYTE Return


GetByte
Reads the next available byte from the circular buffer, Returns 255 if the buffer is empty. 
- UINT Return


Set_Throttle_Position
0 - 100 (%) 
- FLOAT Value
Position value as a percentage (0 - 100%) 
- VOID Return


FlushBuffer
Clears the contents of the buffer and re-initialises the index locations. 
- VOID Return


Initialise
Initialise the CAN network 
- BYTE Return



Property reference

Properties
DTC Store Size
Maximum number of DTC codes to store 
VIN
17 character Vehicle Identification Number 
CAN
Channel
Switches between Internal CAN peripheral and External CAN controller IC MCP2515. 
Controller Osc
 
Bus Rate
Data rate of the bus specified in thousand bits per second, Kbps. 
Connections
SPI
CHANNEL
SPI Channel selector 
MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Prescale
Prescale option selector 
Sample Point
Data bit read sample point 
Config Delay