- Source: Bit banging
In computer engineering and electrical engineering, bit banging or bit bashing is a term of art for any method of data transmission that employs software as a substitute for dedicated hardware to generate transmitted signals or process received signals. Such software directly sets and samples the states of GPIOs (e.g., pins on a microcontroller) to transmit and receive, respectively, and is responsible for meeting all timing requirements and protocol sequencing of the signals. In contrast to bit banging, dedicated hardware (e.g., UART, SPI, I²C) satisfies these requirements and, if necessary, provides a data buffer to relax software timing requirements. Bit banging can be implemented at very low cost, and is commonly used in embedded systems.
Bit banging allows a device to implement different protocols with minimal or no hardware changes. In some cases, bit banging is made feasible by newer, faster processors because more recent hardware operates much more quickly than hardware did when standard communications protocols were created.
C code example
The following C language code example transmits a byte of data on an SPI bus.
Considerations
The question whether to deploy bit banging or not is a trade-off between load, performance and reliability on one hand, and the availability of a hardware alternative on the other. The software emulation process consumes more processing power than does supporting dedicated hardware. The microcontroller spends much of its time sending or receiving samples to and from the pins, at the expense of other tasks. The signal produced usually has more jitter or glitches, especially if the processor is also executing other tasks while communicating. However, if the bit-banging software is interrupt-driven by the signal, this may be of minor importance, especially if control signals such as RTS, CTS, or DCD are available. The implementation in software can be a solution when specific hardware support is not available or requires a more expensive microcontroller.
See also
Bit manipulation
Bit stream
Bit twiddler (disambiguation)
Bit-serial architecture
1-bit architecture
Fast loader
Integrated Woz Machine (IWM)
FTDI (a series of USB to serial converter chips also supporting a bit bang mode)
2MGUI (a DOS driver by Ciriaco García de Celis utilizing bit-banging to support non-standard ultra-high capacity floppy disk formats "bypassing" the normal floppy controller logic, a similar program for Amiga floppies is Vincent Joguin's Disk2FDI)
Light pen (on MDA, HGC, CGA and EGA PC-compatible graphics cards the sensor of an optional light pen could be read in a fashion similar to bit banging)
Virtual machine (VM) (implementing virtual device drivers emulating actual hardware controllers sometimes involves utilizing programming techniques similar to bit banging)
Software-defined radio (SDR)
Polling (computer science)
References
External links
Asynchronous serial (RS-232)
Notes on bit-banging async serial
Bit banging for Async Serial Communication
Bit banging for RS-232
I²C bus
I2C on AVR using bit banging
SPI bus
Efficient bit-banged SPI for 8051 microcontroller
Kata Kunci Pencarian:
- Crystal Lowe
- Bit banging
- I²C
- Serial Peripheral Interface
- Bitstream
- ZX Interface 1
- 1-bit computing
- Bit-serial architecture
- Universal asynchronous receiver-transmitter
- Serial port
- Bit manipulation