% Hello FTDI code for MATLAB % Prashant Patil % 28/11/2011 % Create the serial port object if it does not exist % otherwise use the object that was found. if isempty(handles.obj1) handles.obj1 = serial('COM9'); else fclose(handles.obj1); handles.obj1 = handles.obj1(1) end % Connect to instrument object, handles.obj1. fopen(handles.obj1); % Configure instrument object, handles.obj1. set(handles.obj1, 'BaudRate', 112500); set(handles.obj1, 'Terminator', {0,0}); % Communicating with instrument object, handles.obj1. data1 = query(handles.obj1, 'm') if (data1 == 'm') set(handles.pbconnect,'String','Disconnect') else set(handles.pbconnect,'String','Error') end