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: 2020-01-20
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: RS232
Downloaded: 2989 times
Not followed.
License: MIT license
RS232 SPI click is based around the MAX3100, a universal universal asynchronous receiver transmitter (UART) - the first UART specifically optimized for small microcontroller-based systems, from Maxim Integrated.
Do you want to subscribe in order to receive notifications regarding "RS232 SPI click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "RS232 SPI click" changes.
Do you want to report abuse regarding "RS232 SPI click".
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.Examples description
The application is composed of three sections :
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 );
}
}
Other mikroE Libraries used in the example:
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.