DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

script block variable exchange

Hello
I want to run a test via Script-DAC and RS232. One test consists of 50 measurements, each lasting 50 secs.
At measurement start, the test instrument wants to be informed about one parameter, e.g.

call oUDI.Write("START.......007") 'in SFD_GetScan

to trigger a test with parameter 007. After a while, the instrument responds with a result string

resultstring=oUDI.Read() 'in SFD_GetScan

Hard coded, no problem. But when I want to change that parameter along the 50 measurements, I find I cannot send a number to the SFD_GetScan function from the DAC module, e.g.

sub SFD_GetScan(ErrorP)
Startstring="START......" & cstr(MyStartParam)
Call oUDI.Write(Startstring)
'wait until done
resultstring=oUDI.Read()
'..... further processing
end sub

Now I try to get a value into the script via an output Script-DAC-block

Dim MyStartParam

sub SFD_WriteChannel(.....)
MyStartParam = DataP
'msgbox(cstr(MyStartParam)
end sub

The idea is to set a value to MyStartParam that can be accessed throughout the script, particularly by SFD_GetScan.

For some reason, this does not work. Though dim'med in the header, and passed to WriteChannel ok, changes in MyStartParam are not seen from within SFD_GetScan. Instead, MyStartParam in

Am I completely off track? I know that I could change the ParamP in the DAC, but this would require a new test run each time.

Thanx in advance.
Michael
0 Kudos
Message 1 of 3
(3,670 Views)
Hello Michael,

I'm not sure, if I understand your problem right so I will give a short summary of how I understand what you want to do. Your Instrument returns data from 50 channels per scan and you have to start the data acquisition for these 50 channels by sending one command (START.......xxx) to the instrument. For each scan you have to send a slightly different command to the instrument.

One way to pass the commands to be sent to the instruments to the script might be using one of the device parameters that are passed as parameters of the SFD_Init() function. You can take these parameters and save their values to script global values so that you can access these data throughout the entire script. In the dialog for the driver you can enter the commands to be send to the instrument e.g. as a comma separated list. In SFD_GetScan() you can select the correct command from this list (e.g. selectet by a scan counter) and send it to the instrument.

However if you have to send the START command per channel, it will be much easier to implement this in SFD_ReadChannel. If the parameter xxx of the START command is the number of the channel you want to acquire, you can use the parameter ChannelNumberP (channel number in the dialog) for this purpose.

I hope this helps


Rainer


0 Kudos
Message 2 of 3
(3,655 Views)
Helo, Rainer
Thank you for your advice - I think, I'll try for the approach to pass the data to an array with a scan counter.

Just to clarify what I want to do:
For a measurement system analysis (MSA) of a leakage test system, I want to run one test 50 times per set of parameters. There are about 18 differnt sets of parameters.

Test result string contains some 7 or so channels, including the various parameters, status, and leakage result.

So I could acquire 50 samples with parameter set 1, then 50 samples with parameter 2 etc. This would get me 18 data sets of 50 samples each.

BUT: Our DoE-expert suggests to mix the tests randomly. And this implies a random sequence of "Start...9", then "Start...3", etc, etc. And consequently run an ANOVA over the one data set of 18*50 samples to find funtcional dependencies.
And to this end, I need to use variable trigger strings.

With your approach, I'll set up an array of 900 random numbers and use the scan counter to set the "Start.."string.

Thank you.
Michael
0 Kudos
Message 3 of 3
(3,651 Views)