Configuration¶
The settings a BASIS-2 takes over Modbus, their ranges and defaults, and the order to apply them in.
Every setting here is a register write that the instrument keeps until you change it or restore the factory
settings. Every snippet is compiled from tests/docs/configuration.cpp.
Order¶
| Step | Call | Why this position |
|---|---|---|
| 1 | SetModbusAddress(), SetBaudRate() |
Bus settings first, one instrument at a time (API guide) |
| 2 | ReadIdentity() |
Flow units and full scale decide how to read every value |
| 3 | SetGas() |
Calibration for the process gas |
| 4 | SetReferenceTemperatureC(), SetFlowAveragingMs(), SetTotalizerLimitMode() |
How flow and total are reported |
| 5 | SetSetpointSource(), SetCommWatchdogMs(), SetAutotareEnabled(), SetMaxSetpointRamp() |
Controllers: control behaviour |
| 6 | Tare() |
Last, on the process gas with no flow |
Meters and controllers¶
using al::DriverError;
DriverError e = meter.SetGas(al::Gas::Nitrogen).error; // register 2100
if (e == DriverError::None) e = meter.SetReferenceTemperatureC(20.0f).error; // 52: 0..30 C
if (e == DriverError::None) e = meter.SetFlowAveragingMs(50).error; // 55: 0..2500 ms
if (e == DriverError::None) {
e = meter.SetTotalizerLimitMode(al::TotalizerLimitMode::ResetWithOvr).error; // 54
}
return e == DriverError::None;
| Setting | Call | Register | Range | Factory default |
|---|---|---|---|---|
| Gas | SetGas(Gas) |
2100 | Air, Argon, CarbonDioxide, Nitrogen, Oxygen, NitrousOxide, Hydrogen, Helium, Methane |
Per order |
| Reference temperature | SetReferenceTemperatureC(float) |
52 | 0 °C to 30 °C, in 0.01 °C | Not stated |
| Flow averaging | SetFlowAveragingMs(uint16_t) |
55 | 0 ms to 2500 ms time constant | Not stated |
| Totalizer limit | SetTotalizerLimitMode(TotalizerLimitMode) |
54 | See below | Not stated |
| ASCII unit ID | SetAsciiUnitId(char) |
46 | 'A' to 'Z' |
'A' |
The driver checks the ranges of the averaging time, the reference temperature, the address and the unit ID before
it sends anything, and returns InvalidParameter or InvalidAddress. Writing a gas the instrument does not have
leaves the gas unchanged (manual, register 2100).
TotalizerLimitMode |
At the maximum total |
|---|---|
SaturateNoError (0) |
Hold the maximum, no OVR |
ResetNoError (1) |
Restart from zero, no OVR |
SaturateWithOvr (2) |
Hold the maximum, set OVR |
ResetWithOvr (3) |
Restart from zero, set OVR |
Controllers only¶
using al::DriverError;
DriverError e = controller.SetSetpointSource(al::SetpointSource::DigitalUnsaved).error; // 516
if (e == DriverError::None) e = controller.SetCommWatchdogMs(500).error; // 514: 0..5000 ms
if (e == DriverError::None) e = controller.SetAutotareEnabled(true).error; // 515
if (e == DriverError::None) {
// 524-525: % of full scale per ms x 10^7. 0.01 %/ms (full scale in 10 s) = 100000.
e = controller.SetMaxSetpointRamp(100000).error;
}
return e == DriverError::None;
| Setting | Call | Register | Range |
|---|---|---|---|
| Setpoint source | SetSetpointSource(SetpointSource) |
516 | Analog (0), DigitalSaved (1), DigitalUnsaved (2) |
| Communication watchdog | SetCommWatchdogMs(uint16_t) |
514 | 0 ms (off) to 5000 ms |
| Autotare | SetAutotareEnabled(bool) |
515 | Tares after the setpoint has been 0 for at least 2 s |
| Maximum setpoint ramp | SetMaxSetpointRamp(uint32_t) |
524-525 | % of full scale per ms × 107; 0 = no ramp |
| Batch volume | SetTotalizerBatch(uint32_t) |
521-522 | Total-volume units, scaled by the factory-set decimals |
A meter has none of these registers and rejects the writes (API guide).
Driver settings¶
These live in the Driver object, not in the instrument.
| Setting | Call | Default |
|---|---|---|
| Target address | constructor, SetAddress() |
As constructed |
| Response timeout | constructor, SetTimeoutMs() |
200 ms (kDefaultTimeoutMs) |
| Bus baud rate, for the inter-frame gap | SetBusBaudRate(); SetBaudRate() sets it too |
38400 (kDefaultBusBaudBps) |
| Flow decimals | argument of ReadInstantaneous() |
3 |
Back to factory settings¶
FactoryRestore() writes 0x5214 to register 80 and copies the factory settings over the user settings. The
manual recommends a power cycle afterwards. It may change the address and the baud rate back, so expect to
rediscover the instrument.