I2C object creation in Simulink
이전 댓글 표시
Hi,
im trying to create an i2c object in simulink for reading an sensor. In Matlab every thing works fine and i can read the data out of the sensor :
mpu_6050 = i2c('aardvark',0,hex2dec('68'));
fopen(mpu_6050);
fwrite(mpu_6050,65);
y = fread(mpu_6050,1);
fclose(mpu_6050);
When i try to add an Matlab-Function-Block to Simulink:
function y = mpu6050_read()
mpu_6050 = i2c('aardvark',0,hex2dec('68'));
fopen(mpu_6050);
fwrite(mpu_6050,65);
y = fread(mpu_6050,1,'*char');
fclose(mpu_6050);
end
i will get this error:
The 'i2c' class does not support code generation.
Is it really not possible to use the i2c class in simulink or do i have to use it in another way?
Regards V.Sadiku
댓글 수: 2
Kaustubha Govind
2013년 5월 9일
편집: Kaustubha Govind
2013년 5월 9일
Would you like to simply use your Simulink model for simulation within the MATLAB environment, or do you also intend to generate standalone C/C++ code from it?
Valmir Sadiku
2013년 5월 10일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Texas Instruments C2000 Processors에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!