Test and Measurement Forum

ADC-12 drivers and Windows XP

Having problems ? let us know the details here

ADC-12 drivers and Windows XP

Postby Robban » Thu Aug 18, 2005 6:05 am

Hello

I have just received an instrument from Sweden for measuring the Z-Toughness of paper. I need not go into the technical details of this application - suffice it to say that the instrument output is in the form of a 0-1V signal. This is read via an ADC-12 converter. The test routine is run using a macro developed several years ago (1998) that enables the voltage signal to be sampled for the duration of a test (usually only a few seconds). The macro runs well on my laptop, which has Windows 98 and Excel 97. However, it does not run on my desktop, which has Windows XP Version 5.1 (Build 2600.xpsp_sp2_gdr.050301.1519:Service Pack 2 and Excel 97 SR-2. It also doesn't run on on my customers desktop with Windows XP Professional 5.1.2600.Service Pack 1 Build 2600 and Excel 2003 (11.6355.6360).

I suspect that the problem originates from the ADC1032.dll file. I have tried visiting the PICO site to pick up the latest version of the software (webplw32_r5_12_4.exe) and have also tried an archived version (webplw32_r5_11_08.exe). I notice that the versions of ADV1032 are different for these downloads, but neither will work.

I have tried running PicoLog Recorder to capture the signal from the instrument, and have no problem at all. I have also opened Excel 97 and got a live feed via DDE using "=PLW|Current!Value", which works fine. So apparently this is not a hardware problem. In csae you ask, I have changed the LPT1 settings in my BIOS to I/O Range:378 and IRQ:7, as recommended.

Here is a copy of the code from the macro:



Attribute VB_Name = "Module1"

'
' Macro1 Macro
' Version 2.0
' Macro recorded 13Jul95 by Mike Green
' Updated 30May98 for new drivers
'

Declare Function adc10_get_driver_version Lib "ADC1032.DLL" () As Integer
Attribute adc10_get_driver_version.VB_ProcData.VB_Invoke_Func = " \n14"

Declare Function adc10_open_unit Lib "ADC1032.DLL" (ByVal port As Integer, ByVal product As Integer) As Integer
Attribute adc10_open_unit.VB_ProcData.VB_Invoke_Func = " \n14"
Declare Function adc10_set_unit Lib "ADC1032.DLL" (ByVal port As Integer) As Integer
Attribute adc10_set_unit.VB_ProcData.VB_Invoke_Func = " \n14"
Declare Sub adc10_close_unit Lib "ADC1032.DLL" (ByVal port As Integer)
Attribute adc10_close_unit.VB_ProcData.VB_Invoke_Func = " \n14"

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
Attribute adc10_get_unit_info.VB_ProcData.VB_Invoke_Func = " \n14"

Declare Function adc10_get_value Lib "ADC1032.DLL" () As Integer
Attribute adc10_get_value.VB_ProcData.VB_Invoke_Func = " \n14"

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)
Attribute adc10_set_trigger.VB_ProcData.VB_Invoke_Func = " \n14"
Declare Function adc10_set_interval Lib "ADC1032.DLL" (ByVal us_for_block As Long, ByVal ideal_no_of_samples As Long) As Long
Attribute adc10_set_interval.VB_ProcData.VB_Invoke_Func = " \n14"
Declare Function adc10_get_values Lib "ADC1032.DLL" (values As Integer, ByVal no_of_values As Long) As Long
Attribute adc10_get_values.VB_ProcData.VB_Invoke_Func = " \n14"
Declare Function adc10_get_times_and_values Lib "ADC1032.DLL" (times As Long, values As Integer, ByVal no_of_values As Long) As Long
Attribute adc10_get_times_and_values.VB_ProcData.VB_Invoke_Func = " \n14"
Global strip As Integer 'provremsans nummer
Dim times(100) As Long
Dim values(100) As Integer
Dim S As String * 255
Public port As Integer
Public product As Integer

Function adc_to_mv(value As Integer) As Integer
Attribute adc_to_mv.VB_ProcData.VB_Invoke_Func = " \n14"
If product = 10 Then
adc_to_mv = value * 5000# / 255
Else
If product = 12 Then
adc_to_mv = value * 5000# / 4095
Else
If product = 40 Then
adc_to_mv = (value - 128) * 5000# / 127
Else
If product = 42 Then
adc_to_mv = (value - 2048) * 5000# / 2047
End If
End If
End If
End If
End Function


Sub GetAdc10()
Attribute GetAdc10.VB_ProcData.VB_Invoke_Func = " \n14"

' Open the ADC-10 on LPT1
'Global rad As Integer
'Dim rad As Integer
port = 1
product = 12
'Number = 50 'number of readings
Number = 100 'number of readings
If product = 12 Then
trig = 15 ' Trig level
Else
If product = 42 Then
trig = 2063 ' Trig level
End If
End If

opened = adc10_open_unit(port, product) <> 0 'Open ADC-10 driver

'For i = 0 To 3
' j = adc10_get_unit_info(S, 255, i, port)
' Cells(18 + i, "E").value = S
'Next i

If opened Then 'Check driver opened ok

' Enable trigger
' Auto trigger after 1 second
' Trigger on rising edge at 128 adc counts (128=2.5V on ADC10)
' No delay
'Call adc10_set_trigger(True, True, 1000, False, 128, 0)
'Call adc10_set_trigger(True, False, 0, False, Trig, 0)
i = adc10_get_value
While i < trig
Cells(3, 3) = "Waiting for signal"
i = adc10_get_value
Wend
Cells(3, 3) = "Measuring"

' Say that we want to take 100 readings in 10000us
Call adc10_set_interval(2000000, Number)

' Get a block of 100 readings...
' we can call this routine repeatedly
' to get more blocks with the same settings
'Call adc10_get_times_and_values(times(0), values(0), 100)
Call adc10_get_times_and_values(times(0), values(0), Number)

' Copy the data into the spreadsheet

For i = 0 To Number - 1
Cells(i + 4, "A").value = times(i)
'Cells(i + 4, "B").value = values(i)
Cells(i + 4, "C").value = adc_to_mv(values(i))
Next i

' You can take a single reading like this...
' i = adc10_get_value ' uncommented by tsa
Call adc10_close_unit(port) ' added by tsa
Else
'Cells(17, "E").value = "Unable to open ADC"
Cells(3, 3).value = "Unable to open ADC" ' changed by tsa
End If

End Sub



Hope that you can follow this. Interestingly, when I run this macro it waits for a signal as it should, but as soon as the signal from the instrument deviates from close to 0V I get a runtime error 6 (overflow). Don't know it that observation helps!

As I said, I have tried several versions of ADC1032, but with no luck. Can you see what is wrong in the macro?

Many thanks

A very frustrated Robban
Robban
 

Postby Michael » Mon Aug 22, 2005 10:42 am

Hello

Thank you fpr your post.

I have inserted your module text into MS Excel for analysis but did not have the same results as you have indicated.

I am running XP pro with Excel 2002.

Have you tried the drivers from our manuals and drivers section?

I downloaded this file and added your GetAdc10 sub as a new sub and renamed to Sub NewGetAdc10 and it executed without error even with near zero values.

Below is the sub I added to the above downloaded macro:

Sub NewGetAdc10()
'Attribute GetAdc10.VB_ProcData.VB_Invoke_Func = " \n14"

' Open the ADC-10 on LPT1
'Global rad As Integer
'Dim rad As Integer
port = 1
product = 12
'Number = 50 'number of readings
Number = 100 'number of readings
If product = 12 Then
trig = 15 ' Trig level
Else
If product = 42 Then
trig = 2063 ' Trig level
End If
End If

opened = adc10_open_unit(port, product) <> 0 'Open ADC-10 driver

'For i = 0 To 3
' j = adc10_get_unit_info(S, 255, i, port)
' Cells(18 + i, "E").value = S
'Next i

If opened Then 'Check driver opened ok

' Enable trigger
' Auto trigger after 1 second
' Trigger on rising edge at 128 adc counts (128=2.5V on ADC10)
' No delay
'Call adc10_set_trigger(True, True, 1000, False, 128, 0)
'Call adc10_set_trigger(True, False, 0, False, Trig, 0)
i = adc10_get_value
While i < trig
Cells(3, 3) = "Waiting for signal"
i = adc10_get_value
Wend
Cells(3, 3) = "Measuring"

' Say that we want to take 100 readings in 10000us
Call adc10_set_interval(2000000, Number)

' Get a block of 100 readings...
' we can call this routine repeatedly
' to get more blocks with the same settings
'Call adc10_get_times_and_values(times(0), values(0), 100)
Call adc10_get_times_and_values(times(0), values(0), Number)

' Copy the data into the spreadsheet

For i = 0 To Number - 1
Cells(i + 4, "A").value = times(i)
'Cells(i + 4, "B").value = values(i)
Cells(i + 4, "C").value = adc_to_mv(values(i))
Next i

' You can take a single reading like this...
' i = adc10_get_value ' uncommented by tsa
Call adc10_close_unit(port) ' added by tsa
Else
'Cells(17, "E").value = "Unable to open ADC"
Cells(3, 3).value = "Unable to open ADC" ' changed by tsa
End If

End Sub


I am sorry I cannot shed any more light on this for you.

Please don't hesitate to continue this conversation through our tech support service. Send your email to tech@picotech.com

Best regards,
Michael - Tech Support
Michael - Tech Support
Pico Technology
Web Support Forum
Michael
Zen Master
Zen Master
 
Posts: 656
Joined: Thu Jul 07, 2005 12:41 pm
Location: St Neots, Cambridgeshire


Return to Getting Started

Who is online

Users browsing this forum: No registered users and 0 guests