Ok, more tweaking gets us to 10ms per xbee data packet. Well, per cycle, each packet is about 7ms long, a total of 25 bytes with 16 bytes as the actual data payload. This leaves about 3ms of ‘I completely ain’t got nothing to do’ idle time. Sweet.
This sort of update gives a really smooth servo movement from the knob on the master to the client. I’m thinking I’m approaching the limit of what I can do at 8mhz. Or close. I’ve tried to go faster but get nothing. According to the data sheet, if I go above 38.4k and don’t set the ‘double’ bit, the error is over 2% which won’t fly. If I do set the double speed bit I think I can crank it one more notch to 76.8k and get a 0.2 % error which is quite good. Any of the other, higher baud rates are going to require a crystal at a ‘baud friendly’ frequency or a tweak to the fuzes to get the internal clock lower, neither option I want to do right now.
Anyhow, this rate gives two complete data updates per servo cycle, that means I can get a smooth throttle control for a two locomotive consist depending on how I do it. You could either send both locomotives individual packets from the hand held, or have the ‘master’ locomotive send a ‘slave’ packet to the other on the consist. That will be some interesting R&D there.
I’d would like to get this faster, to take it to the limit of the over the air rate (250kbs), but I’m pretty sure it will take a hardware change for even half that. Also, I’m not sure the Xbee will handle above 115.2K on it’s UART so I’ll leave that for phase 2.