Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Read problem with HP 3314A Function Genterator

I am tring to interface to an old HP 3314A funtion genterator.  I am using VB to send and read data to the instrument.  I know that I am sending information properly because the instrument responds as expected.  However if I to a query command I get nothing but garbage back. 

 

I am totally new to GPIB and I am using the Power Supply/Write sample code to do this.  Maybe it is just the read code that is incorrect for the function gerneator?

0 Kudos
Message 1 of 4
(3,409 Views)

I am able to communicate with the 3314A by using the NI Interactive control.

 

Actually I have now determined that the problem is that when VB display the message it is imbedded with what I will call "garbage" and get displayed incorrectly.  For example:

 

If I request the current frequency the Generator is set for I get:

 

|FR 0000001000.HZ||||||||

 

Where | is a dark bar.  I would like it to simply be FR 00000001000.HZ

 

 

0 Kudos
Message 2 of 4
(3,401 Views)

Hi

 

The bars you're seeing are asii characters.  Probably space, tab or carriage return values.

Yuo just need to parse or splir the string to find the frequency

 

try this if your using VB.NET.  if you're using VB6 let me know I'll post that code

 

Try
            Dim strFrequency As String = "FR 12345.345HZ"
            Dim strArray() As String = Nothing
            Dim Frequency As Double
            Dim arrSeparators() As Char = {"R", "H"}

            strArray = strFrequency.Split(arrSeparators)

            Debug.WriteLine(strArray(0)) 'output F 
            Debug.WriteLine(strArray(1)) ' 12345.34

            Frequency = Convert.ToDouble(strArray(1))
            Debug.WriteLine("F= " & Frequency.ToString) 'F= 12345.345
        Catch ex As Exception
            Debug.WriteLine(ex.Message)
        End Try

 

 

Hope this helps

 

Curt

0 Kudos
Message 3 of 4
(3,390 Views)

Thanks for the reply and slow response.  I am using VB6, but I should be able to get the code to work on that.

0 Kudos
Message 4 of 4
(3,288 Views)