Products > Test Equipment
Open source EEZ Studio for accessing your (SCPI) instruments
prasimix:
I'll try to follow up on the recent discussion between @dpenev and @Rerouter. First, please note that current function for drawing graph is more or less in line with scope data, but can be to some extent used with data received from other sources.
Graph functions already accept (i.e. recognize) various data formats. For example, I can import file that is generated by Audacity (as RAW headless .wav, 64-bit float) that looks like this in Audacity:
On the ESW side, we can use Attach file option ...
.. and import it into the instrument Terminal.
We have to select proper format of imported data using Configure option, otherwise graph cannot be displayed properly:
prasimix:
Some idea how to use JavaScript code within ESW can be found in shortcuts that were already implemented in couple of existing IEXTs, like importing data from Rigol's memory (rigol_waveform_data.js), or starting a datalogging on EEZ H24005 (eez_psu_dlog_start.js).
An example of simple edit box can be found here: enter_start_frequency.js that we can use in a new shortcut:
... that will appear in the list of shortcuts:
... and become visible on the instrument's Terminal, where we'll also open a Debug console on the right (Ctrl+Shift-I or using View ... Toggle Developer Tools option):
When we select the newly added shortcut a new edit box will appear where we can insert e.g. 4000:
... and that value will become visible in Debug console, that is currently the only way to debug scripts:
dpenev:
Hi Prasimix,
My Fstart shortcut now looks like bellow:
I have few questions inside the code in the comments.
The edit box input() default value doesn't appear whatever I try.
Could you please comment ?
Do I need to add some more EEZ dependent stuff?
var defaultValues = {
starFrequency: 1000
};
var values = await input({
title: "Enter Start Frequency",
fields: [
{
name: "startFrequency",
displayName: "Start frequency",
type: "number"
}
]
}, defaultValues); //How to pass the default values?
if (!values || (values.startFrequency !== values.startFrequency)) {
//session.deleteScriptLogEntry(); //Do I need this?
return;
}
connection.acquire(); //Do I need this?
connection.command(`:FREQuency:STARt ${values.startFrequency}`);
connection.release(); //Do I need this?
console.log(values); //Do I need this?
prasimix:
The following code contain an error, for default frequency startFrequency should be used (that's the answer why default value didn't work):
--- Code: ---var defaultValues = {
starFrequency: 1000
};
--- End code ---
Don't know how you came up with this code:
--- Code: ---if (!values || (values.startFrequency !== values.startFrequency)) {
//session.deleteScriptLogEntry(); //Do I need this?
return;
}
--- End code ---
... but something like this is applicable:
--- Code: ---if (!values) {
// user clicked on Cancel button
return;
}
--- End code ---
The following lines are required, so the answer is, yes:
--- Code: ---connection.acquire(); //Do I need this?
connection.release(); //Do I need this?
--- End code ---
Please give us some time, and Martin will try to prepare for you a script skeleton that could be used for collecting data from your instrument.
prasimix:
Hi again, in add_chart_sample.js you can see how to create a graph from comma separated values that Siglent should generate with TRACe:DATA? command as you reported in #31.
--- Code: ---var defaultValues = {
startFrequency: 1234
};
var values = await input({
title: "Enter Start Frequency",
fields: [
{
name: "startFrequency",
unit: "frequency",
displayName: "Start frequency",
type: "number"
}
]
}, defaultValues);
connection.acquire();
await connection.command(`FREQuency:STARt ${values.startFrequency}`);
var data = await connection.query("TRACe:DATA? 1");
session.addChart({
description: "This is description",
data,
samplingRate: 1000, // 1000 samples per second
offset: 0,
scale: 1,
format: 4, // CSV string
unit: "frequency",
color: "rgb(255,250,205)", // line color on black backround
colorInverse: "rgb(51,51,0)", // line color on white background
label: "This is y-axis label"
});
connection.release();
--- End code ---
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version