We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-07-12
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: CAN
Downloaded: 9553 times
Followed by: 1 user
License: MIT license
OBDII click offers a unique opportunity to tap inside the car diagnostic systems. It features the STN1110 Multiprotocol OBD to UART Interface, developed by the ScanTool technologies.
Do you want to subscribe in order to receive notifications regarding "OBD II click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "OBD II click" changes.
Do you want to report abuse regarding "OBD II click".
The library carries generic functions, necessary for communication with the module.
Key functions:
obdII_sendCommand- Sends provided command to the module
obdII_readResponse - Reads current response inside buffer
obdII_process- State machine function. This function is being called frequently
Examples Description
The example demonstrates how to read RPM from your vehicle.
void applicationTask()
{
uint8_t tmp[ 25 ];
obdII_sendCommand( &RPM_CMD[0] );
while( !obdII_responseReady() )
;
obdII_readResponse( &rsp[0] );
memcpy( &tmp[0], &rsp[11], 4 );
tmp[5] = 0;
rpm = xtoi( &tmp[0] );
rpm = rpm / 4;
WordToStr(rpm, &tmp[0]);
mikrobus_logWrite( "Current RPM : ", _LOG_TEXT );
mikrobus_logWrite( tmp, _LOG_LINE );
}
Note that not all vehicles use the same set of commands - it might happen that routine for reading RPM on your vehicle is not the same as the ones provided in the example.
Other MikroElektronika libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.