Easiest way to use FTDI in c++ ?? - Embedded

This is a discussion on Easiest way to use FTDI in c++ ?? - Embedded ; 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 ...

+ Reply to Thread
Results 1 to 2 of 2

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

  1. Easiest way to use FTDI in c++ ??

    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

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

    On Jun 4, 7:41 am, witekada...@gmail.com wrote:
    > 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


    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 );

+ Reply to Thread