08-30-2010 06:50 AM
Hello,
I am new to PC control of instruments and I need to use AFG3102 to stimulate the oscilloscope in order to test it.
I've seen in previous posts that Visual Basic and C# may be used for PC control of AFG3102 but I would like to use VBA (for Excel) in order to be able to present the stimuli and results in the Excel sheets.
Can anybody help me with this? First, is it possible to control AFG3102 via VBA and Excel, and if yes, can anybody direct me how to do it?
Thanks in advance!
Solved! Go to Solution.
08-30-2010
07:39 AM
- last edited on
02-03-2025
09:10 AM
by
Content Cleaner
Hello Taniusha,
The IVI Specific Driver for your instrument can be found here. You should first install NI-VISA and NI-ICP from the current Device Drivers. Here is some additional documentation to help you get started:
Using IVI Specific Drivers in Visual Basic .NET, Visual C# or Visual Basic 6 Applications
Cheers,
NathanT
08-30-2010 08:59 AM
Hello NathanT,
Thank you very much for your quick reply.
I see, however, that all the links you suggested refer to Visual Basic. I need to control AFG3102 from VBA (Visual Basic for Applications) for Excel. Is there any way to do it not from VB but from VBA?
I need VBA because I need to present the inputs and outputs in Excel sheets and also, for VBA I guess I wouldn't need Visual Studio but only Excel.
Thanks again,
Taniusha
08-31-2010 07:47 AM
Hello Taniusha,
I am not well-versed in the differences and similarities between VB and VBA. Most any development environment will have a mechanism that allows you to call into external code, it is just might be easier for certain types of external code.
If you just need to store the data in an Excel file, there are other options outside of having your code execute in Excel. The simple implementation is to just store your data in a format that Excel can easily read. The more complex implementation is to use ActiveX to programmatically control Excel.
Cheers,
NathanT
09-01-2010 09:04 AM
Hi NathanT,
Thank you very much for your answers.
The reason why I prefer Excel VBA to VB is that for Excel VBA not only I can make the user interface easy to use and nice to look, but for Excel VBA I don't need to buy any Visual Studio or similar environment. I found the instructions how to use Matlab, as well, but Matlab applies to the same story: it needs to be payed for.
So that is why I am trying to figure out how to control AFG3102 only through Excel VBA.
Having in mind the problem of buying any addition software, could you (or anybody else) reccomend any other solution, appart from VB or Matlab?
Thank you very much,
Regards,
Taniusha
09-01-2010 09:10 AM
@taniusha wrote:
Hi NathanT,
Thank you very much for your answers.
The reason why I prefer Excel VBA to VB is that for Excel VBA not only I can make the user interface easy to use and nice to look, but for Excel VBA I don't need to buy any Visual Studio or similar environment. I found the instructions how to use Matlab, as well, but Matlab applies to the same story: it needs to be payed for.
Microsoft offers free versions of their development tools. They're called the "Express" editions. They can create applications just like the full Visual Studio, but they have some limitations, such as using Click-Once technology for installations. I use the C# one at work (for development of in-house programs, not for instrument programming).
09-02-2010 08:11 AM
Hello Taniusha,
smercucuio's suggestion of the Express editions is a good one. My favorite solution for instrument control is LabVIEW, which is has a full featured evaluation license for 30 days. If you are a student, you can check and see if your school might already has an academic site license for LabVIEW.
Cheers,
NathanT
09-10-2010 03:24 AM
NathanT, smercurio_fc,
Thank you very much for your help!
I have succeeded in sending commands from VBA to AFG3102. For now, it is only to see if connection is obtained, so I still have to work on sending the generated waveforms.
I have installed TekVISA and used the ActiveX control: I added Tvc1 to a UserForm in VBA and now I can use Tvc1's methods and properties. I found the method to receive a waveform from an oscilloscope (GetWaveform method) but I still need to find a method to send the generated waveform to a signal generator.
Thanks again
09-10-2010 09:21 AM
Hello taniusha,
I am happy to hear that you are successfully communicating with your instrument.
Cheers,
NathanT