HardFOC driver
Alicat BASIS-2 Driver¶
A C++17 driver for Alicat BASIS-2 mass flow meters and controllers. It reads flow, temperature and the totalizer, commands setpoints, tares and reconfigures the instruments over Modbus-RTU, on any MCU with a UART and an RS-485 or RS-232 transceiver.
The driver has no platform code. You give it a small class that writes bytes, reads bytes with a timeout and flushes the receive buffer; it does the rest: Modbus-RTU framing, the CRC-16, reply checks, register scaling and error reporting. It is header-only and allocates nothing.
- Instruments
- B-Series meters and BC-Series controllers, 100 SCCM to 20 SLPM full scale, 9 calibrated gases
- Interface
- RS-485 or RS-232 (by model), 8 data bits, no parity, 1 stop bit; 38400 baud default, 4800 to 115200
- Protocols
- Modbus-RTU (functions 03, 06, 16), which this driver uses; Alicat ASCII commands
- Addressing
- Modbus address 1 to 247; ASCII unit ID
AtoZ - Supply
- 12 V to 24 V DC; 210 mA (controller), 12 mA (meter)
- Connector and limits
- 6-pin JST-GH; 145 PSIG maximum common-mode pressure
What you get¶
- One object per instrument.
Driver<YourUart>targets one Modbus address; several drivers share one port for a multidrop RS-485 bus. See API guide. - Live data in one request.
ReadInstantaneous()reads registers 2100 to 2109 (gas, status, temperature, flow, total, setpoint, valve drive, batch) and decodes them. See API guide. - Control and configuration. Setpoint, setpoint source, watchdog, ramp, tare, totalizer, gas, averaging, reference temperature. See Configuration.
- Bus bring-up. An address sweep, address and baud-rate changes, factory restore. See Modbus-RTU protocol.
- Zero-overhead portability. The port is a CRTP class: no virtual calls, no heap, no exceptions, no RTOS dependency. See Porting.
- Tested without hardware. Host unit tests run the driver against a model of a BASIS-2 Modbus slave. See Testing and CI.
Where to go next¶
-
Wire the bus, write the port, read flow in about 15 lines.
-
Connector pinout, bus settings, timing and power.
-
The three layers and what each one owns.
-
Read, command, configure and handle errors, task by task.
-
Implement the serial interface for your MCU.
-
Every class and member, generated from the headers.