actualy i want to control an amplifier by increasing or decreasing the gain depend on the out put,
I am using SR570 amplifier which include 28stage of sensetivity from 1pA to 1mA, and i am acquiring the out put by NI9222 data acquisition device.
at the begining i am selecting standard value for the senstivity, then if the out put with in some range of voltage ( 2 and 6), the selected senstivity will be used as default , else if the senstivity is greater than 6 the, that means the senstivity must be decrease to avoid amplifier overload, otherwise if the out put is lower than 2, the senstivity must be increase to insure enough out put amplitude.
this proceadure must be performed by increasing or decreasing one step of senstivity from the current senstivity.
my problem is that i can do that proceadure for only one time ( refer to the vi), because i couldn't find the better programing proceadure to increase or decrease senstivity by one step from the current condition. so can you share me some hint to solve that???
any help will be appreciated.
Solved! Go to Solution.
You have several problems which all interact with each other.
1. The DAQ Assistant timing is set so that you need the loop to run almost 1000 times per second to avoid losing data or getting a buffer overload.
2. While I am not familiar with the SR570, I doubt very much that it can receive a change of sensitivity command, execute the change, and have the output settle to a new value in 1 millescond.
3. Each time through the loop, the sensitivity starts from the value on the front panel control (50 uA/V) and changes by 0, +1, or -1. Nothing in there "remembers" what the previous setting was.
Fixes: Start with item 2. Find out how long it takes to send a command to the instrument, how long it takes the instrument to change its sensitivity, and how long it takes the output to settle after the change. You cannot do anything faster than the sum of those times.
Next, consider the frequency of the signal you are measuring. Set the DAQ acquisition so that at least one complete cycle (if AC) is captured at the lowest frequency. If the signal is DC, consider the fastest rate at which it can change. Also consider any noise or interference which may be present with the signal. These all affect the length of the data set you must take.
You have not provided any of this information, so we cannot suggest suitable settings.
For Item 3 learn to use shift registers. In LabVIEW the shift register is used to pass a value from one iteration of a loop to the next.
!!! Do not use loops which run forever. Replace the false constant at the loop termination terminal with a front panel Stop button. Also wire the Stop button to the stop input of the DAQ Assistant. This allows the DAQ Assistant to shut down the DAQ device in an orderly manner. You may want to reset the SR570 to a default sensitivity before shutting down.
You may want to do some error checking. If the sensitivity changes to one of the end values and the signal is still not in range, repeatedly trying to change it further is useless. Give a message to the user, who cna then decide what to do.
Appreciate your response,
I consider your advice and try to find out the 3 points you mentioned:
at first regards to the time consumbtion of sending command to the instrument , instrument response to the new command and settle to the new senstivity value , this cycle takes 21 millisecond.
Secondly: the frequency of the measured signal is 5 KHz.
lastly: i am try using shift register, but if i set the senstivity value to 200 nA for example, it will execute the third case and stop without acheive the expected goal that the senstivity will continue increase or decrease untill the max value became within the desired range.
So did you think i have to add another case structure , or only one case is enough for toggling through the different 28th values of senstivity untill the max value became true ?
have a fruitfull day
The shift regsiter should be on the outer while loop. The For loop which only runs one iteration does nothing and can be eliminated. By moving the Sensitivity control terminal out of the loop and wiring it to the shift register the shift register is initialized to the starting value set on that control. However, no changes to that control will be recognized after the program starts running.
Change the Mechanical Action of the Stop button to Latch When Released. It will automatically return to False after the value is read. The rectangular Stop button on the boolean palette has that Mechanical Action preset.