Hi, I've never used Simulink , but I used Matlab to control stepper drives (or Euro 205 motion controller, which is programmable in BASIC) via rs-232 protocol. First I checked that HyperTerminal can send and receive commands to the controller. Then in matlab:
- create a com serial object:
s = serial('COM1');
-set object parameters (like in HyperTerminal properties):
set(s, 'BaudRate', 9600, 'StopBits', 2);
set(s, 'Terminator', 'CR/LF', 'Parity', 'Even');
set(s, 'FlowControl', 'software');
set(s, 'Databits', 7);
-initialize serial port:
fopen(s);
-send commands to the controller by using fprintf (you need your controller commands for this), e.g.:
fprintf(s, 'BASE(0,1,2)');
fprintf(s, 'UNITS = 6410.25641');
fprintf(s, 'move(20)')
-I noticed that for my controller (or maybe matlab in general, I don't know), I could only send about 120 commands consequently and then I had to disconnect and reconnect to the serial port (but it takes fractions of seconds)
-to disconnect from the serial object:
fclose(s);
I hope that helps.
Happy Hippo