Go Down

Topic: Using float baud rate for serial... (Read 698 times) previous topic - next topic

Washuu

I need to support an odd ball baud rate for the old CCD bus that runs at 7812.5 (1mhz / 128).  It uses standard 8N1 framing.

Obviously I can not pass that to Serial.begin() since it is expecting an unsigned integer.  Trying to flub it by doubling the value and sending two bits for every bit will not work since that will mess up the framing.

Any ideas on how I can achieve this?  The best idea I have so far is to rewrite SoftwareSerial to support floats for baud rates.

guix

Welcome,

Did you try with 7812 or 7813 ?

Robin2

The best idea I have so far is to rewrite SoftwareSerial to support floats for baud rates.
You can't use floats. All serial stuff and the timers underlying them use integers.

If you really need to create a strange baud rate you may wish to consider modifying my Yet Another Software Serial

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

aarg

  ... with a transistor and a large sum of money to spend ...
Please don't PM me with technical questions. Post them in the forum.

westfw

According to the popular AVR Baud Rate Calculator 7812.5bps is what you will actually get if you pass either 7812 or 7813 to Serial.begin()

Normally for async communications, an error of 0.5/7812.5 = 0.0064% is not going to matter, anyway.

Washuu

Thanks everyone!  I did try modifying AltSoftSerial, but I was getting no where with that.  It turns out my test data was for the wrong country of origin.(MPH versus KPH)

Simply putting in 7812 with the hardware serial does work and when I switched to use other test data, ta-da!

https://www.youtube.com/watch?v=frOAhIuyXt4

Go Up