ts-7000
[Top] [All Lists]

Re: [ts-7000] Connecting TS to my Robot

To:
Subject: Re: [ts-7000] Connecting TS to my Robot
From: Jim Jackson <>
Date: Tue, 13 Dec 2005 06:17:45 +0000 (GMT)

On Mon, 12 Dec 2005, ashraf_abussaud wrote:

> Hi All,
>
> I want to connect the TS-7200 to my TJ-Pro Robot through the COM2
> port. i do the following
> 1. I disabled the getty ob COM2
> 2.i gave the follwoing preivladge "chmod a+rw /dev/ttyAM1"
> 3.I used the following C Code(note this code is okay on my FEDORA
> Linux Desktop"

I doubt it!

Look at this line..........

         options.c_cflag = B9600 | ~CRTSCTS | CS8 | CLOCAL | CREAD;
                                 ^^^^^^^^^^^

This is going to set EVERY BIT in c_cflag except the CRTSCTS bit
you need something like......

          options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
          options.c_cflag &= ~CRTSCTS;

Jim


> --------------------------------------
>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h> /* String function definitions */
> #include <unistd.h> /* UNIX standard function definitions */
> #include <fcntl.h> /* File control definitions */
> #include <errno.h> /* Error number definitions */
> #include <termios.h> /* POSIX terminal control definitions */
>
>
>
>
>
> int main()
>   {
>
>         int fd,res;
>         struct termios options;
>         char buf[255];
>
>         fd = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY);
>         if (fd == -1)
>                       {
>                               fprintf(stderr, "open_port: Unable to open 
> /dev/ttyAM1 - %s\n",
>                               strerror(errno));
>                       }
>
>
>        bzero(&options, sizeof(options)); /* clear struct for new port
> settings */
>
>        options.c_cflag = B9600 | ~CRTSCTS | CS8 | CLOCAL | CREAD;
>
>         /*
>           IGNPAR  : ignore bytes with parity errors
>           ICRNL   : map CR to NL (otherwise a CR input on the other
> computer
>                     will not terminate input)
>           otherwise make device raw (no other input processing)
>         */
>      options.c_iflag = IGNPAR | ICRNL;
>
>         /*
>          Raw output.
>         */
>      options.c_oflag = 0;
>
>         /*
>           ICANON  : enable canonical input
>           disable all echo functionality, and don't send signals to
> calling program
>         */
>      options.c_lflag = ICANON;
>
>
>       printf("The File Discriptor is %d \n",fd);
>
>       tcflush(fd, TCIFLUSH);
>     tcsetattr(fd,TCSANOW,&options);
>
>
>
>       while (1)
>       {
>        res = read(fd,buf,255);
>        buf[res]=0;             /* set end of string, so we can printf */
>          if(res==-1)
>                  continue;
>        printf(":%s:%d\n", buf, res);
>
>        if (buf[0]=='z')
>                break;
>
>       buf[0]='L';
>
>       buf[1]='i';
>
>       buf[2]='n';
>
>       buf[3]='U';
>
>       buf[4]='x';
>
>       buf[5]=0;
>
>       write(fd,buf,4);
>       }
>
>
>        close(fd);
>
>        printf("The File Discriptor is %d \n",fd);
>
>      return 0;
>   }
>
> --------------------------------------
>
> the problem is on the write part. because when i connect the KIT to a
> PC running hyper terminal the kit can read the
>
> chracters stroked on the PC but it can not write anything to the hyper
> terminal.
> Note= if i connect my Fedora 3 desktop to the other PC and i ran the
> same code(replace ttyAM1 by ttyS1 every thing is okay
>
> even the wirite part!!!!!!!!!
>
> Please any one has any idea.
>
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
1.2 million kids a year are victims of human trafficking. Stop slavery.
http://us.click.yahoo.com/.QUssC/izNLAA/TtwFAA/CFFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

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

<*> 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