Test and Measurement Forum

2205 Function Generator via VBA excel

Post your VB and VBA discussions here

2205 Function Generator via VBA excel

Postby traegeaf » Wed Dec 03, 2008 10:07 pm

Is it possible to use output the function generator via excel.

I'm having trouble attempting to do this since the PS2000_WAVE_TYPE and PS2000_SWEEP_TYPE are not usable in vba to my knowledge.


Thanks
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby traegeaf » Mon Dec 15, 2008 12:51 am

I did want to say that I just tryed passing the integer value of the wave type, but that caused a crash. Am I right to assume the DLL requires the enumeration?

To get around this I wrote a chunk of code as a C++ app.
I would like to use the shell command to open this app and pass it the handle and another number, I have written all this code and it is functional besides one part:

The picoscope functions fail to work within the C++ app even though it is passed the handle.

Is this not possible? I am not fully familiar with DLLs and figured this should work, and still think it should. I can attach code if that would help.

For debugging, I have an ps_2000_open_unit() and close_unit(handle)
and the rest of my code works. With this I can use the function generator and all is well. But I really need to get this to work without having to close the scope in vba first due to the other issue I'm having and have already posted on the fourm with no solution.

Thanks
-Adam
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby traegeaf » Tue Dec 16, 2008 5:18 pm

With a little more work, I converted my application into a DLL and called it from VBA with good results.

I'm assuming the driver only listens to one thread/application once it is opened, is this correct?

-Adam
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am

Postby ziko » Fri Jan 09, 2009 5:28 pm

Hi traegeaf,

Bit of a late response but to answer your question. Im not quite with the lingo, but If I understand correctly you mean that only one application can call the unit at any time, if so then that is true.

Kind regards
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Postby traegeaf » Fri Jan 09, 2009 5:53 pm

Thats what I was trying to get at. Thanks for the responce.


For future builds of the dll file, I fell it would be nice to have the function generator dll functions be able to be called from vba. By allowing the numerical value of the wave type and sweep type to be used in the function call. This would be helpful for those using VBA as it would alow a more novice programmer to still write full function programs.


Thanks again for all the help.
-Adam
traegeaf
Active User
Active User
 
Posts: 14
Joined: Thu Nov 13, 2008 12:45 am


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests