TOP Contributors

  1. MIKROE (2751 codes)
  2. Alcides Ramos (372 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (118 codes)
  5. Bugz Bensce (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 (139059 times)
  2. FAT32 Library (71589 times)
  3. Network Ethernet Library (56988 times)
  4. USB Device Library (47330 times)
  5. Network WiFi Library (43006 times)
  6. FT800 Library (42297 times)
  7. GSM click (29776 times)
  8. mikroSDK (27874 times)
  9. PID Library (26858 times)
  10. microSD click (26129 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

DMX click

Rating:

5

Author: MIKROE

Last Updated: 2020-06-03

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: DMX

Downloaded: 2395 times

Not followed.

License: MIT license  

DMX Click is a device used to establish communication between the MCU and equipment that uses the DMX512-A communication protocol.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "DMX click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "DMX click" changes.

Do you want to report abuse regarding "DMX click".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

DMX Click

DMX Click

Native view of the DMX Click board.

View full image
DMX Click

DMX Click

Front and back view of the DMX Click board.

View full image

Library Description

This library offers a choice to control stage lighting and effects. One master device can control one, two, or more slave devices. User can determine length of the DMX frame, speed of the DMX frame transfer, data length, start address, interrupt duration. Any DMX slave device (DMX Click board, RGB reflector) is determined by start address and data length. This data can consist of the, for example, color selection, light intensity, and many different effects. Master executes the DMX frame transfer, '0' always be transfered first, and slave receives data from the sent frame starting from the determined start address, '0' always be received first. This is a excellent solution to control stage lighting on the easy, simple and fast way. For more details check documentation.

Key functions:

  • void dmx_send_cmd( uint8_t *cmd, uint16_t cmd_len ) - This function sends a command to the DMX device.
  • void dmx_default_handler( void ( *handler )( uint8_t*, uint16_t*, uint8_t* ) ) - This function sets handler on the function which should be performed, for example function for the results logging.
  • void dmx_run( uint8_t run_mode ) - This function allows user to put device in config or run mode.

Examples description

The application is composed of three sections :

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization - Initializes UART serial interface and executes a device configuration and mode setting. In our example the device is configured as master and allows 5 data bytes transfer starting from the address 8. DMX frame length is 15, starting from 0, and range can be from 1 to 512. Start address can be from 1 to 512 also. @FTMR,nnn - determines the delay between two DMX frame, range is from 000 to 007 (from 20ms to 160ms). @ITMR,nnn - determines the duration of the interrupt signal, range is from 000 to 007 (from 0.1ms to 1.28ms).
  • Application Task - (code snippet) - When device was configured as master, user can enter the desired 5 data bytes, that will be transfered to the slave every 140ms. When device was configured as slave, the device will receive 5 data bytes from the master, transfered from the address 8 to address 12, every 140ms (in this example). Note : RUN LED - DMX frame transfer indication STAT LED - interrupt indication MODE LED - indicates the device mode, when is set the device was configured as master, and when is reset the device was configured as slave.
void application_task( )
{
    if ( device_mode == DMX_SLAVE )
    {
        process( );
    }
    else if ( master_mode == DMX_MASTER_USER_CTRL )
    {
        uint8_t cmd_check;
        uint8_t tx_buff[ 6 ] = { 0 };

        mikrobus_logWrite( "> CH1 - light [0-255]: ", _LOG_TEXT );
        tx_buff[ 0 ] = enter_cmd( );

        mikrobus_logWrite( "> CH2 - red [0-255]: ", _LOG_TEXT );
        tx_buff[ 1 ] = enter_cmd( );

        mikrobus_logWrite( "> CH3 - green [0-255]: ", _LOG_TEXT );
        tx_buff[ 2 ] = enter_cmd( );

        mikrobus_logWrite( "> CH4 - blue [0-255]: ", _LOG_TEXT );
        tx_buff[ 3 ] = enter_cmd( );

        mikrobus_logWrite( "> CH5 - strobe [1-255]: ", _LOG_TEXT );
        tx_buff[ 4 ] = enter_cmd( );

        mikrobus_logWrite( "> CH6 - change colores [1-255]: ", _LOG_TEXT );
        tx_buff[ 5 ] = enter_cmd( );

        dmx_send_cmd( &tx_buff[ 0 ], 6 );
        cmd_check = dmx_check_int( );

        while ( cmd_check == DMX_INT_INACTIVE )
        {
            cmd_check = dmx_check_int( );
        }

        mikrobus_logWrite( "> command sent", _LOG_LINE );
        mikrobus_logWrite( "************************************", _LOG_LINE );
    }
    else
    {
        application_demo( );
    }
}


Other mikroE Libraries used in the example:

  • Conversions
  • C_String
  • UART

Additional notes and informations

Depending on the development board you are using, you may need USB UART clickUSB 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

Color 16 Click

0

Color 16 Click is a compact add-on board providing an accurate color-sensing solution. This board features ams AG’s AS7343, a 14-channel multi-purpose spectral sensor offering spectral response through a compatible I2C interface. It has a built-in aperture that controls the light entering the sensor array to increase accuracy, alongside precise optical filters integrated into standard CMOS silicon via deposited interference filter technology. The spectral response is defined by individual channels covering approximately 380nm to 1000nm with 11 channels centered in the visible spectrum, one near-infrared, and a clear channel.

[Learn More]

Compass Click

0

Compass Click is an add-on board in mikroBUS form factor. It features LSM303DLHC ultra compact high performance e-compass module.

[Learn More]

Analog Mux click

5

Analog MUX click is a Click board that switches one of the sixteen inputs to one output. It employs the CD74HC4067, a High-Speed CMOS Logic 16-Channel Analog Multiplexer/Demultiplexer, produced by Texas Instruments.

[Learn More]