Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved How to access IO port in QT?

    General and Desktop
    io access port memory access
    4
    11
    2003
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HaCoMaTaTa
      HaCoMaTaTa last edited by

      Hello everyone
      does anyone know how to access I/O port in QT?
      ex: RTC CMOS have IO port 0x70,0x71
      serial port have IO 0x3F8,0x2F8....
      we have some device that need to access by this operation
      is there any function or lib could access I/O directly?

      aha_1980 1 Reply Last reply Reply Quote 0
      • aha_1980
        aha_1980 Lifetime Qt Champion @HaCoMaTaTa last edited by

        Hi @HaCoMaTaTa,

        about which platform and operating system are you talking?

        Direct port access was done in MS-DOS times. All modern operating systems provides and API for that.

        To access serial ports you can use QSerialPort.

        Regards

        Qt has to stay free or it will die.

        HaCoMaTaTa 1 Reply Last reply Reply Quote 2
        • HaCoMaTaTa
          HaCoMaTaTa @aha_1980 last edited by

          Hi @aha_1980
          hi
          thanks for your reply
          i use QT in windows platform,
          i need direct port access in QT to control my hardware device,
          is there any direct port access method tutorial?
          or it need include extra library such as winio to done that?

          1 Reply Last reply Reply Quote 0
          • aha_1980
            aha_1980 Lifetime Qt Champion last edited by

            Hi @HaCoMaTaTa,

            There is no direct port access possible in all Windows NT related versions (Windows NT, XP, Vista, 7, 8, 10).

            It was possible in the MS-DOS based Windows versions (3.1, 95, 98, ME). You can google for that.

            Regards

            Qt has to stay free or it will die.

            HaCoMaTaTa A 2 Replies Last reply Reply Quote 3
            • HaCoMaTaTa
              HaCoMaTaTa @aha_1980 last edited by

              hi @aha_1980

              if it don't have direct method to access, is there any indirect port access method on QT?
              or we only could use 3 party library such as WINIO library

              1 Reply Last reply Reply Quote 0
              • aha_1980
                aha_1980 Lifetime Qt Champion last edited by

                Hi @HaCoMaTaTa,

                there is no integrated support for accessing hardware ports in Qt. You will need external libraries (with appropriate Kernel driver).

                You didn't say what you want to do with the RS-232 ports. QSerialPort also provides functions to set some of the control pins. Maybe that's already enough for you.

                Regards

                Qt has to stay free or it will die.

                HaCoMaTaTa 1 Reply Last reply Reply Quote 0
                • HaCoMaTaTa
                  HaCoMaTaTa @aha_1980 last edited by

                  Hi @aha_1980

                  thanks for your reply
                  Serial port is not my purpose, i want create an UI interface to access hardware register , so it need to access many type of device such as SuperIO (use io port 0x2e 0x2f...), DIO through smbus (io port 0xf040..), or Embeded Controller (EC), even my custom io information in memory IO,

                  1 Reply Last reply Reply Quote 0
                  • A
                    aowoo @aha_1980 last edited by

                    @aha_1980 u can read/write byte to I/O port using winio.lib in windows XP,7.
                    using inpout32.lib in windows 10 both x86 and x64. For linux, u need to using the mmap function for mapping I/O address before read/write.
                    However qt can not provide a class for that.
                    I think this function is important for automation.

                    aha_1980 1 Reply Last reply Reply Quote 0
                    • aha_1980
                      aha_1980 Lifetime Qt Champion @aowoo last edited by aha_1980

                      Hi @aowoo,

                      I think this function is important for automation.

                      I don't think so. Nowadays, (hardware) serial and parallel ports are uncommon in the PC world. You can use USB interface boards like Bus Pirate as alternative.

                      For industrial use, ruggedized, but more expensive interfaces - often optical isolated - are available.

                      Regards

                      Qt has to stay free or it will die.

                      A 1 Reply Last reply Reply Quote 3
                      • A
                        aowoo @aha_1980 last edited by

                        @aha_1980 I am agree with that parallel port is uncommon now, however the serial port is still widely used in the my industry (semiconductor) for different sensors.
                        The most Important is that most industries board (ISA PCI...) usually provide only one driver for one or two old OS(windowXP,7).
                        So if we want to update or changed the OS without a driver, We have to build a new lib which based on directly read and write to the I/O port.

                        1 Reply Last reply Reply Quote 0
                        • K
                          kuzulis Qt Champions 2020 last edited by kuzulis

                          @aowoo said in How to access IO port in QT?:

                          directly read and write to the I/O port

                          AFAIK, It's impossible for Windows && Linux:

                          • On Windows you need in a special driver (It is not enough to use just some DLL's, because you need in a driver. Most likelly, that inpout32.dll has a pre-compiled driver in own resources and loads this driver in runtime).

                          • On Linux you need in a special permissions too.

                          1 Reply Last reply Reply Quote 2
                          • First post
                            Last post