Mike-
I already have communicated with this device using a PC and
VisualBasic.NET. Everything worked very well. There is no hardware
flow control used with this device. The only thing you need to send
it is that 4-byte array and it should respond within a couple milli
seconds with the requested data. I do have a question about the
connections though. I called TS and they said that PIN3 on the COM2
header should be connected to PIN3 on the DB-9 connector. And the
same for pins 2-2 and 5-5. This doesn't make sense to me becuase
that means that the transmit from the COM2 header is connected to
the transmit of the DB-9 and same for the recieve line. Shouldn't
transmit on the COM2 header be connected to recieve on the DB-9???
Ryan
--- In ts-7000%40yahoogroups.com, Michael L Howard <> wrote:
>
> 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: ts-7000%40yahoogroups.com
> >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
> >
> >
> >
> >
> >
> >
>