NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Binary search using TestStand or LabVIEW

Hi there,

 

I need to find the gain of an operational amplifier. I have a functional test system using NI PXI and as software LabVIEW V8.5 and TestStand V4.0

 

How do I implement the following code in TestStand?

 

Perform a “binary search” type of procedure to find the limit of the input range, to a resolution of about 20mV.

For the differential amplifier positive signals (i.e. above 2.5V) the limits of the search range are +3V to +5V.

Go round the loop 7 times, each time round the loop halves the search range.

27 = 128 so starting with a 2V range the final result will be within about 2÷128 = 15.6mV of the true value.

See BinarySearch.xls for an example in excel of how the search works.

 

low = +3V

high = +5V

count = 7

do

            vpos  = (low + high) / 2

            vneg = vpos -1

            if output ok  then low = vpos

            else if output not ok then high = vpos

            count = count -1

while count > 0

output vpos

 

count = 7

For count = 1 to 7 #### either integer count or define step size =1 

            vpos  = (low + high) / 2

            vneg = vpos -1

            if output ok  then low = vpos

            else if output not ok then high = vpos

            count = count -1

Next count

output vpos

 

I have started to implement in TestStand up to, please see attachment.

 

Any suggestion are very welcome.

 

Thank you for your time.

 

 

Marken

 

 

0 Kudos
Message 1 of 3
(3,440 Views)

I'd recommend doing this algorithm in LabVIEW as this is will be significantly slower in TestStand.

CTA, CLA, MTFBWY
0 Kudos
Message 2 of 3
(3,382 Views)

Hi Snowpunter,

 

Thanks for your replay.

 

I will try to do it in LaVIEW but I am not that skilled. So if I get stuck can I post the vi and maybe you can give me some hints?

 

Regards

Marken

0 Kudos
Message 3 of 3
(3,371 Views)