# AD Modbus GUI

This is a local browser GUI for the AD Keil project Modbus RTU interface.

## Install serial dependency

```powershell
python -m pip install -r AD_Keil_Project\tools\requirements-ad-terminal.txt
```

## Run

```powershell
python -B AD_Keil_Project\tools\ad_gui.py
```

Or double-click:

```text
run_ad_gui.bat
```

or:

```text
AD_Keil_Project\tools\run_ad_gui.bat
```

For remote access from another PC, use:

```text
run_ad_gui_remote.bat
```

Details:

```text
AD_Keil_Project\tools\README_AD_REMOTE_GUI.md
```

Default URL:

```text
http://127.0.0.1:8765/
```

## Notes

- The GUI uses the same Modbus code as `ad_terminal.py`.
- The default connection is ST-LINK VCP `COM31`, `512000 8N1`, slave `1`.
- If port listing fails, install `pyserial` using the command above.
- The `Status` tab shows `AD_PARAM_ID_STATUS_*` and `AD_PARAM_ID_FAULT_*` bits as vertical square LED lists below the main status fields.
- `Run Control -> Apply now` writes changed control parameters, including `Pole pairs` and `Shunt ohm`, to Modbus registers without pressing `Start`.
- `Measurements -> Poll measurements` continuously reads measurement registers at the selected interval.
- CSV logging is generated in the browser and downloaded when you press `CSV stop`.
