Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

HP3561A:Conversion Binary data in Decimal data

Hello,
 
I try to transform, with Visual BASIC 6, a variable in binary data acquired by order "DSTB" of Dynamic Analyzer HP3561A,
in decimal data to then use it in Excel.
 
Could you help me to carry out this transformation, because for the moment I pain a little. 
 
Thank you in advance. 
Cordially Xavier VACHERET
0 Kudos
Message 1 of 6
(9,405 Views)
Hello Xavier,
 
It is difficult to answer you since I don't know how is defined your binary data types, nevertheless you have come functions in Visual Basic 6.0 that enable to convert data types. To get a decimal data, you can try CDbl(expression) or CDec(expression).
 
Best regards,
 
0 Kudos
Message 2 of 6
(9,382 Views)
If the "BINARY" means the data of IEEE488.2-defined block data format, you must crack the binary contents into appropriate numeric array.  In this case the simplest way is declare a struct type variable using VB6 "Type" keyword, containing Byte, Integer, Long, or Double arrays or any others as need, then acquire the binary contents storing into the struct variable. 
0 Kudos
Message 3 of 6
(9,374 Views)

Hi Xavier,

 

If your still interested I found some old source code I wrote a while ago for an hp3561a.

It's written in C++ but you should be able to make some sense of it.

Let me know if you need any help

//BEGIN CODE

short tracedata[401];
 char buffer[1028];
 short wordval = 0;

 if ( m_nDev > 0 )
  {
  
 
  ibwrt(m_nDev, "DSTB;\n", 6); //dump binary trace data
  ibwait(m_nDev, CMPL);
  ibrd(m_nDev,  (void**) buffer, len);
  //add null terminator, ibcntl is a ni gpib value
  buffer[ibcntl] = '\0';

  
  if(ibsta & ERR){
      err = "Unable to read from device!";
      *(strError->pbstrVal) = err;
      AtlTrace( "GetData: ibrd error ibsta = %ld ERR = %ld\n",ibsta, ERR);
      *ReturnVal = FALSE;return S_OK;}
  
  //convert values to word(short int)
  j=0;
  
  //Xavier
  //At this point you need to do a byte swap
  //the HP3561A uses an old Motorola processor
  //Remember big endian and little endian stuff!!!
  //any way do some thing like this
  //the actual trace data starts at byte 5
  //before that is header information

  for(i=4;i<=805;i++)
  {
   byte1 = buffer[i];
   byte2 = buffer[i+1];
   wordval = ((byte1 *256) + byte2); // -65536;
   tracedata[j] = wordval ;
   j++;
   i++;
  }

}
 
//END CODE
 
I hope this helps
 
Curt
0 Kudos
Message 4 of 6
(9,322 Views)

Hi Xavier,

One more thing...

Multiplying each value in the tracedata array by .005 will give you the value in dBV that you see on the front

of the analyzer display screen

Curt

0 Kudos
Message 5 of 6
(9,322 Views)

Hello with all

 

I thank you for your messages.

After some research, here the method which I found to obtain measurements of analyzer HP3561A.

 

to see the file joint 

 

Perhaps that is not very academic, but that functions.

 

Thank you has all. 

Cordially

Xavier

0 Kudos
Message 6 of 6
(8,924 Views)