How to program microcontroller in matlab?
이전 댓글 표시
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)
채택된 답변
추가 답변 (1개)
Walter Roberson
2013년 1월 14일
newxv = 10;
fprintf(s, 'XV = %d\n', newxv);
카테고리
도움말 센터 및 File Exchange에서 Instrument Control Toolbox Supported Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!