Question: Bit - Banging Introduction: There are many serial protocols including for example RS 2 3 2 . There is also I 2 C , One
BitBanging
Introduction: There are many serial protocols including for example RS There is also IC OneWire, RS 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 RS protocol because we understand its structure. We will use baud, bits, no parity and stop bit. A bitbanging program that both transmits and receives is a but tricky so we will do the lab in two steps.
Step : 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 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 : 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 N that's a total of 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 bits with a suitable delay between you may need delaymicroseconds 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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
