Send Arduino acquisition to host PC

조회 수: 2 (최근 30일)
Marco
Marco 2014년 2월 3일
댓글: Marco 2014년 2월 15일
Hi, I have an Arduino Mega2560 that acquires an I2C signal from a gyro in external mode or building model into the hardware. I need to use this signal in an other independent simulink model and so I tried with Arduino Serial port block but it supports uint8 data type signals only and my signal is int16. I tried also with serial blocks from Instrument control toolbox in external mode but it returns following error:
Failed to open serial port '\\.\COM12'. The reported error code is: 5 or 0x00000005. Possible causes are:
a) The target is not powered on.
b) The specified port number is not correct.
c) The specified bit rate is not supported by the host machine.
d) The previous connection was not closed correctly. If this is the case, you may need to re-start MATLAB.
but using no serial communication acquisition works. Is there a way to transmit signal data from Arduino to host PC without losing signal information ?

답변 (1개)

Rolfe Dlugy-Hegwer
Rolfe Dlugy-Hegwer 2014년 2월 7일
Hi Marco, Use External mode with a To File block, as described in http://www.mathworks.com/help/simulink/ug/tune-and-monitor-model-running-on-target-hardware.html . Please post a note here letting us know if that works for you...
  댓글 수: 1
Marco
Marco 2014년 2월 15일
I solved it using byte pack/unpack blocks. But I will try your way as soon as possible. Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by