How to program microcontroller in matlab?
Afficher commentaires plus anciens
Hello,
I am new to matlab, so help me out a bit here. I have a 3 axis controller (X,Y,Z) that I am trying to program using Matlab via RS232. So I know how to open the port and set the settings to the port. What I don't know, or I am having trouble understanding is how to send the commands to control each axis. According to the manufacturer the command to set the output for the X,Y and Z axis are XV, YV, and ZV. I know I can use the fprintf to write data in the ucontroller,, but how do you tell it to output lets say XV = 10 to move the X axis to that point. Is this even possible in matlab?. Thanks in advance.
s = serial('COM1')
set(s, 'BaudRate', 115200)
set(s, 'DataBits', 8)
set(s, 'Parity', 'none')
set(s, 'StopBits', 1)
set(s, 'FlowControl', 'none')
fopen(s)
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 14 Jan 2013
newxv = 10;
fprintf(s, 'XV = %d\n', newxv);
Catégories
En savoir plus sur Instrument Control Toolbox Supported Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!