Do you have a question? Post it now! No Registration Necessary
Subject
- Posted on
Easiest way to use FTDI in c++ ??
- 06-03-2008
- witekadamus
June 3, 2008, 9:41 pm

Hi all. I have FTDI chip which is seen as /dev/ttyUSB0
Im connecting with it using putty with no problems but Id like to put
all of this what is putten by my chip into my own application (using
Qt4 and already looking nice).
Now Im getting ewerything by system('cat /dev/ttyUSB0') - but its not
cool. I know that there must be something especially for it. Maybe
some kind of lib or sth.
ps. it works at 115200
Im connecting with it using putty with no problems but Id like to put
all of this what is putten by my chip into my own application (using
Qt4 and already looking nice).
Now Im getting ewerything by system('cat /dev/ttyUSB0') - but its not
cool. I know that there must be something especially for it. Maybe
some kind of lib or sth.
ps. it works at 115200

Re: Easiest way to use FTDI in c++ ??

Why not use the "open" command like ....
fdPort = open( SERIAL_PORT, O_RDWR | O_NOCTTY );
if (fdPort < 0)
{
printf("\nError opening %s - %d %s\n", SERIAL_PORT, errno,
strerror(errno));
return -1;
}
//Save old attributes of the port
tcgetattr( fdPort, &oldAttr );
//Configure port with new attributes
bzero( &newAttr, sizeof( newAttr ));
newAttr.c_cflag = BAUD_RATE | CS8 | CREAD | CLOCAL ;
newAttr.c_iflag = IGNPAR;
newAttr.c_oflag = 0;
//non-cononical mode
newAttr.c_lflag = 0;
//Unused inter ch timer
newAttr.c_cc[ VTIME ] = 0;
//No blocking for read chars
newAttr.c_cc[ VMIN ] = 0;
tcflush( fdPort, TCIFLUSH );
tcsetattr( fdPort, TCSANOW, &newAttr );
Site Timeline
- » Cross-Compile ncurses for ARM?
- — Next thread in » Embedded Linux
-
- » Linux Kernel for SiS 55x SoC based system
- — Previous thread in » Embedded Linux
-
- » Crosscompiling for ARM: reloc type R_ARM_ABS32 is not supported for PIC - ...
- — Newest thread in » Embedded Linux
-
- » Broadband filter matching design
- — The site's Newest Thread. Posted in » Electronics Design
-
- » Re: OT: The Deep State defined
- — The site's Last Updated Thread. Posted in » Electronics Design
-