制御を行ないたい goniometer コントローラの設定は以下のようなもので ある.

上記の設定を行なうためのプログラムを以下に示す.
int init_rs232c_()
{
int filds;
struct termios buff;
extern int errno;
/****************** open device ******************/
if((filds = open("/dev/ttyS0",O_RDWR|O_NDELAY))== -1){
printf("ERROR: Can't open error %d\n",errno);
exit(-1);
}
/***************** get parameter *****************/
if( tcgetattr( filds, &buff) < 0) {
printf("ERROR: Can't get termios %d\n",errno);
exit(-1);
}
cfsetispeed(&buff, B9600);
cfsetospeed(&buff, B9600);
/************** terminal input control********************/
buff.c_iflag &= 0;
/************** terminal output control********************/
buff.c_oflag &= 0;
/************** terminal hardwear control********************/
buff.c_cflag &= 0; /*set all flag zero*/
buff.c_cflag |= CS7; /*set character size*/
buff.c_cflag |= PARENB; /*do the parity check*/
/************* terminal local mode control ******************/
buff.c_lflag &= 0; /*ignore special character*/
buff.c_cc[VMIN] = 0;
buff.c_cc[VTIME] = 5;
if(tcsetattr(filds, TCSANOW, &buff) < 0 ) {
printf("(GONIO)ERROR: Can't set termios%d\n",errno);
exit(-1);
}
return(0);
}