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.

  • 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.

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

Status
Not open for further replies.

kavitha nair

New Member
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
 

Attachments

  • sbuf_char11.txt
    372 bytes · Views: 136

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
Code:
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:
for(z=0;z<5;z++)
{
   SBUF=fname[z];}
   while(!TI);
   TI=0;

}
 

geobabu

Member
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
 

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
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

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

geobabu

Member
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.
 
Status
Not open for further replies.

Latest threads

Top