77 lines
2.1 KiB
Markdown
77 lines
2.1 KiB
Markdown
# fdr1-modbus-slave
|
|
|
|
Firmware Modbus RTU esclave pour encodeur incrémental, conçu pour tourner sur la carte **FDR1 v1.00**.
|
|
|
|
Le PIC lit la position du codeur QEI et la met à disposition d'un maître Modbus RTU (OpenPLC ou autre) via liaison série RS232/RS485.
|
|
|
|
---
|
|
|
|
## Matériel requis
|
|
|
|
- Carte **FDR1 v1.00**
|
|
- Microcontrôleur **PIC18F4431**
|
|
- Quartz **8 MHz** (HSPLL x4 → Fosc = 32 MHz)
|
|
- Encodeur incrémental raccordé au périphérique QEI
|
|
- Liaison série RS232 (RS485 à venir)
|
|
|
|
---
|
|
|
|
## Configuration Modbus RTU
|
|
|
|
| Paramètre | Valeur |
|
|
|------------------|------------|
|
|
| Adresse esclave | 183 |
|
|
| Vitesse | 115200 bps |
|
|
| Format | 8N1 |
|
|
| Function code | FC03 |
|
|
|
|
### Registres
|
|
|
|
| Adresse | Nom | Type | Accès | Description |
|
|
|----------|-----------|--------|-------|-----------------|
|
|
| `0x1700` | HR0 | UINT16 | R | Position QEI |
|
|
|
|
---
|
|
|
|
## Build & Flash
|
|
|
|
### Prérequis
|
|
|
|
- XC8 (dans le PATH)
|
|
- MPLABX v6.20 avec DFP PIC18Fxxxx installé
|
|
- PICkit3
|
|
|
|
### Compilation
|
|
|
|
```bash
|
|
make
|
|
```
|
|
|
|
### Flashage
|
|
|
|
```bash
|
|
make flash
|
|
```
|
|
|
|
### Nettoyage
|
|
|
|
```bash
|
|
make clean
|
|
```
|
|
|
|
---
|
|
|
|
## Licence
|
|
|
|
Copyright (c) 2026, FDR1 Project
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
|
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
3. All advertising materials mentioning features or use of this software must display the following acknowledgement: *This product includes software developed by the FDR1 Project.*
|
|
4. Neither the name of the FDR1 Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
|