<DIV> I could execute my program well but It just hangs while reading data. </DIV>
<DIV> I tested whether my data is transmitted or not through</DIV>
<DIV> </DIV>
<DIV> cat /proc/tty/driver/serial</DIV>
<DIV>It says that</DIV>
<DIV>0 :uart:16550A port:3F8 irq:4 tx:3 rx:0 (becoz I am making use of ttyS0)</DIV>
<DIV> </DIV>
<DIV>where has at the receiver end I got the message as</DIV>
<DIV> </DIV>
<DIV>0 :uart:16550A port:3F8 irq:3 tx:0 rx:0</DIV>
<DIV> </DIV>
<DIV>Are there any formatted way I should follow such that the written data can be properly read.</DIV>
<DIV> </DIV>
<DIV>Thanx i advance<BR>Sowmya<BR><B><I>Andrew Weaver <Andrew.Weaver@tecnomen.fi></I></B> wrote:</DIV>
<BLOCKQUOTE class=replbq style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #1010ff 2px solid"><BR><BR>On Tuesday, October 14, 2003 12:19 PM, sowmya.k [SMTP:sowmi99@yahoo.com]<BR>wrote:<BR>> I had connected 2 systems using null modem<BR>> cable(RS232). <BR>> My problem comes in the reading part.<BR>> My coding goes this way.<BR>> First I had opened my tty (i.e my terminal screen<BR>> and keyboard)<BR>> Then I set some parameters to it.<BR>> Third I opened my port and finished all my<BR>> settings.<BR>> Fourth I started to write and read datas from the<BR>> port.<BR>> Atlast I closed everything.<BR>> Let me give the code I used to read and write<BR>> <BR>> <BR>> To write datas to the port<BR>> <BR>> while (STOP==FALSE) //STOP is defined to be<BR>> TRUE<BR>> {<BR>> status = fread(&Key,1,1,input);<BR>> if (status==1) //if a key was hit<BR>> {<BR>> fputc((int) Key,output);<BR>> write(fd,&Key,1);
//write 1 byte<BR>> to the port<BR>> } <BR>> }<BR>> <BR>> <BR>> <BR>> To read from the port<BR>> <BR>> if (wait_flag==FALSE) //if input is<BR>> available<BR>> {<BR>> res = read(fd,buf,255);<BR>> if (res)<BR>> {<BR>> for (i=0; i<RES; chars<br all for i++)>> in string<BR>> {<BR>> In1 = buf[i];<BR>> printf(message,"%c ",In1);<BR>> fputs(message,output);<BR>> }<BR>> }<BR>> wait_flag = TRUE; /* wait for new<BR>> input */<BR>> } //end if wait flag == FALSE<BR>> <BR>> } //while stop==FALSE<BR>> <BR>> <BR>> Thanking you<BR>> <BR>> sowmya<BR>> <BR>So... what is the problem that you are getting?<BR><BR><BR><BR><BR>> __________________________________<BR>> Do you Yahoo!?<BR>> The New Yahoo! Shopping - with improved product search<BR>> http://shopping.yahoo.com<BR>> _______________________________________________<BR>> This is the Linux C Programming List<BR>> :
http://lists.linux.org.au/listinfo/linuxcprogramming List<BR>_______________________________________________<BR>This is the Linux C Programming List<BR>: http://lists.linux.org.au/listinfo/linuxcprogramming List</BLOCKQUOTE><p><hr SIZE=1>
Do you Yahoo!?<br>
<a href="http://shopping.yahoo.com/?__yltc=s%3A150000443%2Cd%3A22708228%2Cslk%3Atext%2Csec%3Amail">The New Yahoo! Shopping</a> - with improved product search