Bit banging

Bit banging

Bit banging is a technique for serial communications using software instead of dedicated hardware. Software directly sets and samples the state of pins on the microcontroller, and is responsible for all parameters of the signal: timing, levels, synchronization, etc. In contrast to bit banging, dedicated hardware (such as a modem, UART, or shift register) handles these parameters and provides a (buffered) data interface in other systems, so software is not required to perform signal demodulation. Bit banging can be implemented at very low cost, and is used in, for example, embedded systems.[1]
Although it is often considered to be something of a hack, bit banging does allow the same device to use different protocols with minimal or no hardware changes required. In many cases, bit banging is made possible because more recent hardware operates much more quickly than hardware did when standard communications protocols were created.

也就是使用 software 搭配 gpio 來實作硬體的 protocol 溝通,
所以軟體需要注意 timing,level,synchronization 等等
如:I2C,SPI,
優點是 low cost,
缺點是 software 負擔大。

Reference

https://en.wikipedia.org/wiki/Bit_banging

原文地址:https://www.cnblogs.com/youchihwang/p/7216069.html