ts-7000
[Top] [All Lists]

Re: [ts-7000] TS-7260

To:
Subject: Re: [ts-7000] TS-7260
From: Michael L Howard <>
Date: Thu, 17 Aug 2006 18:24:07 -0400 (EDT)
Hi Ryan,

Are you using a serial port monitor?  I have done a fair amount of serial 
device control software and found that a serial port sniffer is a necessary 
tool.  It could tell you a few things I am wondering about after reading your 
post:

Is the hardware flow control to the device working?  You set it to none one the 
embedded device, but is the sensor waiting for you to enable it?

Is there actually characters going to the sensor?

Is there a response coming from the sensor?

Are your data lines supposed to be reversed through a null-modem connection?

You could find and download this software for free and use it to make sure you 
have a linux problem.

Alternatively, hook your TS-7260 to a terminal emulator on another computer and 
spoof the sensor to make sure what you type goes into your code on the read 
call.

Mike 





-----Original Message-----
>From: weide72 <>
>Sent: Aug 17, 2006 3:25 PM
>To: 
>Subject: [ts-7000] TS-7260
>
>I am trying to communicate with a device that measures voltage, 
>amps, etc. via COM2 on the TS-7260.  The device needs a 4-byte array 
>sent to it and responds with a 3-byte array containing the requested 
>information.  I am pretty sure that I have intialized all the 
>settings for COM2 correctly. I guess I'm not sure what the correct 
>way to send the 4-byte array is or if I need to do anything more to 
>set up COM2 besides in code. Can anyone help?  My code is as 
>follows:   
>
>#include <termios.h>
>#include <stdio.h>
>#include <unistd.h>
>#include <sys/time.h>
>#include <string.h>
>#include <fcntl.h>
>#include <errno.h>
>#include <sys/mman.h>
>#include <sys/ioctl.h>
>#include <asm/ioctls.h>
>
>int main(void)
>{
>int fd,n;
>
>char send[] = {129, 3, 2, 121};        //array to request average battery 1 
>volts
>
>printf("Bytes sent %s\n", send);
>struct termios options;
>char buf[2];
>
>fd = open("/dev/ttyAM1", O_RDWR | O_NOCTTY | O_NDELAY | O_NONBLOCK);
>if (fd == -1) 
>{
>perror ("Open port /dev/ttyAM1 failure\n");
>return -1;
>}
>
>tcgetattr(fd,&options); 
>
>/* Set Baud rate to 2400bps
>*******************************************/
>cfsetispeed(&options, B2400);
>cfsetospeed(&options, B2400);
>
>/* Enable the receiver and set local mode 
>****************************/
>options.c_cflag |= ( CLOCAL | CREAD);
>
>/* Set Parity to 8-N-1 
>***********************************************/
>options.c_cflag &= ~PARENB;
>options.c_cflag &= ~CSTOPB;
>options.c_cflag &= ~CSIZE;
>options.c_cflag |= CS8;
>
>/* Set Software and Hardare Flow control to none 
>******************************************/
>options.c_iflag &= ~(IXOFF | IXOFF | IXANY);
>options.c_cflag &= ~CRTSCTS;
>
>/* Set read to raw input 
>*********************************************/
>options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG);
>
>/*  Set Raw Output
>*********************************************/
>options.c_oflag &= ~OPOST;
>
>/*  Set timeout to 1 second
>*****************************************************/
>options.c_cc[VMIN] = 0;
>options.c_cc[VTIME] = 10;
>
>/* flush the serial port 
>*************************************************/
>tcflush(fd, TCIFLUSH);
>
>/*  Save options 
>*****************************************************/
>tcsetattr(fd,TCSANOW,&options);
>
>n = write(fd,send,4);
>
>n = read(fd,buf,3);
>printf("Bytes read %i\n",n);
>printf("buf = %s\n" ,buf);
>close(fd);
>return 0;
>}
>
>The program returns value for the write but nothing is ever read.  
>Also, for connecting the COM2 header to a DB-9 I have the following:
>COM2 Pin2(RXD) = DB9 Pin2(RXD)
>COM2 Pin3(TXD) = DB9 Pin3(TXD)
>COM2 Pin5(GND) = DB9 Pin5(GND)
>Thanks for the help.
>
>Ryan Weidemann   
>
>
>
>
>
>





 
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