PWM signal Simulink on serial port
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Arnaud Miege
il 2 Ago 2011
Normally a PWM signal would be in the region of 100's of kHz, if not MHz.
Risposte (5)
Walter Roberson
il 2 Ago 2011
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 Commenti
Arnaud Miege
il 2 Ago 2011
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 Commenti
Arnaud Miege
il 2 Ago 2011
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
il 3 Ago 2011
1 Commento
Walter Roberson
il 3 Ago 2011
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
il 3 Ago 2011
1 Commento
Walter Roberson
il 3 Ago 2011
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
Più risposte nel Power Electronics Control
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!