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: 2019-04-04
Package Version: 1.0.0.1
mikroSDK Library: 1.0.0.0
Category: ID
Downloaded: 4675 times
Followed by: 3 users
License: MIT license
Unique ID click carries DS2401, an enhanced silicon serial number IC. The chip uses 1-wire communications for interfacing with the target board microcontroller.
Do you want to subscribe in order to receive notifications regarding "Unique ID click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Unique ID click" changes.
Do you want to report abuse regarding "Unique ID click".
Library Description
The library covers all the necessary functions to control Unique ID click board. Library performs the communication with the device via 1-Wire protocol by writing to registers and by reading from registers. The library has the function for reading sensor registration number: family code, serial number & CRC tester data.
Key functions:
Examples description
The application is composed of three sections:
void applicationTask() { uniqueid__getSensorInfo(); mikrobus_logWrite( " Family : ", _LOG_TEXT ); WordToStr( family, logText ); ltrim( logText ); mikrobus_logWrite( logText, _LOG_LINE ); mikrobus_logWrite( " ID Hex.: ", _LOG_TEXT ); for ( cnt = 0; cnt < 6; cnt++ ) { ByteToHex( buffer[ cnt ], logText ); ltrim( logText ); mikrobus_logWrite( logText, _LOG_TEXT ); } mikrobus_logWrite( " ", _LOG_LINE ); LongToStr( uniqueId, logText ); ltrim( logText ); mikrobus_logWrite( " ID Dec.: ", _LOG_TEXT ); mikrobus_logWrite( logText, _LOG_LINE ); mikrobus_logWrite( " CRC : ", _LOG_TEXT ); WordToStr( crc, logText ); ltrim( logText ); mikrobus_logWrite( logText, _LOG_LINE ); mikrobus_logWrite( "-----------------------", _LOG_LINE ); Delay_ms( 5000 ); }
Additional Functions :
void uniqueid_oneWireReset()
- One_Wire generic reset function.void uniqueid_oneWireWrite(uint8_t writeByte)
- One_Wire generic write the byte of the data function.uint8_t uniqueid_oneWireRead()
- One_Wire generic read the byte of the data function.void uniqueid__getSensorInfo()
- Read sensor registration number: family code, serial number & CRC tester data.Other mikroE Libraries used in the example:
One_Wire
UART​
Conversion
Additional notes and informations
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