How does it work?
The RS485 5 Click is based around the MAX485 transceiver which draw between 120µA and 500µA of supply current when unloaded or fully loaded with disabled drivers. All parts operate from a single 5V supply. Driver is short-circuit current limited and is protected against excessive power dissipation by thermal shutdown circuitry that places the driver outputs into a high-impedance state. The receiver input has a fail-safe feature that guarantees a logic-high output if the input is open circuit.
The MAX485 slew rates are not limited, allowing it to transmit up to 2.5Mbps and half-duplex communication. In general, the maximal transfer speed is determined by the bus length, longer bus lines will result in less transfer speed. The RS485/422 line should be terminated at both ends in its characteristic impedance and stub lengths off the main line should be kept as short as possible to minimize the reflections. The RS-485/RS-422 standard covers line lengths up to 1220 meters (4000 feet).
Excessive output current and power dissipation caused by faults or by bus contention are prevented by two mechanisms. A foldback current limit on the output stage provides immediate protection against short circuits over the whole common-mode voltage range. In addition, a thermal shutdown circuit forces the driver outputs into a high-impedance state if the temperature rises excessively.
There are two 2-pole screw terminals on board (+, B, A, -) for connecting RS422/485 bus twisted pair cable, along with the GND and VCC. The terminal inputs labeled as “A” and “B” are used to connect the bus wires. GND and VCC rails can be used to provide the power supply for another node. Note that the VCC terminal is directly routed to the 5V rail of the mikroBUS™.
Pins used for communication are next:
- DI (Data In) Data on DI pin (marked as RX on click’s mikroBUS™) is transmitted on A & B lines when the module is in transmit mode. To set module in transmit mode make DE=1 and RE=1. DI pin is connected to Tx pin of Host Microcontroller UART.
- RE (Receive Enable) RE pin is Used to configure the module in Receive Mode.
- DE (Data Enable) DE pin is Used to Configure the module in Transmit Mode
- RO (Receive Out) Data Received on A & B pin is given to RO pin (marked as TX on click’s mikroBUS™). RO pin is connected to Rx pinofmicrocontroller.
This Click Board™ is designed to be operated only with 5V logic level. A proper logic voltage level conversion should be performed before the Click board™ is used with MCUs with logic levels of 3V3.
Specifications
Type
RS485
Applications
Transceiver RS422/RS485 communication bus over UART interface for various automation systems, controllers, sensors and small embedded devices that can all share the same bus.
On-board modules
MAX485, low-power transceiver for RS-485 and RS-422 communication
Key Features
Transceiver draw between 120µA and 500µA of supply current when unloaded or fully loaded with disabled drivers. Driver is short-circuit current limited and is protected against excessive power dissipation by thermal shutdown circuitry. The receiver input has a fail-safe feature that guarantees a logic-high output if the input is open circuit.
Interface
GPIO,UART
Feature
No ClickID
Compatibility
mikroBUS™
Click board size
S (28.6 x 25.4 mm)
Input Voltage
5V
Pinout diagram
This table shows how the pinout on RS485 5 Click corresponds to the pinout on the mikroBUS™ socket (the latter shown in the two middle columns).
Onboard settings and indicators
Label | Name | Default | Description |
---|---|---|---|
LD1 | PWR | – | Power LED Indicator |
Software Support
We provide a library for the RS485 Click 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
Library provides functions for communication over UART module with the device, controlling RE( Receiver Output Enable ) and DE( Driver Output Enable ) pins state.
Key functions:
void rs4855_write_byte ( uint8_t input )
– Function for writing data via UART module.uint8_t rs4855_read_byte( )
– Function for reading data via UART module.void rs4855_set_de_state( uint8_t state )
– Function for setting DE pin state.void rs4855_set_re_state( uint8_t state )
– Function for setting RE pin state.
Examples description
The application is composed of three sections :
- System Initialization – Intializes UART module
- Application Initialization – Driver intialization
- Application Task – Choose one mode (read or write) of task. If you reading it checks if data is ready to be read and then reads one byte and if you are wiriting send data via UART.
void application_task ( ) { char tmp; uint8_t drdy_flag; if ( app_mode == APP_MODE_RECEIVER ) { // RECEIVER - UART polling drdy_flag = rs4855_byte_ready( ); if ( 1 == drdy_flag ) { tmp = rs4855_read_byte( ); mikrobus_logWrite( &tmp, _LOG_BYTE ); } } else { // TRANSMITER - TX each 2 sec for ( tmp = 0; tmp < 9; tmp++ ) { rs4855_write_byte( demo_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 the example:
- UART
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.
mikroSDK
This Click board™ is supported with 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.
For more information about mikroSDK, visit the official page.