NDS3
Der Distancescanner ist eine Kombination aus einem [Servo], einem [Sharp Distanzmesser] und einem [ATtiny84] als Mikrocontroller.
Inhaltsverzeichnis
Protokoll
Jeder Zugriff über den [I²C] Bus ist nach folgendem Schema aufgebaut:
Address | Write | Command | W-Data | Address | Read | R-Data |
---|---|---|---|---|---|---|
7 Bit | 1 Bit | 8 Bit | m Byte | 7 Bit | 1 Bit | n Byte |
Falls Keine Daten zurück übertragen werden entfällt das zweite Datenpaket.
Kommandos
Distanzmessung
0x01: Move (int8_t pos) -> ()
0x02: Measure (int8_t pos, uint8_t step) -> ()
0x03: Read (int8_t pos, uint8_t step) -> (uint8_t data[])
0x04: GetPos () -> (int8_t pos)
0x05: GetDist () -> (uint8_t dist)
0x06: GetBusy () -> (uint8_t busy)
Portfunktionen
0x10: SetDDR (uint8_t value) -> ()
0x11: SetPort (uint8_t value) -> ()
0x12: GetPin () -> (uint8_t value)
0x13: GetAnalog () -> (uint16_t value)
Kalibrierung
0x20: MoveServo (uint16_t value) -> ()
0x21: GetCalibration () -> (uint16_t lo, uint16_t hi)
0x22: SetCalibration (uint16_t lo, uint16_t hi) -> ()
0x23: GetAnalog (uint8_t idx) -> (uint16_t value)