Closing ADC10 port from VBA

Post your VB and VBA discussions here
Post Reply
mrigger
User
User
Posts: 6
Joined: Thu Aug 31, 2006 2:51 pm

Closing ADC10 port from VBA

Post by mrigger »

Hi,

I am using a parallel port ADC10 to capture data directly into an Excel 2000 workbook. I am using the sample function (which calls the ADC1032.dll file) contained in the Excel workbook previously emailed to me by tech support.

My problem is that although the code works fine on a first pass, if I attempt to execute the code again I get a result saying 'Unable to open ADC'. An examination of the adc10_get_unit_info output returns a string of 'Pico.sys not found'. How do I close the ADC and then reopen it? If I close the workbook and then reopen it, this works, but I would rather do this through code. I have tried calling both the adc10_set_unit and adc10_close_unit statements, but they seem to have no effect. Any guidance & advice greatly appreciated!

Incidentally, I am using Excel 2000 (SP3) on a notebook running Windows XP (SP2).

Code: Select all


Option Explicit

Declare Function adc10_get_driver_version Lib "ADC1032.DLL" () As Integer

Declare Function adc10_open_unit Lib "ADC1032.DLL" (ByVal port As Integer, ByVal product As Integer) As Integer
Declare Function adc10_set_unit Lib "ADC1032.DLL" (ByVal port As Integer) As Integer
Declare Sub adc10_close_unit Lib "ADC1032.DLL" (ByVal port As Integer)

Declare Function adc10_get_unit_info Lib "ADC1032.DLL" (ByVal S As String, ByVal lth As Integer, ByVal line_no As Integer, ByVal port As Integer) As Integer

Declare Function adc10_get_value Lib "ADC1032.DLL" () As Integer

Declare Sub adc10_set_trigger Lib "ADC1032.DLL" (ByVal enabled As Integer, ByVal enable_auto As Integer, ByVal auto_ms As Integer, ByVal rising As Integer, ByVal threshold As Integer, ByVal delay As Integer)
Declare Function adc10_set_interval Lib "ADC1032.DLL" (ByVal us_for_block As Long, ByVal ideal_no_of_samples As Long) As Long
Declare Function adc10_get_values Lib "ADC1032.DLL" (values As Integer, ByVal no_of_values As Long) As Long
Declare Function adc10_get_times_and_values Lib "ADC1032.DLL" (times As Long, values As Integer, ByVal no_of_values As Long) As Long

Dim times(6000) As Long
Dim values(6000) As Integer
Dim S As String * 255
Dim i As Integer
Dim j As Integer
Public port As Integer
Public product As Integer
Public opened As Boolean


Regards,

Mark

mrigger
User
User
Posts: 6
Joined: Thu Aug 31, 2006 2:51 pm

....more info

Post by mrigger »

Hi again,

Browsing the forum, I cam across this post (albeit relating to an ADC11):

http://www.picotech.com/support/viewtopic.php?t=1159

....so obviously the problem I am experiencing has been around for quite a while. Is there no fix yet? after all this time? There must be a workaround for this other than having to close & reopen Excel.

Please advise!

Regards,

Mark

mrigger
User
User
Posts: 6
Joined: Thu Aug 31, 2006 2:51 pm

Re: ....more info

Post by mrigger »

mrigger wrote:Hi again,

so obviously the problem I am experiencing has been around for quite a while. Is there no fix yet? after all this time? There must be a workaround for this other than having to close & reopen Excel.
Anyone have anything to offer on this point? I still have not been able to resolve this issue, and it is causing me problems with some of my data capture needs.

Regards,

Mark

Post Reply