enhanced modified console example from SDK

Post discussions on projects you are working on
Post Reply
rjm
Newbie
Posts: 0
Joined: Sun Mar 01, 2009 10:11 pm

enhanced modified console example from SDK

Post by rjm »

Besides some changes in functions that address my needs, I created the opportunity to invoke the console control application with a configuration file. Such a config file would process commands before the prompt is shown and as such it allows me to work on preset configurations.

I start with a sample of a config file:

Code: Select all

# hi! I'm the start of a command file...
d12
vb0
vc0
vd0
va200
# set up generator as a calibration resource (10 mV RMS)
gws
gf500000
gv14.14
# intend to get 125 MSPS
i 3
#b31250000i |./anyprocess > data.txt
Sample invocation (in Linux):

Code: Select all

$ ./picocontrol control.txt 
PicoScope 5000 Series (A API) Driver Example Program

Enumerating Units...
*** A command batch file control.txt will be executed after enumeration ***
Found one device, opening...

Driver Version: PS5000A Lc@
USB Version: 2.0
Hardware Version: 1
Variant Info: 5443A
Serial: EV369/079
Cal Date: 06Jan17
Kernel Version: 0.0
Digital HW Version: 1
Analogue HW Version: 1
Firmware 1: 1.3.3.0
Firmware 2: 1.1.5.0

Handle: 1
Device opened successfully, cycle 1

setTrigger:ps5000aSetTriggerChannelDirections ------ 0x0000000d 
*** Enter '?' for a list of commands ***
# hi! I'm the start of a command file...
Resolution selected: 12 bits
Channel B switched off
Channel C switched off
Channel D switched off
Channel A range: 200 mV
# set up generator as a calibration resource (10 mV RMS)
Waveform is set to Sine
Frequency set to 500000 Hz
Peak Voltage set to 14.140000 mV
# intend to get 125 MSPS
Timebase used 3 = 8ns sample interval
#b31250000i |./anyprocess > data.txt
End of batch processing. Switched to interactive mode.
> ?
Command Summary:
T - Triggered block
E - Collect a block of data using ETS         A - ADC counts/mV
R - Collect set of rapid captures
S - Immediate streaming
W - Triggered streaming
D - Set resolution [8 | 12 | 14 | 15 | 16] bits
I - Set timebase
V - Set voltages (FS-range) in mV
B - Immediate block
G - Signal generator (optional) [ Wave | Freq. | Volt/Ampl.]
X - Exit
*** Enter '?' for specific command help ***
> 
Source code is attached (based on ps5000acon from 2017), where the binary name is picocontrol.
The block data handler is modified such that you can pipe the captured data to another process.
Attachments
ps5000acon.c
(77.67 KiB) Downloaded 427 times

Post Reply