communication via serial port

communication via serial port

Post by Piotr Hawrane » Thu, 21 Aug 1997 04:00:00



Hi !
I must to learn how to communicate via serial port under LINUX.
I have never programed at low level.
If anyone can  give me advice how should I start (I mean what should I
do I first), I'll be very glad. Is there any www. , or mayby some book,
which will be helpful for me ?

        Thanks anybody who help me !
        Peter


    because I don't have enough time to read all nevs list.

 
 
 

1. Problems with communication via serial port

Hi,

I'm trying to write a C program wich is to communicate with a Z80
mini-computer via serial port. Now, if I use the program with QNX,
everything works fine, but if I'm trying to use it with Linux,
no communication is possible. The data being transfered is useless.
(I've built in checksums) I guess it's because of the port
parameters, but I cannot figure out what to change. I have looked
into the man page and the programming document at
"http://dns.easysw.com/~mike/serial" but it's no use, it does not
work with Linux.
Please help!

Here's my code to set the port parameters:

        struct termios opts;

        if (tcgetattr(hSer,&opts)) {
                close(hSer);
                return -2;
        }
        /* Set I/O speed */
        cfsetispeed(&opts,B4800);
        cfsetospeed(&opts,B4800);

        /* No Parity */
        opts.c_cflag &= ~PARENB;

        /* 8 data bits, 2 stop bits
        opts.c_cflag &= ~CSIZE;
        opts.c_cflag |= CS8;
        opts.c_cflag |= CSTOPB;

        /* raw Input */
        opts.c_lflag &= ~(ICANON | ECHO | ISIG);

        /* no parity check (QNX: ISTRIP strips top bit not parity bit) */
        opts.c_iflag &= ~(INPCK | ISTRIP);

        /* no software flow control */
        opts.c_iflag &= ~(IXON | IXOFF);
        #ifndef linux
        opts.c_iflag &= ~IXANY; /* (IXANY undefined with QNX) */
        #endif

        /* raw output */
        opts.c_oflag &= ~OPOST;

        /* No extentions */
        opts.c_lflag &= ~IEXTEN;

        /* Now, set it */
        if (tcsetattr(hSer,TCSANOW,&opts) != 0) {
                close(hSer);
                return -2;
        }

Thanks,
Klaus

2. Compiler Error while using new.

3. Serial Port Communications via C Program

4. how do work chap for linux pppd?

5. How to set up serial port when programming serial communication

6. How to use spin_lock & unlock?

7. sbni: update last_rx after netif_rx

8. Solaris 8,9,10 serial consoles via serial port how to raise speed?

9. Serial communication via openbsd?

10. Serial Communication via Modems

11. Linux serial port communication - Need help!!!!!!!!!

12. Serial Port Communication