All Topics  
Bit-banging

 

   Email Print
   Bookmark   Link






 

Bit-banging



 
 
Bit-banging is a technique for serial communications
Serial communications

In telecommunication and computer science, serial communication is the process of sending data one bit at one time, sequentially, over a communication channel or computer bus....
 to use software instead of dedicated hardware such as a UART or shift register
Shift register

In digital circuits, a shift register is a group of flip-flop s set up in a linear fashion which have their inputs and outputs connected together in such a way that the data is shifted down the line when the circuit is activated....
. A software routine handles the UART transmit function by alternating a pin on the microcontroller
Microcontroller

A microcontroller is a small computer on a single integrated circuit consisting of a relatively simple CPU combined with support functions such as a crystal oscillator, timers, watchdog, serial and analog I/O etc....
 by given time intervals. A receiver function is implemented by sampling
Sampling (signal processing)

In signal processing, sampling is the reduction of a continuous signal to a discrete signal. A common example is the conversion of a sound wave to a sequence of sample ....
 a pin on the microcontroller by a given time interval. The technique can be applied in very low cost embedded systems.

With a few extra components, video signals can be output from digital pins. (See TV Typewriter
TV Typewriter

The TV Typewriter was a video terminal that could display 2 pages of 16 lines of 32 upper case characters on a standard television. The Don Lancaster design appeared on the cover of Radio-Electronics magazine in September 1973....
).

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.

There are some problems with bit-banging.






Discussion
Ask a question about 'Bit-banging'
Start a new discussion about 'Bit-banging'
Answer questions from other users
Full Discussion Forum



Encyclopedia


Bit-banging is a technique for serial communications
Serial communications

In telecommunication and computer science, serial communication is the process of sending data one bit at one time, sequentially, over a communication channel or computer bus....
 to use software instead of dedicated hardware such as a UART or shift register
Shift register

In digital circuits, a shift register is a group of flip-flop s set up in a linear fashion which have their inputs and outputs connected together in such a way that the data is shifted down the line when the circuit is activated....
. A software routine handles the UART transmit function by alternating a pin on the microcontroller
Microcontroller

A microcontroller is a small computer on a single integrated circuit consisting of a relatively simple CPU combined with support functions such as a crystal oscillator, timers, watchdog, serial and analog I/O etc....
 by given time intervals. A receiver function is implemented by sampling
Sampling (signal processing)

In signal processing, sampling is the reduction of a continuous signal to a discrete signal. A common example is the conversion of a sound wave to a sequence of sample ....
 a pin on the microcontroller by a given time interval. The technique can be applied in very low cost embedded systems.

With a few extra components, video signals can be output from digital pins. (See TV Typewriter
TV Typewriter

The TV Typewriter was a video terminal that could display 2 pages of 16 lines of 32 upper case characters on a standard television. The Don Lancaster design appeared on the cover of Radio-Electronics magazine in September 1973....
).

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.

There are some problems with bit-banging. More processing power is consumed in the software emulation process than in supporting dedicated hardware. The microcontroller is busy most of the time looking at samples or sending a sample to the pin, instead of performing other tasks. The signal produced normally has more jitter
Jitter

Jitter is an unwanted variation of one or more characteristics of a periodic Signalling in electronics and telecommunications. Jitter may be seen in characteristics such as the interval between successive pulses, or the amplitude, frequency, or phase of successive cycles....
 or glitch
Glitch

A glitch is a short-lived fault in a system. The term is particularly common in the computing and electronics industries, and in circuit bending, as well as among players of video games, although it is applied to all types of systems including human organizations and nature....
es, if the processor is also executing other tasks while communicating. However, if the bit-banging software is hardware interrupt-driven by the signal, this may be of minor importance.

C code example


const unsigned char bitMask8[] = ;

// This will send data in bit7~0, updating the clock each bit void send_8bit_serial_data(unsigned char data)



See also

  • Software-defined radio
    Software-defined radio

    A Software-Defined Radio system is a radio telecommunications system where components that have typically been implemented in hardware are instead implemented using software on a personal computer or other embedded computing devices....


External links

, a diploma thesis by Herbert Valerio Riedel, Vienna University of Technology
Vienna University of Technology

Vienna University of Technology is one of the major universities in Vienna, the capital of Austria. Founded in 1815 as the "Imperial-Royal Polytechnic Institute" , it currently has about 17,600 students , 8 faculties and about 4,000 staff members ....
, an example of bit-banged NTSC
NTSC

NTSC is the analog television system used in most of the Americas, Japan, South Korea, Taiwan, the Philippines, Burma, and some Pacific island nations and territories ....
 video , an article on bit-banging RS-232.