I am trying to communicate over the RS-485 port on a TS-7500 with TS-752 board.
I have connected pins 1 and 6 on the DB-9M port of the TS-752 board to a RS-458
device. I have tried to configure the ports using the following...
#xuartctl --port 0 --server --speed 9600
ttyname=/dev/pts/0
#xuartctl --port 1 --server --speed 9600
ttyname=/dev/pts/1
then in a program i tried to send over the both of the ports with no luck...
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include "convert.h"
using namespace std;
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <termios.h>
#define BAUDRATE B9600
#define _POSIX_SOURCE 1
#define FALSE 0
#define TRUE 1
volatile int STOP=FALSE;
int main(void) {
int fd;
struct termios oldtio, newtio;
fd = open("/dev/pts/0", O_RDWR | O_NOCTTY);
if (fd <0) {
perror("/dev/pts/0");
exit(-1);
}
tcgetattr(fd, &oldtio); //save current settings
bzero(&newtio, sizeof(newtio)); //clear new port settings
newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | PARENB;
newtio.c_iflag = IGNPAR | IGNBRK;
newtio.c_oflag = OPOST;
newtio.c_lflag = 0;
tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &newtio);
char data[50];
sprintf(data,"%c0101%cAC11R1C1A1P%c",0x02,0x1b,0x04);
write(fd,&data[0],18);
printf("sent on serial line: %s\n",&data[0]);
tcsetattr(fd, TCSANOW, &oldtio); //restore old setting
}
any ideas?
------------------------------------
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/
|