|
|
| Author |
Message |
onissine User

Joined: 13 Mar 2006
Posts: 2
|
Posted: Mon Mar 13, 2006 2:34 pm Post subject: VB.NET and adc100_get_unit_info |
|
|
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 |
|
| Back to top |
|
 |
Michael Guru

Joined: 07 Jul 2005
Posts: 93
Location: St Neots, Cambridgeshire
|
Posted: Tue Mar 14, 2006 9:40 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
onissine User

Joined: 13 Mar 2006
Posts: 2
|
Posted: Wed Mar 15, 2006 7:12 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Michael Guru

Joined: 07 Jul 2005
Posts: 93
Location: St Neots, Cambridgeshire
|
Posted: Mon Apr 03, 2006 8:59 am Post subject: |
|
|
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 |
|
| Back to top |
|
 |
|