ts-7000
[Top] [All Lists]

Re: [ts-7000] com 3 in 7800

To:
Subject: Re: [ts-7000] com 3 in 7800
From: vigu <>
Date: Wed, 13 Aug 2008 13:40:37 -0300
thanks a lot .. but when i read data it returned me -1. is there
something wrong in what i'm doing. i'm sorry am very new to serial
programming. here is the code

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <termios.h>

int initComm() {

        int fd;
        struct termios options;

        // Open the RS232 port
        fd = open("/dev/ttts4", O_RDWR | O_NOCTTY );
        if(fd == -1) {
#ifdef DEBUG
                printf("Could not open the comm port.\r\n");
#endif
                return fd;
        }

        // Clear the flags
        fcntl(fd, F_SETFL, 0);

        // Get the port options
  tcgetattr(fd, &options);
 // Set the speed
        cfsetispeed(&options, B9600);
        cfsetospeed(&options, B9600);

        // Set the comm flags (115200 8N1)
        options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
        options.c_iflag = 0;
        options.c_oflag = 0;
        options.c_lflag = 0;

        // Set the timeout to be 1000ms
        options.c_cc[VMIN] = 0;
        options.c_cc[VTIME] = 10;

        // Save these settings
        tcsetattr(fd, TCSANOW, &options);

        // Flush the settings
        tcflush(fd, TCIFLUSH);
        tcflush(fd, TCOFLUSH);

        return fd;

}

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU