2010-05-13 4 views
1

도구 제어 도구 상자없이 MATLAB 을 사용하여 GPIB 연결을 설정하는 방법이 있습니까? (나는 그것을 가지고 있지 않다). 또한 MATLAB이 외부 장치의 RS232 매개 변수 값 (전송 속도, 정지 비트 등)을 알 수있는 방법이 있습니다. (Windows에서 인 경우 DLL)GPIB를 MATLAB을 사용하는 외부 장치에 연결

당신의 GPIB 질문에 대한
% This function is meant to send commands to Potentiostat Model 263A. 

% A run includes turning the cell on, reading current for time t1, turning 

% the cell off, waiting for time t2. 

% t1 is the duration [secs] for which the Potentiostat must run (cell is on) 

% t2 is the duration [secs] to on after off 

% n is the number of runs 

% port is the serial port name such as COM1 

function [s] = Potentiostat_control(t1,t2,n) 

port = input('type port name such as COM1', 's') 

s = serial(port); 

set(s,'BaudRate', 9600, 'DataBits', 8, 'Parity', 'even', 'StopBits', 2 ,'Terminator', 'CR/LF'); 

fopen(s) 

%fprintf(s,'RS232?') 

disp(['Total runs requested = ' num2str(n)]) 

disp('i denotes number of runs executed so far..'); 

for i=1:n 

    i 

    %data1 = query(s, '*IDN?') 

    fprintf(s,'%s','CELL 1'); % sends the command 'CELL 1' 

    %fprintf(s,'%s','READI'); 

    pause(t1); 

    fprintf(s,'%s','CELL 0'); 

    %fprintf(s,'%s','CLEAR'); 

    pause(t2); 

end 

fclose(s) 

답변

1

에서, GPIB 카드는 호출 라이브러리와 함께 않습니다 나는 다음과 같은 코드를 가지고있는 RS232 연결을 위해? Matlab에는 calling external libraries에 대한 인터페이스가 있습니다. 기본 절차는 LOADLIBRARY을 사용하여 헤더 파일을 구문 분석 한 다음 LIBFUNCTIONS을 사용하여 사용 가능한 기능을보고 CALLLIB을 사용하여 함수를 호출하는 것입니다.

RS232 질문에 대해서는 호스트 측에서 외부 문서없이 장치 측 매개 변수를 알 수있는 방법이 없다고 생각합니다.

+1

감사합니다. mtrw. 나는 그것을 들여다 볼 것이다. – hkf