I don't have the ttts4 or ttts5 files in the /dev folder.
On Wed, Aug 13, 2008 at 1:56 PM, vigu <> wrote:
> how to set the pins to be 7 or 8 instead of 3/2
>
> On Wed, Aug 13, 2008 at 1:48 PM, Eric Robishaw <> wrote:
>> You might want to look at the microterm.c example in the files section of
>> this yahoo group:
>> http://tech.groups.yahoo.com/group/ts-7000/files/
>> look for "microterm.c"
>>
>> Eric
>>
>>
>> On Wed, Aug 13, 2008 at 11:40 AM, vigu <> wrote:
>>>
>>> thanks a lot .. but when i read data it returned me -1. is there
>>> something wrong in what i'm doing. i'm sorry am very new to serial
>>> programming. here is the code
>>>
>>> #include <stdio.h>
>>> #include <unistd.h>
>>> #include <fcntl.h>
>>> #include <errno.h>
>>> #include <termios.h>
>>>
>>> int initComm() {
>>>
>>> int fd;
>>> struct termios options;
>>>
>>> // Open the RS232 port
>>> fd = open("/dev/ttts4", O_RDWR | O_NOCTTY );
>>> if(fd == -1) {
>>> #ifdef DEBUG
>>> printf("Could not open the comm port.\r\n");
>>> #endif
>>> return fd;
>>> }
>>>
>>> // Clear the flags
>>> fcntl(fd, F_SETFL, 0);
>>>
>>> // Get the port options
>>> tcgetattr(fd, &options);
>>> // Set the speed
>>> cfsetispeed(&options, B9600);
>>> cfsetospeed(&options, B9600);
>>>
>>> // Set the comm flags (115200 8N1)
>>> options.c_cflag = B9600 | CS8 | CLOCAL | CREAD;
>>> options.c_iflag = 0;
>>> options.c_oflag = 0;
>>> options.c_lflag = 0;
>>>
>>> // Set the timeout to be 1000ms
>>> options.c_cc[VMIN] = 0;
>>> options.c_cc[VTIME] = 10;
>>>
>>> // Save these settings
>>> tcsetattr(fd, TCSANOW, &options);
>>>
>>> // Flush the settings
>>> tcflush(fd, TCIFLUSH);
>>> tcflush(fd, TCOFLUSH);
>>>
>>> return fd;
>>>
>>> }
>>
>>
>
>
>
> --
> With regards,
> Vignesh Badrinarayanan
>
--
With regards,
Vignesh Badrinarayanan
------------------------------------
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/
|