Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

some question about bit banging

Status
Not open for further replies.

hero0765

Member level 2
Joined
Sep 15, 2008
Messages
52
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
China
Activity points
1,605
bitbanging

I want to use "bit banging" to realize the UART port function. I uses Software for communication instead of a dedicated hardware.

I know the ALGORITHM for Sending Byte
1. Start.
2. Make Tx pin Low (Stop Bit).
3. Wait for duration corresponding to baud rate.
4. Send data bit.
5. Wait for duration corresponding to baud rate.
6. Go to 4 till all eight data bits haven’t been sent.
7. Send Stop Bit
8. Wait for duration corresponding to baud rate.
9. Make Tx pin High
10. Stop


I want to send Bytes by this method to communicate with the PC .
I set the baud rate of the PC at 9600 bps.So I alternate the transmit pin after specific interval . The interval is 1/9600. Can I be successful to do ?
 

Bit banging is possible only with very low speed if you are using a controller for sending data. Since you have SBUF restriction bit banging is difficult with 9600.
 

which range of baud rate of the PC is compatible with the bit banging?
 

ya 9600 bps is easily achievable using bit banging
the baud rate achievable depends on the crystal used and the controller ur using
 

amol_shah is right, It depends on the crystal and the uC you're using.

For example, in most 8051 based uC's, a machine cycle takes 12 clocks cycles, so with a 11.0592 MHz crystal (kind of a standard value when serial communications is held), you have 11.0592 MHz / 12 = 921600 machine cycles per second. If you want to transmit at 9600 bps, you will have 921600 / 9600 = 96, so each bit will last 96 machine cycles, which is a reasonable value if you applications is not very CPU demanding.

With most 8 bit PIC based uC's, for example, a machine cycle takes 4 clocks cycles, so you should go with a 3.6864 MHz crystal (3.6864 MHz / 12 = 921600; the rest f the calculation is the same for the example above).

From this it should be clear that doubling the crystal value, you also double the possible data rate; also a uC that takes less clock cycles for each machine cycles, will have a faster data rate.

I hop that helps. Best regards.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top