Skip to main content
Submitted by Socky on Tue, 06/28/2016 - 11:57

Greetings! I have a little bit trouble controlling a DMC - 3x01x motion controller using matlab. I've set everything up and I want to execute the following commands, but matlab throws the error:

Invoke Error, Dispatch Exception:
Description: 2010 COMMAND ERROR. Galil::command("BGABD") got ? instead of : response. TC1 returned
"4 Operand error"

Can you help me to figure out why this would happen? Thanks so much. My code is pasted below:

%-----------------------------------------------------------------------------------
g = actxserver('galil'); %set the variable g to the GalilTools COM wrapper
response = g.libraryVersion; %Retrieve the GalilTools library versions
disp(response); %display GalilTools library version
g.address = 'COM5 115200'; %Open connections dialog box
response = g.command(strcat(char(18), char(22))); %Send ^R^V to query controller model number

response = g.command('PR 2000,3000,,5000')
response = g.command('BGABD') <-!!! Error is detected here !!!
response = g.command('HM')
response = g.command('BGA')
...
...
%-----------------------------------------------------------------------------------

Also, is there a way to run a complete .dmc file in matlab instead of separate commands? I tried to use the following code but it didn't work.
%-----------------------------------------------------------------------------------
g.programDownloadFile('C:\Users\verasonics\Documents\Vantage-2.11.6\User Scripts\Socky\GalilAsciiTest2.dmc'); % download selected path (note, no error checking included)
g.programUpload( ); % save controller buffer to file
%-----------------------------------------------------------------------------------

Thanks for the help!

Comments 1

AndrewS on 08/31/2016 - 08:55

Hi Socky,
That error is a command error, so it is the controller that is throwing the error to 'BGABD'. Operand error is referring to syntax, which could be a number of different reasons.

You can run things from a program on the controller. I recommend looking through the programming sections on the manual. You can have several different routines starting with labels, and Matlab can call the different subroutines with XQ#xxx.

Regards,
Andrew