TOP Contributors

  1. MIKROE (2656 codes)
  2. Alcides Ramos (353 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136817 times)
  2. FAT32 Library (69983 times)
  3. Network Ethernet Library (55953 times)
  4. USB Device Library (46274 times)
  5. Network WiFi Library (41892 times)
  6. FT800 Library (41203 times)
  7. GSM click (28990 times)
  8. PID Library (26420 times)
  9. mikroSDK (26376 times)
  10. microSD click (25383 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

RS232 SPI click

Rating:

0

Author: MIKROE

Last Updated: 2024-04-03

Package Version: 2.1.0.15

mikroSDK Library: 2.0.0.0

Category: RS232

Downloaded: 136 times

Not followed.

License: MIT license  

RS232 SPI click is based around the MAX3100, a universal asynchronous receiver transmitter (UART) - the first UART specifically optimized for small microcontroller-based systems, from Maxim Integrated. Because of the features contained in its modules, the RS232 SPI click 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.

No Abuse Reported

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".

  • mikroSDK Library 1.0.0.0
  • Comments (0)

mikroSDK Library Blog


RS232 SPI click

RS232 SPI click is based around the MAX3100, a universal asynchronous receiver transmitter (UART) - the first UART specifically optimized for small microcontroller-based systems, from Maxim Integrated. Because of the features contained in its modules, the RS232 SPI click 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.

rs232spi_click.png

click Product page


Click library

  • Author : MikroE Team
  • Date : Feb 2020.
  • Type : SPI type

Software Support

We provide a library for the Rs232Spi Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly form compilers IDE(recommended way), or downloaded from our LibStock, or found on mikroE github account.

Library Description

This library contains API for Rs232Spi Click driver.

Standard key functions :

  • Config Object Initialization function.

    void rs232spi_cfg_setup ( rs232spi_cfg_t *cfg );

  • Initialization function.

    RS232SPI_RETVAL rs232spi_init ( rs232spi_t ctx, rs232spi_cfg_t cfg );

  • Click Default Configuration function.

    void rs232spi_default_cfg ( rs232spi_t *ctx );

Example key functions :

  • This function writes two bytes of data using the SPI serial interface.

    void rs232spi_reg_write ( rs232spi_t *ctx, uint16_t write_data );

  • This function reads two bytes of data using the SPI serial interface.

    uint16_t rs232spi_reg_read ( rs232spi_t *ctx, uint16_t write_data );

  • This function writes the specified digital signal to the RST pin.

    void rs232spi_digital_write_rst ( rs232spi_t *ctx, uint8_t signal );

Examples Description

This example showcases how to initialize and use the RS232 SPI click. The click has a uni- versal asynchronous transceiver which uses a SPI serial interface to communicate with the MCU. In order for this example to work, 2 clicks are needed - a receiver and a transmitter.

The demo application is composed of two sections :

Application Init

This function initializes and configures the logger and click modules. Additional configura- ting is done in the default_cfg(...) function.


void application_init ( )
{
    log_cfg_t log_cfg;
    rs232spi_cfg_t cfg;

    /** 
     * Logger initialization.
     * Default baud rate: 115200
     * Default log level: LOG_LEVEL_DEBUG
     * @note If USB_UART_RX and USB_UART_TX 
     * are defined as HAL_PIN_NC, you will 
     * need to define them manually for log to work. 
     * See @b LOG_MAP_USB_UART macro definition for detailed explanation.
     */
    LOG_MAP_USB_UART( log_cfg );
    log_init( &logger, &log_cfg );
    log_info( &logger, "---- Application Init ----" );

    //  Click initialization.

    rs232spi_cfg_setup( &cfg );
    RS232SPI_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    rs232spi_init( &rs232spi, &cfg );
    Delay_100ms( );
    rs232spi_digital_write_rst( &rs232spi, 1 );
    Delay_10ms( );
    rs232spi_default_cfg( &rs232spi, 19200 );
    Delay_10ms( );
    rs232spi_flush( &rs232spi );
    Delay_100ms( );
}

Application Task

This function receives and displays UART data in the "read mode" and sends the predefined message in the "write mode".


void application_task ( )
{
    uint8_t mode = 0;
    uint8_t cnt;

    if ( mode == 1 )
    {
        if ( rs232spi_data_ready( &rs232spi ) != 0 )
        {
            log_printf( &logger, "%c\r\n", rs232spi_transfer( &rs232spi, RS232SPI_CMD_READ_DATA ) );
        }
    }
    else if ( mode == 0 )
    {
        for ( cnt = 0; cnt < 9; cnt++ )
        {
            rs232spi_data_write( &rs232spi, message[ cnt ] );
            if ( cnt < 6 )
            {
                Delay_100ms( );
            }
        }

        Delay_ms ( 1000 );
        Delay_ms ( 1000 );
    }
}  

The full application code, and ready to use projects can be installed directly form compilers IDE(recommneded) or found on LibStock page or mikroE GitHub accaunt.

Other mikroE Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Rs232Spi

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.


ALSO FROM THIS AUTHOR

MCP2517FD click

6

MCP2517FD Click is a compact add-on board representing a complete CAN solution used as a control node in a CAN network. This board features the MCP2517FD and ATA6563, an external CAN FD controller with an SPI interface, and a high-speed CAN transceiver from Microchip. The ATA6563, a low-level physical layer IC (PHY), provides a physical connection with the CAN bus itself, while the CAN controller MCP2517FD represents an interface between the MCU and the PHY. It features three operating modes with dedicated fail-safe features, remote wake-up via CAN, and ideally passive behavior when powered off on the CAN bus. This Click board™ is suitable for developing a wide range of automotive diagnostic applications, even on MCUs that don’t support CAN interface.

[Learn More]

mikromedia for PIC24EP - Examples

0

Set of examples for mikromedia for PIC24EP.. Provided examples demonstrate working with mikromedia's various features and modules:

- Accelerometer
- MMC SD card
- MP3
- Serial Flash
- TFT
- Touch Panel
- USB

[Learn More]

Boost-INV 3 click

0

Boost-INV 3 Click is a compact add-on board designed to supply positive/negative-driven applications. This board features the TPS65132, a dual-output power supply from Texas Instruments. The TPS65132 uses a single inductor scheme for both outputs to provide the user with the smallest solution size and high efficiency.

[Learn More]