이 페이지는 기계 번역을 사용하여 번역되었습니다. 최신 내용을 영문으로 보려면 여기를 클릭하십시오.
Digilent Analog Discovery를 사용하여 데이터 생성 시작하기
R2026a이 예제에서는 300kHz의 속도로 전압 데이터를 생성하는 방법을 보여줍니다.
장치 검색
daqlist를 사용하여 시스템에 연결된 Digilent 장치를 검색합니다.
daqlist("digilent")
ans =
1×4 table
DeviceID Description Model DeviceInfo
________ _____________________________________________ ____________________ _______________________
"AD1" "Digilent Inc. Analog Discovery 2 Kit Rev. C" "Analog Discovery 2" [1×1 daq.di.DeviceInfo]
Digilent 장치에 대한 DataAcquisition 생성
daq를 사용하여 DataAcquisition 객체를 생성합니다.
dq = daq("digilent")
dq =
DataAcquisition using Digilent Inc. hardware:
Running: 0
Rate: 10000
NumScansAvailable: 0
NumScansAcquired: 0
NumScansQueued: 0
NumScansOutputByHardware: 0
RateLimit: []
Show channels
Show properties and methods
아날로그 출력 채널 추가
장치 ID AD1 및 채널 ID 1를 사용하여 아날로그 출력 채널을 추가합니다. 측정 유형을 Voltage로 설정합니다. 기본적으로 출력 신호의 전압 범위는 -5.0~+5.0V입니다.
ch_out = addoutput(dq, "AD1", "1", "Voltage"); ch_out.Name = "AD1_1_out"
ch_out =
Index Type Device Channel Measurement Type Range Name
_____ ____ ______ _______ _____________________ ____________________ ___________
1 "ao" "AD1" "1" "Voltage (SingleEnd)" "-5.0 to +5.0 Volts" "AD1_1_out"
단일 샘플 생성
필요에 따라 단일 스캔을 생성합니다.
outVal = 2; write(dq, outVal);
DataAcquisition 속성 설정 및 출력 파형 정의
출력 스캔 레이트를 300kHz로 설정합니다.
rate = 300e3; dq.Rate = rate; % Generate a 10 Hz sine-wave for half a second. The length of the % output waveform and the specified output rate define the duration of % the waveform (totalduration = numscans / rate). f = 10; totalduration = 1; n = totalduration * rate; t = (1:n)/rate; output = sin(2*pi*f*t)';
데이터 생성
write(dq, output);