RS485 3 Click Board
RS485 3 Click Board
The RS485 3 Click Board™ uses SN65HVD31DR from Texas Instruments, a tri-state differential line driver and differential input line receiver. The Click Board™ is intended to be used as UART to RS-422/RS-485 communication interface. It is suited for transmitting smaller blocks of data over long distances, using the four-wire bus, allowing for full-duplex communication.
It can be used as a transceiver between the UART interface and RS-422/RS-485 communication bus. The RS485 3 Click Board™ can be used for controlling various building automation systems, lighting controllers, sensors and many small embedded devices that can all share the same bus, which can stretch up to 254 nodes and up to 1200m in length.
Software Support
We provide a demo application for the RS485 3 Click Board™ on our LibStock page, as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.
Library Description
Carries generic functions which are mostly wrappers for UART functions.
Key Functions
void rs485_3_writeByte(uint8_t input)
- Write Single Byte.uint8_t rs485_3_readByte()
- Read Single Byte.uint8_t ras485_3_byteReady()
- Check for new byte received
Examples Description
The application is composed of two sections :
- System Initialization - Initializes the UART module.
- Application Initialization - Driver initialization.
- Application Task - (code snippet) - Checks if new data byte has been received in the RX buffer (ready for reading), and if it is ready, then it reads one byte from the RX buffer. In the second case, the application task writes the message data via UART.
void applicationTask() { char tmp; uint8_t rdyFlag; // RECEIVER - UART polling rdyFlag = rs485_3_byteReady(); if (1 == rdyFlag) { tmp = rs485_3_readByte(); mikrobus_logWrite( &tmp, _LOG_BYTE ); } // TRANSMITTER - TX each 2 sec /* for (tmp = 0; tmp < 9; tmp++) { rs485_3_writeByte( MESSAGE_DATA[tmp] ); mikrobus_logWrite( "MESSAGE SENT", _LOG_LINE ); } Delay_ms(2000); */ }
The full application code and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in this example:
- UART
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.
MIKROSDK
This click board is supported by mikroSDK - MikroElektronika Software Development Kit. To ensure proper operation of mikroSDK compliant click board demo applications, mikroSDK should be downloaded from the LibStock and installed for the compiler you are using.
RS485 3 Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.