2

Are streams of binary data considered a form of bit banging? Does this definition change if the array is buffered? I am referring software which handles binary data on a general purpose CPU; for example, Java's Input/OutputStream, C++'s istream/ostream, and C's character arrays.

I'm aware of that working on individual bytes rather than a buffered is slower due to efficiency lost at the I/O barrier.

In contrast to bit banging, dedicated hardware (e.g., UART, SPI interface) satisfies these requirements and, if necessary, provides a data buffer to relax software timing requirements.

How is timing related?

This question is in reference to this Wikipedia entry:

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

  • 2
    Bit-banging is a term that describes the generation of physical signals (an electrical or optical signal) at the software-hardware interface. Typically it implies "bare metal", where the software runs on a system with minimal or no OS, and CPU interrupts can be disabled. (Bit-banging cannot work if CPU interrupts are allowed to happen.) It is typically not used in contexts where everything is purely software-based or stays on the CPU. – rwong Mar 11 at 14:00
  • 1
    Bit-banging refers to the generation of the physical signal (or waveform) by software manipulation of an output port ("wire") at the precise time. As such, the software is able to generate arbitrary physical signals, up to the capability of the frequency limit of the CPU and the rate of the digital-to-analog conversion. In bit-banging, the software is responsible for the timing of the signal. Unless done carefully, it may also generate out-of-spec (non-compliant) signals, by being incorrect or imprecise with timing. – rwong Mar 11 at 14:02
  • So yeah, streams of binary data might be a product of bit banging, but they're certainly not the means to achieve it. – Robert Harvey Mar 11 at 14:18
  • I still remember the Apple ][ games which could produce very complex music while doing all sorts of amazing calisthenics on the video display at the same time. The speaker on that machine was driven by a latch. There was no sound chip of any kind ... such things had not been invented yet. There was no multitasking. There was less than 64K of memory and a comparatively primitive CPU. With that, they did pure magic. – Mike Robinson Mar 11 at 15:02
  • Quoting a teacher of mine - "Bit-banging is the smoke signal of computing". – T. Sar Mar 11 at 16:36
6

Are streams of binary data considered a form of bit banging?

No. The term bit banging is only used when referring to creating electrical signals on a processor pin.

There are two ways to create the signals of a protocol on the hardware layer (for example, to send UART signals)

  1. Use software to drive one or more output pins (and read one or more input pins) according to the protocol specification. The software has full control over the signals being sent, but it must also take care of the correct timing according to the protocol. This is called bit banging, because the software is pushing data through one bit at a time.
  2. Use dedicated hardware. Most processors have built-in hardware that can generate the signals for a number of low-level communication protocols (I2C, SPI, UART, etc.). The software transfers the data to the peripheral hardware and the hardware takes responsibility of generating the electrical signals with the correct timing. This is generally preferred, as it frees the software from a lot of very strict timing requirements.
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.