Error while generating c code

I am trying to deploy a simulink model with an s function builder to an arduino. The model was made by someone else and I have little experience with c code. It is causing the error shown below during the code generation process. I believe I don't have the compiler set up correctly but am not sure. Any help on where to look further.
IC:/Users//Documents/MATLAB/Load_Pin_Faker_ert_rtw -IC:/Users//Documents/MATLAB/MCP4728_Test -IC:/PROGRA~1/MATLAB/R2017b/extern/include -IC:/PROGRA~1/MATLAB/R2017b/simulink/include -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/src/ext_mode/common -IC:/PROGRA~1/MATLAB/R2017b/rtw/c/ert -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/system/libsam -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/system/CMSIS/CMSIS/Include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/system/CMSIS/Device/ATMEL -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/cores/arduino -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/cores/arduino/avr -IC:/ProgramData/MATLAB/SupportPackages/R2017b/3P.instrset/arduinoide.instrset/idepkgs/packages/arduino/hardware/sam/1.6.11/variants/arduino_due_x -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinotarget/scheduler/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/supportpackages/arduinobase/include -IC:/ProgramData/MATLAB/SupportPackages/R2017b/toolbox/target/shared/externalmode_daemon/include -o MCP4728_Due_wrapper.o ../MCP4728_Due_wrapper.c
In file included from ../MCP4728_Due_wrapper.c:24:0:
C:/Users//Documents/MATLAB/MCP4728_Test/mcp4728.cpp:416:16: error: expected '=', ',', ';', 'asm' or '__attribute__' before ':' token
uint8_t mcp4728::_simpleCommand(byte simpleCommand) {
^
../MCP4728_Due_wrapper.c:28:1: error: unknown type name 'mcp4728'
mcp4728 dac = mcp4728(0); // instantiate mcp4728 object, Device ID = 0
^
../MCP4728_Due_wrapper.c:28:1: error: initializer element is not constant
../MCP4728_Due_wrapper.c: In function 'MCP4728_Due_Outputs_wrapper':
../MCP4728_Due_wrapper.c:57:6: error: request for member 'analogWrite' in something not a structure or union
dac.analogWrite(RowA[0],RowB[0],RowC[0],RowD[0]); // write to input register of DAC four channel (channel 0-3) together. Value 0-4095
^
../MCP4728_Due_wrapper.c: In function 'MCP4728_Due_Update_wrapper':
../MCP4728_Due_wrapper.c:79:9: error: request for member 'begin' in something not a structure or union
Wire.begin();
^
../MCP4728_Due_wrapper.c:80:9: error: request for member 'setClock' in something not a structure or union
Wire.setClock(400000) ;
^
../MCP4728_Due_wrapper.c:82:8: error: request for member 'begin' in something not a structure or union
dac.begin(); // initialize i2c interface
^
../MCP4728_Due_wrapper.c:83:17: error: request for member 'getId' in something not a structure or union
int id = dac.getId(); // return devideID of object
^
../MCP4728_Due_wrapper.c:89:8: error: request for member 'setVref' in something not a structure or union
dac.setVref(1,1,1,1); // set to use internal voltage reference (2.048V)
^
../MCP4728_Due_wrapper.c:90:8: error: request for member 'setGain' in something not a structure or union
dac.setGain(1,1,1,1); // set the gain of internal voltage reference ( 0 = gain x1 = 2.048v, 1 = gain x2 = 4.096v)
^
gmake: *** [MCP4728_Due_wrapper.o] Error 1
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Modeling 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by