简体   繁体   English

Simulink外部模式和Arduino Mega 2560

[英]Simulink external mode and Arduino Mega 2560

I'm stuck with Simulink Arduino Target in MATLAB 2012a. 我被MATLAB 2012a中的Simulink Arduino Target所困扰。 Simulink can compile my model and download it to the hardware. Simulink可以编译我的模型并将其下载到硬件。 It seems to work, but when I do have a scope in my simulation, activating the external mode (for tuning my model and tracing the values) causes Simulink to crash ("Segmentation Violation", but the most time it just hangs without any error). 它似乎可行,但是当我在模拟中确实具有示波器时,激活外部模式(用于调整模型和跟踪值)会导致Simulink崩溃(“分段违规”),但大多数情况下它只是挂起而没有任何错误)。 It crashes the same way if I disconnect the usb-cable during external mode. 如果在外部模式下断开USB电缆的连接,则崩溃的方式相同。

I'm using the Arduino Mega 2560 R3 Hardware, Matlab 2012b on Win 7 64 bit and Win XP. 我在Win 7 64位和Win XP上使用Arduino Mega 2560 R3硬件,Matlab 2012b。

Any help is welcome, the matlab forum doesn't give any useful answer (at least so far). 欢迎任何帮助,matlab论坛没有给出任何有用的答案(至少到目前为止)。

I could reproduce the same error you've described in your post when using a sample time in the Analog Input block which was different to the sample time in the Simulation Settings pane. 当在模拟输入模块中使用采样时间时,与在“模拟设置”窗格中的采样时间不同,我可以重现您在帖子中描述的相同错误。 In other words, there is a good chance that one of the Arduino blocks has a different sample time to the global sample timing --- and this is an issue for the Arduino support package. 换句话说,Arduino块中的一个很有可能具有与全局采样时序不同的采样时间 ---这是Arduino支持包的问题。

Normally (in xPC Target) you just get an error message if the sample time does not make sense (non multiple of the global or faster) but a slower multiple is not an issue. 通常(在xPC Target中),如果采样时间没有意义(不是全局倍数或更快),而您却没有错误,则只会收到一条错误消息。 Here I've found that the input block needed the same sampling as the global model to work. 在这里,我发现输入块需要与全局模型相同的采样才能工作。

(Matlab 2012b, Win 7 x64, Arduino Mega 2560 R3, external mode) (Matlab 2012b,Win 7 x64,Arduino Mega 2560 R3,外部模式)

Gergely 热心地

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM