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
답변 (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')
커뮤니티
더 많은 답변 보기: Power Electronics Community
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!