serial send ブロックで数値列を送る方法
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
シリアル通信でサーボモータを操作するプログラムをmatlabで作成、実行することができ、
同じものをsimulinkでも作ろうとしたのですが行き詰ってしまいました。解決方法を教えて頂けると嬉しいです。
作成したmatlabのコードは以下の通りです。
------------------------------------------------------------------------------------------------------
s = serialport("COM4",115200,"Parity","even");
write(s,[0x0B,0x10,0x04,0x00,0x00,0x00,0x00,0x01,0xFF,0x7F,0x9E],"uint8")
for i = 1:5
write(s,[0x07,0x0F,0x02,0x32,0x70,0x17,0xD1],"uint8")
pause(2)
write(s,[0x07,0x0F,0x02,0x01,0x28,0x23,0x64],"uint8")
pause(1)
end
write(s,[0x0B,0x10,0x04,0x00,0x00,0x00,0x00,0x01,0x00,0x80,0xA0],"uint8")
clear s;
---------------------------------------------------------------------------------------------------------
simulinkでは instrument control toolbox のserial send ブロックで同じ数値列を送るモデルを作成しましたが、
サーボモータが動作しませんでした。comportとの接続はできているようで、実行時にエラーは出ませんでした。

使うブロックが間違っていたり、足りなかったりするのかと色々調べてみましたが、解決に至りませんでした。
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Motor Control Blockset en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!