AnsweredAssumed Answered

Problems when using matlab to connect Agilent scope with multi-channels

Question asked by lixiaozhou222 on May 20, 2012
Latest reply on May 22, 2012 by algoss
Dear everyone, 
I am using matlab to connect Agilent 9000X scope, I have two signals connected to CH1 and CH2, respectively.
My purpose is to get data from both 1 and 2 channel using matlab.

When I use the following script to read data from a single channel CH1, it works well.

+fprintf(obj1,':DIGITIZE CHANNEL1');+
+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL1');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+A=binblockread(obj1,'int8');+ 

But the problem is, if I change CH1 to CH2, then warning is, ''a time out occured before binblockread.''

+fprintf(obj1,':DIGITIZE CHANNEL2');+
+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL2');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+A=binblockread(obj1,'int8');+ 

NOTE that I just read a single channel in the previous 2 cases.
Why does that happen? I just change 'CHANNEL1' to 'CHANNEL2', and nothing else is different.....
Thank you for kind help!

By the way, If I want to read data from CH1 and CH2 the same time, could I run it like this:

+fprintf(obj1,':DIGITIZE CHANNEL1');+
+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL1');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+A=binblockread(obj1,'int8');+

+fprintf(obj1,':DIGITIZE CHANNEL2');+
+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL2');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+B=binblockread(obj1,'int8');+ 

Or in this way:

+fprintf(obj1,':DIGITIZE CHANNEL');+

+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL1');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+A=binblockread(obj1,'int8');+

+fprintf(obj1,':WAVEFORM:SOURCE CHANNEL2');+
+fprintf(obj1,':WAVEFORM:FORMAT BYTE');+
+fprintf(obj1,':WAVEFORM:DATA?');+
+B=binblockread(obj1,'int8');+ 

In what way can I make sure CH1 and CH2 are read synchronously? 


Well, we still need to solve the 'time out' problem at first.

Edited by: lixiaozhou222 on May 20, 2012 11:37 PM

Edited by: lixiaozhou222 on May 20, 2012 11:43 PM

Edited by: lixiaozhou222 on May 20, 2012 11:44 PM  

Outcomes