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

to transmit a message or byte on serial port directly on hyperterm

Discussion in '8051/8951' started by kavitha nair, Mar 20, 2013.

  1. kavitha nair

    kavitha nair New Member

    Joined:
    Dec 18, 2010
    Messages:
    9
    Likes:
    0
    dear sir
    I require to transmit a sentence or byte data to serial port.
    next I also require to read data from other controller connected on serial port.
    I have tried transmitting 'A' and 1 and it worked.I am trying simple program to send message given in mazidi. no errors generated but no output also.not getting what will be required.
    my program is attached
    thanking you
    regards
    kn
     

    Attached Files:

  2. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK
    Code (text):
    for(z=0;z<5;z++)
    {
       SBUF=fname[z];}
       while(!TI=0)     //............ WRONG!!  "while(!TI == 0)" This is equality..
       TI=0;          // ..... This is assignment!!      

    }
    You don't need the "TI = 0;" anyway..

    Try this code the while statement shouldn't include the "TI = 0;"

    Code (text):
    for(z=0;z<5;z++)
    {
       SBUF=fname[z];}
       while(!TI);
       TI=0;

    }
     
  3. geobabu

    geobabu New Member

    Joined:
    Jun 19, 2008
    Messages:
    55
    Likes:
    0
    Yes when a byte is transmitted, TI bit will become 1, so you should wait untill TI become high. As Ian mentioned instead of while(!TI=0) it should be either
    while(!TI); or while(TI == 0);
    Also there is slight problem is seeing that one additional closing curly bracket just in the end of SBUF=fname[z]; statement. you require to remove this , otherwise for loop will contentiously update the SBUF register before the data get transmitted, without checking the TI bit
     
  4. dave

    Dave New Member

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


     
  5. Ian Rogers

    Ian Rogers Super Moderator Most Helpful Member

    Joined:
    Mar 28, 2011
    Messages:
    9,304
    Likes:
    914
    Location:
    Rochdale UK

    No!! That was my fault.... Don't know how that got in there....
     
  6. geobabu

    geobabu New Member

    Joined:
    Jun 19, 2008
    Messages:
    55
    Likes:
    0
    No Ian , That bracket is also there inside Kavitha nair's attached code file. May be she tried the same code, which won't give a result.
     

Share This Page