PWM signal Simulink on serial port
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Arnaud Miege
el 2 de Ag. de 2011
Normally a PWM signal would be in the region of 100's of kHz, if not MHz.
Respuestas (5)
Walter Roberson
el 2 de Ag. de 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 comentarios
Arnaud Miege
el 2 de Ag. de 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 comentarios
Arnaud Miege
el 2 de Ag. de 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
el 3 de Ag. de 2011
1 comentario
Walter Roberson
el 3 de Ag. de 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
el 3 de Ag. de 2011
1 comentario
Walter Roberson
el 3 de Ag. de 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')
Comunidades de usuarios
Más respuestas en Power Electronics Control
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!