[LCP]reg serial communication in linux.

sowmya.k sowmi99 at yahoo.com
Wed Oct 15 13:29:02 UTC 2003


 I could execute my program well but It just hangs while reading data. 
 I tested whether my data is transmitted or not through
 
 cat /proc/tty/driver/serial
It says  that
0 :uart:16550A port:3F8 irq:4 tx:3 rx:0 (becoz I am making use of ttyS0)
 
where has at the receiver end I got the message as
 
0 :uart:16550A port:3F8 irq:3 tx:0 rx:0
 
Are there any formatted way I should follow such that the written data can be properly read.
 
Thanx i advance
Sowmya
Andrew Weaver <Andrew.Weaver at tecnomen.fi> wrote:


On Tuesday, October 14, 2003 12:19 PM, sowmya.k [SMTP:sowmi99 at yahoo.com]
wrote:
> I had connected 2 systems using null modem
> cable(RS232). 
> My problem comes in the reading part.
> My coding goes this way.
> First I had opened my tty (i.e my terminal screen
> and keyboard)
> Then I set some parameters to it.
> Third I opened my port and finished all my
> settings.
> Fourth I started to write and read datas from the
> port.
> Atlast I closed everything.
> Let me give the code I used to read and write
> 
> 
> To write datas to the port
> 
> while (STOP==FALSE) //STOP is defined to be
> TRUE
> {
> status = fread(&Key,1,1,input);
> if (status==1) //if a key was hit
> {
> fputc((int) Key,output);
> write(fd,&Key,1); //write 1 byte
> to the port
> } 
> }
> 
> 
> 
> To read from the port
> 
> if (wait_flag==FALSE) //if input is
> available
> {
> res = read(fd,buf,255);
> if (res)
> {
> for (i=0; i> in string
> {
> In1 = buf[i];
> printf(message,"%c ",In1);
> fputs(message,output);
> }
> }
> wait_flag = TRUE; /* wait for new
> input */
> } //end if wait flag == FALSE
> 
> } //while stop==FALSE
> 
> 
> Thanking you
> 
> sowmya
> 
So... what is the problem that you are getting?




> __________________________________
> Do you Yahoo!?
> The New Yahoo! Shopping - with improved product search
> http://shopping.yahoo.com
> _______________________________________________
> This is the Linux C Programming List
> : http://lists.linux.org.au/listinfo/linuxcprogramming List
_______________________________________________
This is the Linux C Programming List
: http://lists.linux.org.au/listinfo/linuxcprogramming List

---------------------------------
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/linuxcprogramming/attachments/20031015/2c41eba0/attachment.htm 


More information about the linuxCprogramming mailing list