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.