Click here to Skip to main content
15,034,432 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In Linux, it seems very easy to access GPIO pins using ways like accessing /dev/gpio* files or using inb()/outb() to access GPIO pins. Is there any such easy way to access GPIO pins at Windows in applications, not driver level?
Posted
Updated 7-Aug-14 17:41pm
v3
Comments
Stan Huang 8-Aug-14 4:37am
   
My coworker showed me that he can control a device connecting to GPIO pin by a Microsoft-provided DOS program, 'debug'. Just simple instructions can fit my requirement:
i <gpio address="">
o <gpio address=""> <value>

But my problem is that I can't do such simple things in my Windows application program. Can I execute 'debug' to do what I want?

1 solution

   
v2
Comments
CPallini 8-Aug-14 3:06am
   
5. Interesting. It is a shame it all starts just with Windows 8.
   
Totally agree. I'm sure it's possible on earlier versions of Windows, but probably without using standard introduced with v.8; if so, still a shame.

Thank you, Carlo.

—SA

P.S.: To me, the whole concept of Windows 8 is one of the biggest mistakes of Microsoft, despite of some good ideas (not, those colored rectangles is not one of those ideas :-).
Stan Huang 8-Aug-14 4:16am
   
I found it but didn't follow it because firstly, my OSes are Windows 7 and its previous one. Besides, after glimpsing it, I found words "Hardware vendors supply drivers to control their GPIO controllers.". So, as an application programmer, I should try to get the driver from H/W vendors, instead of developing a driver by myself. It's a strange area for me.
I still feel strange why there is no such simple way as inb() / outb() in Linux to do GPIO access at Windows.
Any way, I appreciate your information very much. Thanks.
   
I perfectly understand your concerns. Well, this work is certainly not for an application developer, it's DDK.

Perhaps you should better understand in what world we live. It looks like all the hardware manufacturers (especially those in "industrial-grade", "professional" hardware) completely lost the ability to write proper drivers. Even on Linux. It happened pretty much when the CPU protection mode and protection rings have been put in use by the OS. I work in hardware control and DAQ business for a long time and haven't seen proper use of hardware interrupts, for example. Only drivers for commodity devices (keyboards, mice, pads, joysticks) do it properly.

A while ago I saw some "generic" kernel-mode drivers. Wonderful idea which I would like very much. You would configure the kernel-mode driver and choose some select CPU I/O ports and perhaps and IRQ line to control, and then you can write an application-ring module which can bind the driver with some particular hardware. I don't know them now; maybe someone else will advise you some; or you will find something.

We are certainly deprived of proper drivers these days... I wish I could help you more...

—SA
Stan Huang 8-Aug-14 5:24am
   
Actually, the GPIO I'd like to access connects to CashDrawer. So, what I need to do to it is just reading it to know if the drawer is close or open and send 0 or 1 to open or close it. That's the reason why I've been find a simple ways of a few lines of statements, instead of a very formal KMDF driver.
Thanks for so informative response.
   
I perfectly understand. Nevertheless...
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900