Test and Measurement Forum

Volts range

Post your VB and VBA discussions here

Volts range

Postby gtfa » Fri Jan 16, 2009 5:33 pm

Hello,
I have an ADC-100 and I'm using Windows XP with Visual Basic 6 SP6. I'm developing a program to measure the sound tension using a digital decibilimeter with a microphone connected to the ADC-100. I would like to have the tension in Volts but the manual just tell me how to convert the values in mili-Volts. So, do any of you know any procedure that converts the tension to Volts instead of mili-Volts?

Thanks!
gtfa
User
User
 
Posts: 3
Joined: Fri Jan 16, 2009 5:27 pm

Postby gruntman » Fri Jan 16, 2009 6:56 pm

gtfa,

The ADC-100 has a 12 bit ADC inside of it. The driver outputs the counts from this ADC with values ranging from 0-4095. 0 would be the farthest negative value and 4095 would be the farthest positive. So if you are on the ±20V scale 0 would be -20V and 4095 would be +20V. To convert the ADC counts to volts you would use the following formula.
(ADC Count -2048) X Selected Voltage Range / 2048 = Voltage Reading.

So, if on the ±20V scale and a ADC reading of 1233 the formula would look like this:
(1233 - 2048) X 20 / 2048 = -7.958984375V

To ensure accuracy of your experiment I would leave the trailing numbers intact in your program. If however you still wish to have only voltage values and not the trailing numbers simply use Visual Basics round function to round the number up to the next whole number.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby gtfa » Mon Jan 19, 2009 11:25 am

Thanks Richard! I'll try this one!
But I've been thinking here, and the program PicoFull has the option Auto range so it adjusts the volts range automatically according to the signal you're inputting. Is there anyway to use that procedure in a VB or VBA program? If so, how can I do that?
Thanks again!
gtfa
User
User
 
Posts: 3
Joined: Fri Jan 16, 2009 5:27 pm

Postby gruntman » Mon Jan 19, 2009 5:34 pm

gtfa,

The auto range function is a procedure setup in the PicoScope software. This isn't unfortunately a function that the unit does automatically. You can write your own function in VB to achieve basically the same thing. Essentially, you have your program look at the ADC counts and if one of the counts is returned as 0 or 4095 (which means it is taking values at the max available for the selected input range) it simply automatically on the next loop makes adc100_set_range go up one range so it is no longer out of range. On the other side if your max is less than 3072 and more than 1024 then on the next loop you can tell the adc100_set_range to lower the range by one. Hope this helps.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm


Return to VB and VBA (Excel, Access)

Who is online

Users browsing this forum: No registered users and 0 guests