HANcoder/Examples/Adding a customized block

From OpenMBD
< HANcoder‎ | Examples
Revision as of 11:15, 28 February 2019 by Hugo (talk | contribs)
Jump to: navigation, search

This is a step-by-step guide for creating a custom block in MatLAB/Simulink and how to call custom functions written in the C programming language.
This guide assumes that HANcoder Beta V1.0 has been downloaded and installed successfully.

The guide uses an example: The signal tower.
The signal tower consists of four layers with two RGB LEDs per layer. Each color can be assigned a value between 0 and 255, which makes a total of 16777216 colors per LED.
The signal tower is implemented by using WS2812B RGB LEDs. These LEDs are are connected in cascade and use a single serial transmission line.
The timing required for generating the serial signal is implemented in C-code by using the microcontroller's SPI bus. As the STM32 on the Olimexino features two SPI busses (SPI1 and SPI2), the user has the option to select the SPI interface.

The result in Simulink will be as follows:
Signal tower block final result.png
The files that have been added or updated with respect to HANcoder Beta V1.0 can be downloaded File:Here.