CP495F: Microprocessor Systems and
is the technique of writing code to explicitly control individual pins
on a microcontroller is order to implement some sort of protocol.
An example of this is to create a serial interface whether or not the
controller has pins and/or a dedicated module to do this.
While bit-bashing makes code more involved, and creates some processor
overhead, it makes testing easier at the early stages. For instance, if
the processor includes a module, but the documentation is unclear about
details, a bit-bashed solution allows the actual connections to be
tested (assuming the same pins are used as would be used by the built-in
module), as well as the external device(s).
Another use of bit-bashing is when the dedicated pins for a particular
function are unavailable. For instance, many microcontrollers will have
one set of pins which can be used for two or more different serial
protocols. In that case, if a designer need to use two devices which
require different protocols, one of the devices will have to be
bit-bashed. (Or, similarly, a designer needs two independent
implementations of the same funtionality, and only one is available. The
second must be bit-bashed. An example of this might be a pulse-width
modulated output, with one available but two needed.)
Wilfrid Laurier University
© 2015 Wilfrid Laurier University