<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://rs-485.com/index.php?action=history&amp;feed=atom&amp;title=Bit_banging</id>
	<title>Bit banging - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://rs-485.com/index.php?action=history&amp;feed=atom&amp;title=Bit_banging"/>
	<link rel="alternate" type="text/html" href="https://rs-485.com/index.php?title=Bit_banging&amp;action=history"/>
	<updated>2026-05-04T16:24:21Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://rs-485.com/index.php?title=Bit_banging&amp;diff=1147&amp;oldid=prev</id>
		<title>RS-485: Imported from Wikipedia (overwrite)</title>
		<link rel="alternate" type="text/html" href="https://rs-485.com/index.php?title=Bit_banging&amp;diff=1147&amp;oldid=prev"/>
		<updated>2026-05-03T12:15:24Z</updated>

		<summary type="html">&lt;p&gt;Imported from Wikipedia (overwrite)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Short description|Using software instead of dedicated hardware to process and make use of signals}}&lt;br /&gt;
{{Distinguish|Bit-twiddling|Bit-slicing|Bit-banding}}&lt;br /&gt;
{{ref improve|date=July 2014}}&lt;br /&gt;
{{Use dmy dates|date=December 2021|cs1-dates=y}}&lt;br /&gt;
{{Use list-defined references|date=December 2021}}&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Bit banging&amp;#039;&amp;#039;&amp;#039; is a [[term of art]] that describes a method of [[Digital electronics|digital]] [[data transmission]] as using [[general-purpose input/output]] (GPIO) instead of [[computer hardware]] that is intended specifically for [[data communication]].&amp;lt;ref name=&amp;quot;Analog devices - Glossary of EE Terms&amp;quot;/&amp;gt; Controlling [[software]] is responsible for satisfying [[Communication protocol|protocol]] [[requirement]]s including timing which can be challenging due to limited host [[system resources]] and competing demands on the software. &lt;br /&gt;
&lt;br /&gt;
In contrast, dedicated communication hardware (e.g., [[UART]], [[Serial Peripheral Interface|SPI]], [[I²C]]) satisfies protocol requirements which tends to reduce the [[Execution (computing)|runtime load]] on the controlling system {{endash}} software and its host [[Processor (computing)|processor]]. In particular, some communication hardware provides [[data buffer]]ing to lower the runtime load of the controlling system. There are also peripheral devices dedicated to bit-banging called [[programmable input/output]], combining the flexibility of bit-banging and the low runtime-load of dedicated hardware.&lt;br /&gt;
&lt;br /&gt;
The bit banging method may allow a computer to support a protocol with limited or no hardware changes and therefore bit banging can be a lower cost option since changing software is typically less expensive than changing hardware. &lt;br /&gt;
&lt;br /&gt;
Bit banging is commonly used in [[embedded systems]].&amp;lt;ref name=&amp;quot;Predko_2000&amp;quot;/&amp;gt; &lt;br /&gt;
&lt;br /&gt;
Choosing between bit banging and dedicated communication hardware involves [[trade-off]]s between load, performance and reliability on one hand, and availability of hardware on the other. Bit banging consumes more processing resources than using dedicated hardware. The processor spends much of its time controlling data lines which precludes other processing. Also, unless hardware interrupt latency is uniform such as in early models of [[PIC_microcontrollers#Performance|Atmel PICs]], and other guarantees made that are usually found in [[barrel processor]] designs such as the [[CDC 6600]] I/O co-processor, bit banging typically results in a lower quality signal {{endash}} with more [[jitter]] and [[glitch]]es {{endash}} especially if the processor is performing other tasks simultaneously. However, if the software is interrupt-driven by the signal, the signal quality may be better, especially if control signals such as [[RS-232#RTS/CTS handshaking|RTS, CTS]], or [[Data Carrier Detect|DCD]] are available. Bit banging may be the only solution when dedicated communication hardware is not available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The following [[C (programming language)|C language]] code example transmits a byte of data on an [[Serial Peripheral Interface Bus|SPI]] bus via bit banging.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;C&amp;quot;&amp;gt;&lt;br /&gt;
void send_8bit_serial_data(unsigned char data) &lt;br /&gt;
{&lt;br /&gt;
   // select device (active low)&lt;br /&gt;
   output_low(SD_CS);&lt;br /&gt;
&lt;br /&gt;
   // send bits 7..0&lt;br /&gt;
   for (int i = 0; i &amp;lt; 8; i++)&lt;br /&gt;
   {&lt;br /&gt;
       // consider leftmost bit&lt;br /&gt;
       // set line high if bit is 1, low if bit is 0&lt;br /&gt;
       if (data &amp;amp; 0x80)&lt;br /&gt;
           output_high(SD_DI);&lt;br /&gt;
       else&lt;br /&gt;
           output_low(SD_DI);&lt;br /&gt;
&lt;br /&gt;
       // pulse the clock state to indicate that bit value should be read&lt;br /&gt;
       output_low(SD_CLK);&lt;br /&gt;
       delay();&lt;br /&gt;
       output_high(SD_CLK);&lt;br /&gt;
&lt;br /&gt;
       // shift byte left so next bit will be leftmost&lt;br /&gt;
       data &amp;lt;&amp;lt;= 1;&lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
   // deselect device&lt;br /&gt;
   output_high(SD_CS);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* {{Annotated link|1-bit architecture}}&lt;br /&gt;
* {{Annotated link|Bit manipulation}}&lt;br /&gt;
* {{Annotated link|Bit stream}}&lt;br /&gt;
* {{Annotated link|Bit twiddler (disambiguation)}}&lt;br /&gt;
* {{Annotated link|Bit-serial architecture}}&lt;br /&gt;
* {{Annotated link|Fast loader}}&lt;br /&gt;
* {{Annotated link|FTDI}}&lt;br /&gt;
* {{Annotated link|Integrated Woz Machine}} (IWM)&lt;br /&gt;
* {{Annotated link|Light pen}}&lt;br /&gt;
* {{Annotated link|Polling (computer science)}}&lt;br /&gt;
* {{Annotated link|Software-defined radio}}&lt;br /&gt;
* {{Annotated link|Virtual machine}}&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Predko_2000&amp;quot;&amp;gt;{{cite book |title=Programming and customizing PICmicro microcontrollers |edition=2nd |author-first=Michael |author-last=Predko |publisher=[[McGraw-Hill Professional]] |date=2000 |isbn=978-0-07-136172-9 |pages=[https://archive.org/details/programmingcusto00pred_0/page/10 10]–12 |url=https://archive.org/details/programmingcusto00pred_0|url-access=registration }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ref name=&amp;quot;Analog devices - Glossary of EE Terms&amp;quot;&amp;gt;{{cite web |url=https://www.analog.com/en/resources/glossary/bit_banging.html|title=Analog Devices Glossary of Electrical Engineering (EE) Terms |access-date=22 September 2024}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/references&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [http://www.brouhaha.com/~eric/pic/bitbanging.html Notes on bit-banging async serial]&lt;br /&gt;
* [http://www.dnatechindia.com/Tutorial/8051-Tutorial/BIT-BANGING.html Bit banging for Async Serial Communication]&lt;br /&gt;
* [http://www.ganssle.com/articles/auart.htm Bit banging for RS-232]&lt;br /&gt;
* [https://codinglab.blogspot.com/2008/10/i2c-on-avr-using-bit-banging.html I2C on AVR using bit banging]&lt;br /&gt;
* [https://web.archive.org/web/20120823060749/http://www.maxim-ic.com/app-notes/index.mvp/id/3524 Efficient bit-banged SPI for 8051 microcontroller]&lt;br /&gt;
&lt;br /&gt;
[[Category:Data transmission]]&lt;br /&gt;
[[Category:Signal processing]]&lt;br /&gt;
[[Category:Digital circuits]]&lt;br /&gt;
[[Category:Embedded systems]]&lt;/div&gt;</summary>
		<author><name>RS-485</name></author>
	</entry>
</feed>