Go Down

Topic: Generic, Trivial, Transmit-only SoftwareSerial... (Read 5408 times) previous topic - next topic

westfw

Have you got one of those zippy new ARM boards that supposedly has lots of HardwareSerial ports, but also has a complex timer structure, high-overhead interrupts, and no one has bothered to write an implementation of (any of the) SoftwareSerial libraries for it?  And all you really want to do is send out an occasional short message to an arbitrary pin, and you don't really care if it's not too efficient, and you don't care to read anything back?

Well, I wrote a library to do that.  This is a trivial example of a transmit-only Software Serial, which uses the Arduino Core digitalWrite() and delayMicroseconds() functions.  It should run on just about anything, as long as the overhead of those functions is small compared to the desired bitrate of the connection.  (and their accuracy.  This is unlikely to work on those low-power nrfXXXX boards where delayMicroseconds() has a resolution of 1ms :-( )

(also, if you were curious about how Serial communications works, this is about as obvious as you can get.)

Quote
DumbTXSWS

An Arduino library that does "Software Serial" Transmit-only using Arduino core functions in a trivial way. This requires that digitalWrite() and delayMicroseconds() be "accurate" compared to the desired bitrate of transmission, which is likely to be the case on many newer zippy ARM targets (Adafruit M4 boards, for example.)
Tested on an Adafruit Metro M4 at up to 57600bps. Seems to work.
https://github.com/WestfW/Duino-hacks/tree/master/DumbTXSWS

Go Up