Difference between revisions of "HANcoder/Examples/Adding a customized block"

From OpenMBD
Jump to: navigation, search
Line 2: Line 2:
 
This guide assumes that [[downloads/HANcoder|HANcoder]] has been downloaded and installed successfully.<br>
 
This guide assumes that [[downloads/HANcoder|HANcoder]] has been downloaded and installed successfully.<br>
 
<br>
 
<br>
The guide is based on an example: a Signal Tower.<br>
+
The guide uses an example: The signal tower.<br>
The signal tower consists of four layers with two RGB LEDs per layer. Each color can be assigned a value between 0 and 255.<br>
+
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.<br>
The signal tower is implemented by using WS2812B RGB LEDs<br>
+
The signal tower is implemented by using WS2812B RGB LEDs. These LEDs are are connected in cascade and use a single serial transmission line.<br>
The timing required for generating a serial signal is implemented in C-code by using the microcontroller's SPI.<br>
+
The timing required for generating the serial signal is implemented in C-code by using the microcontroller's SPI bus.<br>
 
<br>
 
<br>
 
The result in Simulink will be as follows:<br>
 
The result in Simulink will be as follows:<br>

Revision as of 10:53, 28 February 2019

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

The result in Simulink will be as follows:
File:Sigal tower block final result.png