1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

writting Software UART 8051

Discussion in '8051/8951' started by ahmedragia21, Nov 8, 2007.

  1. ahmedragia21

    ahmedragia21 Member

    Joined:
    Apr 5, 2006
    Messages:
    470
    Likes:
    1
    Location:
    Egypt,Cairo
    hi, im trying to write a software UART , im simulating it in proteus and using a 8051 cpu , 89S52...

    Code (text):

    void main()
    {

    TMOD=0x20;
    TH1=-3;
    SCON=0x50;
    TR1=1;

    while (1)
    {
    unsigned char a;
    a=0x41; // Send Characther A
    P3_7=1; //
    P3_7=0; // Start Bit
    delayms(1);
    for (i = 0; i < 8; i++) { // send the bits
     b[i] = a & 1; a = a >> 1;
     P3_7=b[i];  // Pin_3.7
    delayms(1);
     }
         

     
    i dont know but in the virtual terminal it should display the chracther A but it doesnt ... i dont know really why
     
  2. ajay_bhargav

    ajay_bhargav New Member

    Joined:
    Jun 18, 2006
    Messages:
    7
    Likes:
    0
  3. ahmedragia21

    ahmedragia21 Member

    Joined:
    Apr 5, 2006
    Messages:
    470
    Likes:
    1
    Location:
    Egypt,Cairo
    many many thanks !!

    i read ur article , can i've the C Code version ?
    or at least the project :) ?
    i wrote it and it worked , send me ur email and i will send u mine codes and analyze it ...
     
    Last edited: Nov 10, 2007
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. hasp.sharp

    hasp.sharp New Member

    Joined:
    Mar 13, 2013
    Messages:
    4
    Likes:
    0
    Location:
    chennai

    need software UART 8051

    hi,

    i need C code for software UART in 8051. because my task is i have to communicate the GSM modem with the 8051 microcontroller. for this i need to receive the message from the gsm and send the msg to the another one microcontroller. so i need two UART. i can communicate the GSM using hardware UART. but i need to communicate the another one microcontroller with this microcontroller by using software uart or any other ways?
     
  6. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,148
    Likes:
    907
    Location:
    Rochdale UK
    Or buy a chip with two uart's The at89c51re2 for example...
     
  7. hasp.sharp

    hasp.sharp New Member

    Joined:
    Mar 13, 2013
    Messages:
    4
    Likes:
    0
    Location:
    chennai
    what about software UART sir. am having at89s52 controller only
     
  8. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,148
    Likes:
    907
    Location:
    Rochdale UK
    Ok... Then do a software serial... Its up to you.... 8052.com is the best place to be..
     
  9. hasp.sharp

    hasp.sharp New Member

    Joined:
    Mar 13, 2013
    Messages:
    4
    Likes:
    0
    Location:
    chennai
    is there any posibility to perform both tx&rx between two separate devices with one 89s52microcontroller
     
  10. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,148
    Likes:
    907
    Location:
    Rochdale UK
    Of course you can... The hardware UART can be set up with interrupt driven ( or not) and the the software could be polled...
     
  11. hasp.sharp

    hasp.sharp New Member

    Joined:
    Mar 13, 2013
    Messages:
    4
    Likes:
    0
    Location:
    chennai
    thank you for your information sir. please give the coding for software UART
     
  12. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,148
    Likes:
    907
    Location:
    Rochdale UK
    I haven't done any for the 51 series... Try www.8052.com
     

Share This Page