Taking reading from ADC-11 USB with VB.net

 
Post new topic   Reply to topic    Pico Technology Forum Index -> .Net Languages (C#, VB.Net, .)
Author Message
geraldh
Newbie


Joined: 10 Jan 2008
Posts: 1

PostPosted: Thu Jan 10, 2008 2:21 pm    Post subject: Taking reading from ADC-11 USB with VB.net Reply with quote

I am trying to read AC voltage levels from three channles of the ADC-11 with some current clamps in order to monitor a 3 phase electrical supply.

1mV of AC voltage equates to 1Amp of current usage on the probe.


I am using the blow code and it always read 0

Code:

Sub take_reading()
        Dim handle As Integer
        Dim opened As String
        'Dim S As String * 255
       
        handle = UsbAdc11OpenUnit()

        opened = handle <> 0

        If opened = True Then

            Dim reading As Double
            UsbAdc11GetValue(handle, 1, reading)
            main_form.CurrentPhase1Reading = adc_to_mv(reading)
            'MessageBox.Show("Took a reading on channel 1 and got" & reading)
            UsbAdc11GetValue(handle, 2, reading)
            main_form.CurrentPhase2Reading = adc_to_mv(reading)
            UsbAdc11GetValue(handle, 3, reading)
            main_form.CurrentPhase3Reading = adc_to_mv(reading)


            UsbAdc11CloseUnit(handle)

            main_form.numreadings = main_form.numreadings + 1
        Else
            MessageBox.Show("Can't open the Data Logger Device")
        End If
    End Sub



any ideas or pointers as to why I am only getting 0 would be much apprecieted.

Thanks

Gerald
Back to top
ziko
Site Admin
Site Admin


Joined: 01 Dec 2006
Posts: 606
Location: St Neots

PostPosted: Wed Jan 23, 2008 11:04 am    Post subject: Reply with quote

Hi Gerald,

I am not a programming expert however what I can say is that the ADC11 is not suitable for use with a current clamp which has a negative output as the ADC11 only measures 0-2.5V.

Kind regards
Back to top
gruntman
Guru
Guru


Joined: 28 Sep 2006
Posts: 96
Location: Garden City, KS USA

PostPosted: Fri Jan 25, 2008 5:11 pm    Post subject: Reply with quote

Gerald,

With the code that you attached you are opening the unit and then immediately calling for the values. You need to setup the unit first and make it run before calling for values.

The normal calling sequence to collect a block of data is as follows:
1 Check that the driver version is correct (optional)
2 Open the unit
3 Set trigger mode (optional)
4 Set sampling mode (channels and time per sample)
5.Run
6.Wait until ready
7.Get values
8.Close the unit

As you can see you are skipping steps 3-6. You will need to add these functions in in order to have your program function. I would recommend looking at the macros in the usbadc11.xls example as this will be close to what you are needing.

Regards,

Richard Boyd
Technical Specialist
http://www.pc-oscilloscopes.com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Pico Technology Forum Index -> .Net Languages (C#, VB.Net, .)
All times are GMT
Page 1 of 1

 


Pico Technology topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group