get - Get Channel Value
Description
The get command retrieves the current value of a specific channel with performance metrics. It can capture multiple samples and provides detailed timing statistics.
Syntax
get --channel <channel_name> [options]
Required Options
| Option | Short | Description |
|---|---|---|
--channel |
-c |
The name or alias of the channel to measure |
Optional Options
| Option | Short | Description | Default |
|---|---|---|---|
--samples |
-s |
Number of samples to capture | 1 |
--detailed |
-d |
Enable detailed network timing analysis | false |
--log-file |
-l |
Path to a CSV file for logging latency over time (appends if file exists) | - |
--interval |
-i |
Delay in milliseconds between samples | 0 |
Examples
Single Sample
get --channel "VOLTAGE_SENSOR_1"
Multiple Samples with Statistics
get --channel "TEMPERATURE_1" --samples 100
Using Short Options
get -c "ADC_CH0" -s 1000
With Interval Between Samples
get -c "TEMPERATURE" -s 100 -i 100
With Detailed Timing Analysis
get -c "VOLTAGE" -s 50 -d
Logging to CSV File
get -c "CURRENT_SENSE" -s 1000 -l "latency_log.csv"
Combined Options
get -c "ADC_CH0" -s 500 -i 10 -l "adc_timing.csv" -d
Output Format
Single Sample
Reading channel: VOLTAGE_SENSOR_1
3.3000 (2.15 ms)
Multiple Samples
Reading channel: VOLTAGE_SENSOR_1
3.3001 (2.10 ms)
3.3002 (2.15 ms)
3.2999 (2.18 ms)
...
Average: 2.14 ms over 100 samples
With Detailed Analysis
Reading channel: VOLTAGE_SENSOR_1
Detailed network timing analysis enabled
3.3001 (2.10 ms)
...
CSV Log Output
When using --log-file, the CSV file contains:
Timestamp,Channel,LatencyMs
2024-01-15 10:30:45.123,ADC_CH0,2.150
2024-01-15 10:30:45.235,ADC_CH0,2.120
...
Output Colors
Channel names and values are colored by channel type (matching the GUI):
- Values are displayed with type-specific colors via ColorHelper
- Each sample shows timing in dim text:
(2.15 ms) - Yellow text indicates detailed analysis mode enabled
- Magenta text shows average statistics for multiple samples
Performance Metrics
The command provides timing information:
| Metric | Description |
|---|---|
| Per-sample latency | Time for each individual sample acquisition (shown in parentheses) |
| Average latency | Mean time across all samples (shown when samples > 1) |
Additional features:
- Detailed analysis: Enabled with
-dflag, shows network timing breakdown - CSV logging: Records timestamp, channel name, and latency for each sample
- Interval delays: Optional delay between samples using
-ioption
Behavior
- Resolves channel name using regex matching
- Displays channel being read with type-specific color
- Shows detailed analysis notice if
-dflag is used - Opens CSV log file if
-lspecified (creates with header if new) - For each sample:
- Records start time
- Calls GetValue on the channel
- Records end time and calculates duration
- Displays value with timing
- Logs to CSV if enabled
- Waits for interval if specified and not last sample
- After all samples, shows average if samples > 1
- Closes CSV log file if used
Channel Name Resolution
The command uses regex matching to find channels:
- If
VOLTAGEis provided, it matches the first channel containing "VOLTAGE" - For exact matching, use the full channel name
- Uses
GetFirstChannelNameFromRegex()internally
Use Cases
Performance Testing
# Test acquisition speed with logging
get -c "FAST_ADC" -s 10000 -l "performance_test.csv"
Value Monitoring with Interval
# Monitor voltage every 100ms
get -c "VDD_CORE" -s 1000 -i 100
Network Timing Analysis
# Analyze network latency
get -c "SENSOR" -s 100 -d
Long-term Logging
# Log data over time (appends to existing file)
get -c "TEMPERATURE" -s 5000 -i 1000 -l "temp_log.csv"
Notes
- Requires an active connection (use
initfirst) - Samples are captured sequentially (not parallel)
- Timing includes network/communication overhead
- Large sample counts may take significant time
Performance Considerations
Sample acquisition time varies by channel type:
- Fast: Digital I/O (< 1 ms)
- Medium: ADC channels (2-5 ms)
- Slow: Complex calculations (> 10 ms)
Network latency affects timing:
- Local network: 1-5 ms overhead
- Remote network: 10-100 ms overhead
Error Handling
Common errors:
- Channel not found: Check channel name or use
listto see available channels - Not connected: Run
initcommand first - Timeout: Channel may not be responding