weblab-instrument
Version:
communication with instrument through usb
218 lines (203 loc) • 6.19 kB
JavaScript
// var chID = {
// 'ch1' : 0,
// 'ch2' : 1,
// 'ch3' : 2,
// 'ch4' : 3,
// 'meas1' : 0,
// 'meas2' : 1,
// 'meas3' : 2,
// 'meas4' : 3,
// 'meas5' : 4,
// 'meas6' : 5,
// 'meas7' : 6,
// 'meas8' : 7
// };
// exports.chID = chID;
// var dsoState = {
// 'disconnect' : 0,
// 'timeout' : 1,
// 'connected' : 2,
// 'query' : 3
// };
// exports.dsoState = dsoState;
// var dsoErrCode = {
// 'systemErr' : {message : 'systemErr', type : 1},
// 'timeoutErr' : {message : 'timeoutErr', type : 2},
// 'commandErr' : {message : 'commandErr', type : 3},
// 'intrefErr' : {message : 'intrefErr', type : 4}
// };
// exports.dsoErrCode = dsoErrCode;
// var supportDevice={
// GDS2002E:{vid:'0x2184',pid:'0x003f',type:'DSO'},
// DCS2002E:{vid:'0x098f',pid:'0x2204',type:'DSO'},
// AFG2225:{vid:'0x2184',pid:'0x001C',type:'AFG'}
// };
// exports.supportDevice = supportDevice;
// var supportType = ['GDS2000E'];
// exports.supportType = supportType;
module.exports = {
chID: {
ch1: 0,
ch2: 1,
ch3: 2,
ch4: 3,
meas1: 0,
meas2: 1,
meas3: 2,
meas4: 3,
meas5: 4,
meas6: 5,
meas7: 6,
meas8: 7,
am1: 0,
am2: 1,
fm1: 0,
fm2: 1,
pm1: 0,
pm2: 1,
fsk1: 0,
fsk2: 1,
sum1: 0,
sum2: 1,
sweep1: 0,
sweep2: 1,
},
dsoState: {
am: 0,
timeout: 1,
connected: 2,
query: 3,
},
afgModCmd: {
am1: {
type: 'AMInteFunc',
freq: 'AMInteFreq',
source: 'AMSource',
depth: 'AMDepth',
state: 'AMState',
},
am2: {
type: 'AMInteFunc',
freq: 'AMInteFreq',
source: 'AMSource',
depth: 'AMDepth',
state: 'AMState',
},
fm1: {
type: 'FMInteFunc',
freq: 'FMInteFreq',
source: 'FMSource',
deviation: 'FMDeviation',
state: 'FMState',
},
fm2: {
type: 'FMInteFunc',
freq: 'FMInteFreq',
source: 'FMSource',
deviation: 'FMDeviation',
state: 'FMState',
},
pm1: {
type: 'PMInteFunc',
freq: 'PMInteFreq',
source: 'PMSource',
deviation: 'PMDeviation',
state: 'PMState',
},
pm2: {
type: 'PMInteFunc',
freq: 'PMInteFreq',
source: 'PMSource',
deviation: 'PMDeviation',
state: 'PMState',
},
fsk1: {
freq: 'FSKInteFreq',
source: 'FSKSource',
rate: 'FSKRate',
state: 'FSKState',
},
fsk2: {
freq: 'FSKInteFreq',
source: 'FSKSource',
rate: 'FSKRate',
state: 'FSKState',
},
sum1: {
type: 'SUMInteFunc',
freq: 'SUMInteFreq',
source: 'SUMSource',
ampl: 'SUMAmpl',
},
sum2: {
type: 'SUMInteFunc',
freq: 'SUMInteFreq',
source: 'SUMSource',
ampl: 'SUMAmpl',
},
sweep1: {
state: 'SweepState',
startfreq: 'SweepFrqStart',
stopfreq: 'SweepFrqStop',
centerfreq: 'SweepFrqCenter',
markerfreq: 'SweepMarkerFreq',
span: 'SweepFrqSpan',
swptime: 'SweepTime',
marker: 'SweepMarker',
type: 'SweepSpacing',
source: 'SweepSource',
},
sweep2: {
state: 'SweepState',
startfreq: 'SweepFrqStart',
stopfreq: 'SweepFrqStop',
centerfreq: 'SweepFrqCenter',
markerfreq: 'SweepMarkerFreq',
span: 'SweepFrqSpan',
swptime: 'SweepTime',
marker: 'SweepMarker',
type: 'SweepSpacing',
source: 'SweepSource',
},
},
dmmFuncType: {
voltdc: 'VoltDC',
voltac: 'VoltAC',
voltdcac: 'VoltDCAC',
currdc: 'CurrDC',
currac: 'CurrAC',
currdcac: 'CurrDCAC',
resistance: 'Resistance',
},
dsoErrCode: {
systemErr: { message: 'systemErr', type: 1 },
timeoutErr: { message: 'timeoutErr', type: 2 },
commandErr: { message: 'commandErr', type: 3 },
intrefErr: { message: 'intrefErr', type: 4 },
},
/*
* Use to pare usb device
*/
supportDevice: {
GDS2004A: { vid: '0x2184', pid: '0x0014', baudrate: 115200, type: 'DSO' },
GDS2002A: { vid: '0x2184', pid: '0x0013', baudrate: 115200, type: 'DSO' },
GDS2002E: { vid: '0x2184', pid: '0x003f', baudrate: 115200, type: 'DSO' },
GDS2004E: { vid: '0x2184', pid: '0x0040', baudrate: 115200, type: 'DSO' },
DCS2002E: { vid: '0x098f', pid: '0x2204', baudrate: 115200, type: 'DSO' },
GDS1002B: { vid: '0x2184', pid: '0x0044', baudrate: 115200, type: 'DSO' },
GDS1004B: { vid: '0x2184', pid: '0x0043', baudrate: 115200, type: 'DSO' },
AFG2225: { vid: '0x2184', pid: '0x001C', baudrate: 115200, type: 'AFG' },
MFG2100: { vid: '0x2184', pid: '0x0050', baudrate: 115200, type: 'AFG' },
MFG2200: { vid: '0x2184', pid: '0x004E', baudrate: 115200, type: 'AFG' },
GDM8342: { vid: '0x2184', pid: '0x0030', baudrate: 115200, type: 'DMM' },
GDM835X: { vid: '0x2184', pid: '0x003B', baudrate: 115200, type: 'DMM' },
GDM826X: { vid: '0x2184', pid: '0x001a', baudrate: 115200, type: 'DMM' },
GPD4303S: { vid: '0x0403', pid: '0x6001', baudrate: 9600, type: 'PWS' },
LCR6002: { vid: '0x067b', pid: '0x2303', baudrate: 115200, type: 'LCR' },
LCR6200: { vid: '0x1a86', pid: '0x7523', baudrate: 115200, type: 'LCR' },
},
/*
* Use to find command table
*/
supportType: ['GDS2000E', 'GDS1000B', 'GDS2000A', 'AFG2200', 'MFG22X0', 'GDM8300', 'GDM8200', 'GPDX303S', 'GPD3303', 'LCR6000'],
};