Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
Panel | ||||
---|---|---|---|---|
| ||||
How can I access the digital I/Os on the "netFIELD Compact X8MC Next" device? |
Panel | ||||
---|---|---|---|---|
| ||||
General informationThe device "netFIELD Compact X8MC Next" supports four 24-volt compatible digital inputs and four digital outputs. The GPIO sysfs interface for userspace access to the 4DI/4DO (symbolically "ied_di4_o4") is configured in the device tree bindings to be exposed under "/var/platform/". The following GPIOs are exposed under "/var/platform/" (use "ls /var/platform/" to just list the subfolders) DIs: ied-di4o4_i0 DOs: ied-di4o4_o0 Read/Write accessStandard file access functions are used to access the sysfs interface. Example in C using stdio functionsThe fopen() function binds a named GPIO to an access stream. fp = fopen("/var/platform/ied-di4o4_i0", "rb") Write access: fp = fopen("/var/platform/ied-di4o4_d0", "wb") The fread() function reads the current state of a DI signal char buffer[32]; The fwrite() function writes the state "1" to a DO signal byteswrite = fwrite("1", sizeof("1"), fp); Example as command lineWriting the state "1" = on to a DO signal echo 1 | >sudo tee /var/platform/ied-di4o4_o2 Reading and outputting the current state of a DI signal cat /var/platform/ied-di4o4_i1 |
Panel | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||
|