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-01-24
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: 1-Wire
Downloaded: 4649 times
Not followed.
License: MIT license
UART 1-Wire click is used to convert standard UART or 5V RS232 signals into 1-Wire signals.
Do you want to subscribe in order to receive notifications regarding "UART 1-Wire click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "UART 1-Wire click" changes.
Do you want to report abuse regarding "UART 1-Wire click".
Library Description
The library initializes and defines the UART bus driver and drivers that offer a choice for writing data on UART. The library includes function for read n data and functions for go to Command/Data mode. The user also has the function for reset chip and storage read data.
Key functions:
void uart1wire_writeCommand(uint8_t input)
- Functions for write one byte on UART.uint8_t uart1wire_readByte()
- Functions for read byte from UART.void uart1wire_goToCommandMode()
- Functions for go to command mode.void uart1wire_goToDataMode()
- Functions for go to data mode.void uart1wire_readData(uint8_t *buf, uint8_t nData)
- Functions for read data.Examples description
The application is composed of the three sections :
void applicationTask()
{
/* Start converzion */
uart1wire_reset();
uart1wire_goToDataMode();
Delay_10ms();
uart1wire_writeCommand(_UART1WIRE_SKIP_ROM);
uart1wire_writeCommand( 0x44 );
Delay_ms( 750 );
/* Start reading temperature */
uart1wire_reset();
uart1wire_goToDataMode();
Delay_10ms();
uart1wire_writeCommand(_UART1WIRE_SKIP_ROM);
uart1wire_writeCommand( 0xBE );
Delay_10ms();
uart1wire_readData(&dataBuffer[0], 8);
Temp = dataBuffer[ 1 ];
Temp = Temp << 8;
Temp = Temp | dataBuffer[ 0 ];
fTemp = Temp * 0.0625;
mikrobus_logWrite(" Temperature : ", _LOG_TEXT);
FloatToStr(fTemp, demoText);
mikrobus_logWrite(demoText, _LOG_LINE);
Delay_ms( 1000 );
}
Other mikroE Libraries used in the example:
UART
Conversions
Additional notes and informations
Depending on the development board you are using, you may need USB UART click, USB UART 2 clickor 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.