PWM signal Simulink on serial port
7 ビュー (過去 30 日間)
古いコメントを表示
I need to connect my controller designed in Simulink to a brushless motor controller, which needs a PWM signal. This controller has a PWM connection cable (3 wires)
Is it possible to connect this controller to my PC (using serial port) and let Simulink send control signals to this motor controller?
3 件のコメント
Arnaud Miege
2011 年 8 月 2 日
Normally a PWM signal would be in the region of 100's of kHz, if not MHz.
回答 (5 件)
Walter Roberson
2011 年 8 月 2 日
Simulink is not supported on any system that is old enough to allow direct pin-level control of a system serial port. Unless, that is, you are talking about generating code for a controller: some of those might be able to handle it.
0 件のコメント
Arnaud Miege
2011 年 8 月 2 日
The Instrument Control Toolbox allows you to send data on the serial port with the Serial Send block. As I said in my comments, I am not sure this will be nearly fast enough for a PWM signal.
Arnaud
3 件のコメント
Arnaud Miege
2011 年 8 月 2 日
Agreed. Jan, you need a proper PWM output signal, which means you need something like Real-Time Windows Target or xPC Target, which the appropriate I/O card.
Jan De Vries
2011 年 8 月 3 日
1 件のコメント
Walter Roberson
2011 年 8 月 3 日
No; if it can be done directly through MATLAB then it would have to be through analogio(). The serial devices supported by MATLAB's serial() object are intended to be UARTs or emulations thereof, with byte-level output framed with start and stop bits.
The Parallax Servo Controller takes commands about positioning and emits appropriate pulses: that is the way to go in your situation.
Jan De Vries
2011 年 8 月 3 日
1 件のコメント
Walter Roberson
2011 年 8 月 3 日
Arnaud mentioned using !SC as the preamble; that is the same preamble that I found documented.
You should, by the way, be able to use
fprintf(ser, '%s', '!SCVER\n')
which would be more readable. Or
fwrite(ser, sprintf('!SCVER\n'), 'uint8', 'sync')
コミュニティ
その他の回答 パワー エレクトロニクス コミュニティ
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!