[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PSUBS-MAILIST] 4 Byte ROV Control Protocol
For anyone using micro-controllers, here's my take on a 4 byte serial
control protocol. Any thoughts, suggestions, or concerns would be
appreciated.
Background: I needed a control protocol for my replacement Mini-
Rover control system. I had hoped that I'd have RS-485 at around
19,200 bps to work with. I don't. The following protocol is as
tight as I can make it without sacrificing functionality or making
the programming unduly complex.
The protocol is 3 bytes of payload followed by a 1 byte CRC. The
receiving unit knows it has a valid packet when the CRC of the 3
previous bytes matches the current byte. To get the required 4 stick
positions into 3 bytes I split each byte into it's high and low hex
(0-F). I opted to throw away 0, which leaves 1 to F(15) and puts 8
in the middle. It also leaves me with 225 command possibilities (for
items where a delay is acceptable).
The following is copyright 2006, by Michael Wright:
Compacted Control Data Protocol
Michael Wright
August 21, 2006
Hex Function Constraint
1a R/L Turn Servo Position 1-F
1b F/R Long Servo Position 1-F
2a Up/Down Servo Position 1-F
2b R/L Lateral Servo Position 1-F
3a Command From Group 1 1-F
3b Command From Group 2 1-F
4ab Checksum of Preceding Bytes Any Byte
The packet is considered valid when the following constraints are met:
Hex 1a-3b are within their constraints (not 0).
The CRC of Bytes 1-3 matches the CRC supplied in byte 4.
When a valid packet is found, the next 3 bytes cannot be CRC bytes.
************************************************************************
************************************************************************
************************************************************************
The personal submersibles mailing list complies with the US Federal
CAN-SPAM Act of 2003. Your email address appears in our database
because either you, or someone you know, requested you receive messages
from our organization.
If you want to be removed from this mailing list simply click on the
link below or send a blank email message to:
removeme-personal_submersibles@psubs.org
Removal of your email address from this mailing list occurs by an
automated process and should be complete within five minutes of
our server receiving your request.
PSUBS.ORG
PO Box 311
Weare, NH 03281
603-529-1100
************************************************************************
************************************************************************
************************************************************************