Comm32 Logo
Home Button  Buy Button 

Topic:   Prologix USB-GPIB Control

By: WK 3260B GPIBPosted on: Jun 14 2018 at 08:44:38 AM
I'm trying to interface with a Wayne Kerr 3260B LCR using GPIB in Excel VBA. I have added SComm32 to my VBA project, and am just trying to test simple commands each controlled by a button. Here is the code, each sub is assigned to a button. I always click Initialize first but it gives me an error on the object creation.


Sub Button1_Click()
Send (":IMP:FREQ 10k")
End Sub

Sub Button2_Click()
Send (":IMP:FREQ 100k")
End Sub

Sub Button3_Click()
Send (":TRIG")
End Sub

Sub Button4_Click()
Initiate_SComm
End Sub

Sub Initiate_SComm()
Set SCommWK = CreateObject("SCommLib.SComm")
SCommWK.CommPort = 4
SCommWK.Settings = "115200,8,N,1"
End Sub

Function Send(value As String)
SCommWK.PortOpen = True
SCommWK.Output = value & Chr(13)
SCommWK.PortOpen = False
End Function


Any help will be greatly appreciated. I am not familiar with Serial Communication or GPIB, and don't even know where to begin for taking input.

By: WK 3260B GPIBPosted on: Jun 14 2018 at 09:51:00 AM
I figured out my issue, I was simply doing the Settings in the incorrect order. I had copy pasted those settings from another post on this forum.

Now I just cannot get reading data to work, but sending works fine.

By: GuestPosted on: Jun 19 2018 at 11:55:50 AM
I just want to mention that if you do this

SCommWK.PortOpen = True
SCommWK.Output = value & Chr(13)
SCommWK.PortOpen = False

then there is every chance that you'll be closing the serial port before all the bytes have been sent. The lines execute so fast and you're hitting the PortOpen=False before the data has even gotten through the buffers.

Your question about receiving. Just call the .Input method.
If you want to know 'when' to call .Input then you could repeatedly check .InbufferCount on a timer to see if any data is waiting to be received. Or setup the OnComm event which notifies you when data is waiting to be received.

By: WK 3260B GPIBPosted on: Jun 19 2018 at 03:04:51 PM
Everything has sent just fine using that method so far. I don't understand how the data is being sent/received using the Prologix controller. The documentation has very little information how the data is processed and sent back to the computer.

By: GuestPosted on: Jun 20 2018 at 08:15:34 AM
If your code executed that .PortOpen=False before the data was sent you wouldn't get any error. The data would just be corrupted and/or discarded without any error being triggered.

So. Even if it does 'appear' to work now. For reliability I'd still suggest waiting a moment before closing the port.

I've never heard of that device so I googled it.

On the side of that device it looks as though there's a couple of LEDs. Do they indicate data traffic? or just power on?

Do those LEDs indicate that data is coming in to the computer?
When data comes in to the computer the .SCommWK.InBufferCount will increase to show the number of bytes received.

It looks as though that device is some kind of BUS controller. I assume there's some communications protocol where one device is 'controller' and the other is (others are) 'device' so a kind of Master/Slave protocol. If you don't understand the protocol then no other device will talk to you anyway.


By: WK 3260B GPIBPosted on: Jun 26 2018 at 02:44:41 PM
I got it working. You were correct, I needed delays before closing the ports.

I also needed to change the controller settings.

Reply - add a comment to this topic.

You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected.

Topic:- Prologix USB-GPIB Control


Enter the numbers.

Your name here is optional