RS232 SPI Click Board
RS232 SPI Click Board
The RS232 SPI Click Board™ is based around the MAX3100, a universal asynchronous receiver transmitter (UART) - the first UART optimised explicitly for small microcontroller-based systems, from Maxim Integrated. Because of the features contained in its modules, the RS232 SPI Click Board™ can be used for handheld instruments, small networks in HVAC or Building control, UART in SPI systems, battery-powered systems, PDAs, notebooks and many more.
The RS232 SPI Click Board™ is supported by a mikroSDK compliant library, which includes functions that simplify software development. This Click Board™ comes as a thoroughly tested product, ready to be used on a system equipped with the mikroBUS™ socket.
Software Support
We provide a library for the RS232 SPI 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
The library covers all the necessary functions that enables the usage of the RS232 SPI Click Board™. User can send or receive data, check if data is ready or if tx line is busy, it is possible to change baud rate and to turn the device on or off.
Key Functions
uint8_t rs232spi_dataRead()
- Function is used to read data from the receive register.uint16_t rs232spi_dataReady()
- Function is used to check if there is availavle data for reading.void rs232spi_dataWrite( uint8_t wrData )
- Function is used to write into the transmit-buffer register.
Example Description
The application is composed of three sections :
- System Initialization - Initializes SPI and LOG structures, sets RST pin as output and INT pin as input.
- Application Initialization - Initialization driver enables SPI, sets up the device and starts write log.
- Application Task - (code snippet) This example demonstrates the use of RS232 SPI click board by sending or receiving the message.
void applicationTask() { uint8_t tmp; char rec; uint8_t mode = RS232SPI_WRITE_MODE; if ( mode == RS232SPI_READ_MODE ) { // RECEIVER - UART polling if ( rs232spi_dataReady() != 0 ) { rec = rs232spi_transfer( _RS232SPI_CMD_READ_DATA ); mikrobus_logWrite( &rec, _LOG_BYTE ); } } else if ( mode == RS232SPI_WRITE_MODE ) { // TRANSMITER - TX each 2 sec for ( tmp = 0; tmp < 9; tmp++ ) { rs232spi_dataWrite( MESSAGE_DATA[ tmp ] ); if ( tmp < 6 ) { Delay_ms( 100 ); } } 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:
- SPI
- UART
- Conversions
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
The RS232 SPI 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.
RS232 SPI Click Board
Frequently Asked Questions
Have a Question?
Be the first to ask a question about this.