Results 1 to 2 of 2

Thread: [solved] QSerialDevice: How to set baudrate?

  1. #1
    Join Date
    Oct 2009
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default [solved] QSerialDevice: How to set baudrate?

    Hi,

    I use Qt 4.5 with Windows XP. I want to talk to devices with the serial port and tried out qextserialport but it does seem to have a great input buffer. Thus, I want to try out QSerialDevice 0.1. I started with the reader in the examples but want to change the port setting that do not seem to work since I get errors from

    MyDevice->setBaudRate("BaudRate115200");
    MyDevice->setBaudRate(19200);


    I do not know to to use as parameter.

    Thanks in Advance
    Last edited by schlingel; 14th October 2009 at 12:15.

  2. #2
    Join Date
    Jan 2009
    Location
    Russia
    Posts
    309
    Thanks
    2
    Thanked 43 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSerialDevice: How to set baudrate?

    1. First the need to open! It opens with parameters by default (9600 8 N 1)
    2. Further, it is possible to configure:
    Qt Code:
    1. bool setBaudRate (BaudRate baudRate);
    2. bool setBaudRate (const QString & baudRate);
    To copy to clipboard, switch view to plain text mode 
    example:
    Qt Code:
    1. ...
    2. AbstractSerial *MyDevice = new AbstractSerial();
    3. MyDevice->setDeviceName("COM1");
    4. MyDevice->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
    5. MyDevice->setBaudRate(AbstractSerial::BaudRate19200);
    6. ...
    To copy to clipboard, switch view to plain text mode 

    PS:
    use version 0.1.0
    PSS:
    if you find bugs or would anything is unclear - then write to me at e-mail
    (email address in the source code)
    Last edited by kuzulis; 14th October 2009 at 11:59.

  3. The following user says thank you to kuzulis for this useful post:

    schlingel (14th October 2009)

Similar Threads

  1. Library QSerialDevice v 0.1.0 released
    By kuzulis in forum Qt Programming
    Replies: 0
    Last Post: 15th September 2009, 06:47
  2. question about QSerialDevice (baudrate)
    By mastupristi in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2009, 08:54
  3. new library QSerialDevice
    By kuzulis in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2009, 05:42
  4. qextserialport BAUDRATE problem
    By dheeraj in forum Qt Programming
    Replies: 6
    Last Post: 19th March 2009, 19:29

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.