2 Simulink s-function builder Call Library files such as .cpp & .h from outside the project folder

preview_player
Показать описание
*** Part 1 (Previous Video) *** PART 1 CONTAINS SOURCE FILES

======================================================================
*** Part 2 (This video) ***

Table of Contents
*** Objective ***
*** Summary ***
*** MY DEMO FOLDER *** Note: you will have to update this file by following the steps in the video
*** Solution ***
*** Additional Resources ***
*** Additional Information ***

======================================================================
[*** Objective ***]
Call Library files such as .cpp & .h from outside the project folder.

======================================================================
[*** Summary ***]
To call Libraries from outside the project folder open the Libraries panel of S-Function Builder and add the root path found in the Arduino Library. When adding the desired Arduino library path select "INC_PATH" as the tag name. In this video I added the Arduino path for path for both OneWire & DallasTemperature.

======================================================================
[*** MY DEMO FOLDER ***] Note: you will have to update this file by following the steps in the video

======================================================================
[*** Solution ***]

*** While In Simulink ***
Step 1) Stop simulation
Step 2) Delete all Library files located in the project folder
Step 3) Open the S-Function Builder Block by double clicking on the block
Step 4) Click on the 'Libraries' Panel

Step 5) Right click next to the column header name 'tag' & select 'Add PATH'

*** Tag *** *** VALUE ***
INC_PATH "C:\Users\user-name\Documents\Arduino\libraries\OneWire"
INC_PATH "C:\Users\user-name\Documents\Arduino\libraries\DallasTemperature"

Step 6) Build new wrapper file (DS18B20_wrapper.c)
Step 7) Close and save S-function Builder Block.

*** While In MATLAB Project Window ***
Step 9) Update code in new wrapper file (DS18B20_wrapper.c)
Open file "DS18B20_wrapper.c" and write [extern "C"] everywhere the word Void appears.

*** While In Simulink ***
Step 11) Run simulation by pressing "Monitor & Tune"

======================================================================
[*** Additional Resources ***]

*** Build S-Functions Automatically Using S-Function Builder ***

*** Developing Simulink Device Driver Blocks: Step-By-Step Guide and Examples ***

======================================================================
[*** Additional Information ***]

*** Tag Purpose ***
INC_PATH == Specify the include search paths for header files and source files.
Рекомендации по теме
Комментарии
Автор

it says
DS18B20_Probe Failed Code generation information file does not exist. error encouterd while building
pls help
(i am using arduino uno )

sdadasda-sfgh
Автор

hey can I ask what to do when it says DS18B20_Probe Failed Code generation information file does not exist.
0 of 1 models built( 0 already up to date)
I cannot build always error

sdadasda-sfgh
Автор

Very nice work here. Any chance can we do this with ESP32. No support packages that I know of in simulink?

phillipmaser
Автор

hi good day to you, i want to know how to display a data on LCD I2C using simulink model, i want to make a triphase inverter, and i want to display voltage value of each phase on screen

roche_tech
Автор

Can we add Inports and outports to S function builder block using MATLAB command or script? Please guide

Indiangirl
Автор

didnt work with Matlab 2023a, any solution advice ?

serhanargun
Автор

Hi. first of all, i would like to say thank you for the wonderful videos. i have followed all of the step, but i have faced some error. Fatal error: Arduino.h: No such file or directory
#include <Arduino.h>. when i included the Arduino.h file in the project folder, another error apper which is fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>. the error will keep on going . it have been restless night trying to figure out what went wrong. it would mean the world if anybody help me.

nizarnasir
Автор

Hi sir Can u Plase give me ur Gmail So i Can contact you 🙏thank you a lot for the vedio

benalimohamedyassine
welcome to shbcf.ru