Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to access IO port in QT?
QtWS25 Last Chance

How to access IO port in QT?

Scheduled Pinned Locked Moved Unsolved General and Desktop
io accessportmemoryaccess
11 Posts 4 Posters 3.1k Views
  • 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.
  • H HaCoMaTaTa
    9 Jul 2018, 05:26

    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?

    A Offline
    A Offline
    aha_1980
    Lifetime Qt Champion
    wrote on 9 Jul 2018, 05:30 last edited by
    #2

    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.

    H 1 Reply Last reply 9 Jul 2018, 05:41
    2
    • A aha_1980
      9 Jul 2018, 05:30

      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

      H Offline
      H Offline
      HaCoMaTaTa
      wrote on 9 Jul 2018, 05:41 last edited by
      #3

      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
      0
      • A Offline
        A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on 9 Jul 2018, 06:09 last edited by
        #4

        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.

        H A 2 Replies Last reply 9 Jul 2018, 06:39
        3
        • A aha_1980
          9 Jul 2018, 06:09

          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

          H Offline
          H Offline
          HaCoMaTaTa
          wrote on 9 Jul 2018, 06:39 last edited by
          #5

          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
          0
          • A Offline
            A Offline
            aha_1980
            Lifetime Qt Champion
            wrote on 9 Jul 2018, 11:39 last edited by
            #6

            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.

            H 1 Reply Last reply 9 Jul 2018, 12:07
            0
            • A aha_1980
              9 Jul 2018, 11:39

              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

              H Offline
              H Offline
              HaCoMaTaTa
              wrote on 9 Jul 2018, 12:07 last edited by
              #7

              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
              0
              • A aha_1980
                9 Jul 2018, 06:09

                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

                A Offline
                A Offline
                aowoo
                wrote on 29 Aug 2020, 08:12 last edited by
                #8

                @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.

                A 1 Reply Last reply 29 Aug 2020, 10:37
                0
                • A aowoo
                  29 Aug 2020, 08:12

                  @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.

                  A Offline
                  A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on 29 Aug 2020, 10:37 last edited by aha_1980
                  #9

                  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 29 Aug 2020, 12:26
                  3
                  • A aha_1980
                    29 Aug 2020, 10:37

                    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

                    A Offline
                    A Offline
                    aowoo
                    wrote on 29 Aug 2020, 12:26 last edited by
                    #10

                    @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
                    0
                    • K Offline
                      K Offline
                      kuzulis
                      Qt Champions 2020
                      wrote on 29 Aug 2020, 13:38 last edited by kuzulis
                      #11

                      @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
                      2

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved