Author Topic: Rohde & Schwarz CRTU/CMU200 GPIB control  (Read 16510 times)

0 Members and 2 Guests are viewing this topic.

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 926
  • Country: ch
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #25 on: December 07, 2015, 04:21:19 pm »
Once back again at CRTU GPIB dumping...especially as my first CRTU doesn't accept my 128MB CF cards anymore for printing...

Is the array size always constant when capturing the RF spectrum?

Code: [Select]
#!/usr/bin/python

import sys
import Gpib

filename = sys.argv[1]

target = open(filename, 'w')

crtu = Gpib.Gpib('crtu')

print "Writing to CRTU\n"

crtu.write("1;INITiate:SPECtrum")
crtu.write("1;SENSe:SPECtrum:FREQuency:CENT 2432 mhz")
crtu.write("1;SENSe:SPECtrum:FREQuency:SPAN 50 mhz")
crtu.write("1;READ:ARRay:SPECtrum?")

print "Reading from CRTU\n"

bytes = 200

target.write(crtu.read(bytes))
count = 0

while crtu.ibcnt() == bytes:
print 'Bytes read: ',count
target.write(crtu.read(bytes))
count += bytes

print '\nFinished dumping...        '

print "Going local\n"
crtu.write(crtu, "*GTL")

target.close()

Problem here with the code is that it times out when the CRTU has finished sending the RF data...so the script bails out and never send the "goto local" command...

Hard to believe that there isn't a "screen dump" command like other devices have like the E4406A...
« Last Edit: December 07, 2015, 04:40:51 pm by davorin »
 

Online _Wim_

  • Super Contributor
  • ***
  • Posts: 1555
  • Country: be
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #26 on: December 14, 2015, 09:00:13 pm »
Okay...since now GPIB works with the CRTU-RU....I browsed a little through the CMU200 operation manual and the examples here....

I mostly get either "invalid header" or "query unterminated" errors on the screen.

So far as I understood you always need to prefix a "1;" if you want to talk to the RF section of the instruments and assign it in the "remote setup"...

Normal to see those errors? At least it seems to accept for example setting RF gen frequency...though reading back omits the first character:

Code: [Select]
ibterm>1;SOUR:RFG:FREQ 868 MHZ
ibterm>1;SOUR:RFG:FREQ?
.680000E+008
ibterm>1;SOUR:RFG:FREQ?
8.680000E+008

Hi,

I was also struggling with the -113 , "undefined error" (using windows and a CMU200, connected though an agilent 82357B usb adaptor). In my case, the solution was instead of using the 1; prefix, to use 9; prefix because this prefix defines the secondary GPIB address, and the default secondary addres for RF-non signaling was "9" for the CMU200.

I do not own a CRTU, but if you check the remote setup for seconday addresses to see what number is defined for RF (by default).
 

Offline fisafisa

  • Regular Contributor
  • *
  • Posts: 106
  • Country: es
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #27 on: December 15, 2015, 09:11:54 pm »
Using GPIB, can you use both RXTX chains?

Ciao
F
 

Online _Wim_

  • Super Contributor
  • ***
  • Posts: 1555
  • Country: be
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #28 on: December 15, 2015, 09:53:48 pm »
Did not try this yet, but from a quick glance at the user manual, I would expect this to be no problem. I am still a vey beginner at GPIB, so progress is slow...
 

Offline fisafisa

  • Regular Contributor
  • *
  • Posts: 106
  • Country: es
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #29 on: December 16, 2015, 08:29:58 pm »
It would be nice to see if one can activate both TX on different ports.
Acquiring both RXs on different port would be nice too.
 
 

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 926
  • Country: ch
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #30 on: June 29, 2016, 05:03:40 pm »
Okay...since PHP5 works nicely with GPIB and my NI GPIB card...thought I give this one a new try (o;

A quick PHP hack drawing the spectrum of my CRTU-RU....

Code: [Select]
<?php
$string "";
$image "";

$u ibfind("crtu");
ibpad($u20);
ibsad($u97);
ibwrt($u"1;INITiate:SPECtrum");

ibwrt($u"1;READ:ARRay:SPECtrum?");
while($r ibrd($u$string1000))
{
$count ibcnt();
$image .= $string;
if($count 1000)
break;
}
ibwrt($u"*GTL");

$spectrum explode(","$image);
$min 0;
$max = -1000;
foreach($spectrum as $value)
{
$point number_format((float)$value5);
$rf[] = $point;
if($min $point)
$min $point;
if($point $max)
$max $point;
}
// echo "Min: " . $min . "\n";
// echo "Max: " . $max . "\n";

$im = @ImageCreate (560512);
$background_color ImageColorAllocate ($im234234234);
$graph_color ImageColorAllocate ($im,25,25,25);

$x1 0;
$x2 0;
$y1 0;
foreach($rf as $pixel)
{
$y2 150 $pixel;
if($x2)
{
imageline ($im$x1$y1$x2$y2$graph_color);
// echo "<pre>Drawing from " . $x1 . ":" . $y1 . " to " . $x2 . ":" . $y2 . "</pre>";
}
$y1 $y2;
$x1 $x2;
$x2++;

}
header ("Content-type: image/jpg");
ImageJPEG ($im);
?>


Much to improve though...but as a first start not bad...takes around 300msec to render the image:

 

Offline davorinTopic starter

  • Supporter
  • ****
  • Posts: 926
  • Country: ch
Re: Rohde & Schwarz CRTU/CMU200 GPIB control
« Reply #31 on: August 10, 2016, 05:04:43 pm »
A little better now (o;

Though some hardcoded values yet due to laziness (o;

 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf