Test and Measurement Forum

VB.NET and adc100_get_unit_info

Post general discussions on using our drivers to write your own software here

VB.NET and adc100_get_unit_info

Postby onissine » Mon Mar 13, 2006 2:34 pm

HI

I can't get unit info. I always get object reference not set to an instance of an object message. I have tried this using Char data type, varianttype and object types but its not working.

Dim whyNotOpened As String
Dim port, portOpened as integer
port = settings.port

portOpened = adc100_open_unit(port)

If portOpened = 0 Then
For i = 0 To 3
j = adc100_get_unit_info(whyNotOpened, 255, i, port) 'Error!
MsgBox(whyNotOpened)
Next i
End If
onissine
User
User
 
Posts: 2
Joined: Mon Mar 13, 2006 2:26 pm

Postby Michael » Tue Mar 14, 2006 9:40 am

Hello,

YOu may beed to check your syntax here. And also ensure you have installed the pico.sys and you are using the correct parallel port mode(Normal, output only or standard).

Best regards,
Michael
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

Postby onissine » Wed Mar 15, 2006 7:12 am

Hi

I still have problems with adc100_get_unit_info and I know that there is something wrong in my syntax but what it is?

The other problem I have is that this function always return TRUE even if Pico unit is not attached to computer and it causes other problems in my program.

I can get the adc100 working so drivers etc. are no problem. I want to make the program more robust and for that I need to know what Pico unit is doing.

Thanks for any help

Public Function openPico(ByVal settings As settings, ByVal mainForm As mainForm) As Boolean
Dim port, i, j As Integer
Dim portOpened As Boolean
Dim buffer(255) As Char
Dim whyNotOpened As String
port = CInt(settings.getField("port"))
adc100_close_unit(port)
portOpened = adc100_open_unit(port)
If portOpened = False Then
For i = 0 To 3
j = adc100_get_unit_info(buffer, 255, i, port)
whyNotOpened = New String(buffer)
mainForm.writeMessage(whyNotOpened)
Next i
End If
adc100_set_range(CInt(settings.getField("channel1Range")) * 1000, CInt(settings.getField("channel2Range")) * 1000)
Return portOpened
End Function
onissine
User
User
 
Posts: 2
Joined: Mon Mar 13, 2006 2:26 pm

Postby Michael » Mon Apr 03, 2006 8:59 am

Hello,

Give your 'Dim buffer(255) As Char' declaration a bit more room. Change the buffer size to >256. The string length has to be a minimum of 255. Make it larger and this should cure the problem.

Best regards,
Michael
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 General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests