A USB2.0 program by QT

文章讲述了如何通过FPGA配合AD7606采集8个或更多通道的数据,并通过USB2.0传输。同时,讨论了在Qt项目中调整屏幕分辨率时遇到的问题,以及如何设置自动缩放因子以适应不同分辨率。最后介绍了如何在Qt项目中链接libftd2xx库以使用其功能。
摘要由CSDN通过智能技术生成

There is a system that use fpga to gather 8 or more channels data by AD7606 and upload by USB2.0(IC is FT232H).

QT part problem solve

1.I have found that if I use a low screen resolution to generate QT project ui file, and move this project to different screen resolution, It will lead to a display error. I think maybe the ui file is designed by  screen resolution, so when open in a high screen resolution the place will be jam.

qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");

Use this code to set auto zoom is ture, and then the window size will adapt to your different screen resolution. But remember this code must set at before whole project start.

int main(int argc, char *argv[])
{
    qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
    QApplication a(argc, argv);
    Widget w;
    w.show();
    return a.exec();
}

2.How to link a lib

#-------------------------------------------------
#
# Project created by QtCreator 2024-04-14T23:27:13
#
#-------------------------------------------------

QT       += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = USB
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
        main.cpp \
        widget.cpp

HEADERS += \
        widget.h \
        ftd2xx.h

FORMS += \
        widget.ui


LIBS += -LC:\Users\14716\Desktop\USB -lftd2xx

The most important code is below

LIBS += -LC:\Users\14716\Desktop\USB -lftd2xx

LIBS:This is the variable used in the Qt project file to list all the libraries that need to be linked

+=:This is an operator in the Qt project file used to append new values to existing variable values

-L:This parameter tells the compiler the path to search for library files when linking and Immediately following is the directory where the library files are located

-lftd2xx:This parameter specifies the name of the library to be linked. -l represents the name of the library, and ftd2xx is the abbreviation for the library. The compiler will search for the corresponding library file based on this abbreviation

The meaning of this line of code is that when compiling and linking Qt projects, it is necessary to include the ftd2xx library located in the C: \ Users \ 14716 \ Desktop \ USB directory. This approach allows the project to use the functions and resources provided by the ftd2xx library.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值