Hardware Abstraction Layer
The Hardware Abstraction Layer (HAL) provides a uniform interface for interacting with microcontroller peripherals through HIL LISP. The HAL translates high-level operations into the serial wire protocol frames understood by the firmware (Hennessy & Patterson, 2017).
Abstraction Model
Pin Types and Mapping
| HIL Type | Firmware Type | Description | Read Range | Write Range |
|---|---|---|---|---|
D | Digital | Binary I/O | 0 or 1 | 0 or 1 |
A | Analog | ADC input | 0–1023 | — |
P | PWM | Pulse-width modulation | — | 0–255 |
Pin Numbering
ATmega328P (Arduino Uno/Nano):
| Digital Pins | PWM Pins | Analog Pins |
|---|---|---|
| D0–D13 | D3, D5, D6, D9, D10, D11 | A0–A5 |
; Digital write to built-in LED
(WRITE D 13 1)
; Read analog sensor on A0
(SET val (READ A 0))
; PWM output on pin 9
(WRITE P 9 128) ; 50% duty cycle