Skip to main content
Skip table of contents

Recording an incoming analog signal

Our second example configures the ADC to record three channels of incoming analog signal for 4 seconds, and imports the results. First, we configure the recording schedule using setAdcSchedule:

MATLAB
%Connect to hardware
Datapixx('Open');

scheduleOnset = 0;
scheduleRate = 200000;
maxScheduleFrames = scheduleRate*4;
channelList = [ 0 1 2; 0 0 0]; %Our three channels and reference points
bufferAddress = 4e6;
Datapixx('SetAdcSchedule', scheduleOnset, scheduleRate, maxScheduleFrames, channelList, bufferAddress);
Datapixx('RegWr');

Now that our schedule is configured, we can record immediately:

MATLAB
Datapixx('StartAdcSchedule');
Datapixx('RegWr');

WaitSecs(4);

Datapixx('StopAdcSchedule');
Datapixx('RegWrRd')

Here we use a register update, or write-read, to ensure that we receive an up-to-date copy of our device information after writing to the device with our commands.

Next, we can import our collected bufferData and optionally plot it.

MATLAB
[bufferData, bufferTimetags,~,~] = Datapixx('ReadAdcBuffer', maxScheduleFrames, bufferAddress);

plot(bufferTimetags, bufferData);

Don’t forget to close the connection to the hardware at the end of the session.

MATLAB
Datapixx('Close');

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.