Question: Bit - Banging Introduction: There are many serial protocols including for example RS 2 3 2 . There is also I 2 C , One

Bit-Banging
Introduction: There are many serial protocols including for example RS232. There is also I2C, One-Wire, RS422 CanBus etc etc. If you have a protocol that your microcontroller cannot do, you have to use a program to emulate the protocol basically by making a pin go high and low. You will also need a program to read a pin and figure out what is being sent.
Implementation: In this lab we will use the RS232 protocol because we understand its structure. We will use 9600 baud, 8 bits, no parity and 1 stop bit. A bit-banging program that both transmits and receives is a but tricky so we will do the lab in two steps.
Step 1: Bit Bang tx You will input some text into the serial console, and use bit- banging to send the ascii codes out of a digital pin at 9600 baud. To check your transmission simply hook it into the rx input and print your message back to the console once you have sent your text.
Step 2: Bit Bang r Now the reverse, use the tx pin to output an asci string that you type into the console and use bit banging to read it In on a digital pin, displaying the results on the console.
programming Hints. You know the baud rate SO you know the duration of each pulse With 8N1 that's a total of 10 bits to sample including start and stop. If receiving simply wait for the input to go loW and then use a for loop to sample 10 bits with a suitable delay between (you may need delay-microseconds). If sending, take each character that needs to be sent, and send the appropriate ascii equivalent numbers, including start and stop bit with appropriate delays The Arduino code has built in methods to convert characters to ascii and ascii to characters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!