5/27/2019»»Monday

Qt Serial Port Rs485

5/27/2019
    17 - Comments
Qt Serial Port Rs485 Rating: 5,0/5 9527 votes
  1. Rs232 Vs Rs485
  2. Vga Port

I want to connect qt and a device using UART cable (RS232C) in linux.

I´m writing code, making ui and operating, but it does not work.

Vga port

I want to connect when i click some button(ui) device turn on and connect.

Currently I use the Qt 4.7 for Windows but in documentation I. Modbus is just a serial protocol using RS485. This kind of converter acts like a serial port.

Rs485

Also i want to make a function that if i enter some command device will recognize and execute.

Rs232 Vs Rs485

Below is my code , someone help me please. Shade 3d ver 14 keygen photoshop.

Qt Serial Port Rs485
user8577308

1 Answer

First of all it is not guaranteed that your device will be always connected to /dev/ttyUSB0 so you'l better search for your device by QSerialPortInfo with parameter QString manufacturer() const or quint16 productIdentifier() const or QString serialNumber() const.

Also you are creating too many QSerialPort and don't handle it. Create just one.

Vga Port

Here is sample code:

main.cpp

mainwindow.h

Next check your Your product manufacturer or serial number and set here.
Also you need separate handler for received data like I created readSerialData
mainwindows.cpp

latter if you want to send some data to your UART device just implemente slot and call method:

Volodymyr ShevchykVolodymyr Shevchyk