Commissioning
Programming digital channels (DXP)
62
Hans Turck GmbH & Co. KG | T +49 208 4952-0 | F +49 208 4952-264 | [email protected] | www.turck.com
7.6.3
Programming DXP channels with Python 3
NOTE
The speed of the data transmission depends on the configured block size and the
set transfer rate. The speed may possibly not be enough for time critical
applications. To achieve faster data processing, the process can be set as a real-time
process.
The following example shows the programming of the digital I/O channels with Python 3.
import sys
#GPIOs-> OUT: IN:
ports = ["88","59"]
# write GPIO:
try:
# set direction to write DXP
fo = open("/sys/class/gpio/gpio" + ports[0] +"/direction", "w")
fo.write("out")
fo.close()
# write GPIO:
f = open("/sys/class/gpio/gpio" + ports[0] +"/value", "w")
f.write("1")
f.close()
except:
# export gpio if not done as yet
f1 = open("/sys/class/gpio/export", "w")
f1.write(ports[0]) f1.close()
# set direction to write DXP
fo = open("/sys/class/gpio/gpio" + ports[0] +"/direction", "w")
fo.write("out")
fo.close()
# write GPIO:
fw = open("/sys/class/gpio/gpio" + ports[0] +"/value", "w")
fw.write("1")
fw.close()
Summary of Contents for 100000897
Page 1: ...Your Global Automation Partner Instructions for Use TN UHF LNX UHF Reader...
Page 2: ...2 Hans Turck GmbH Co KG T 49 208 4952 0 F 49 208 4952 264 more turck com www turck com...
Page 69: ...V02 00 2021 05 69 fclose fh else printf failed on writing n return 1...
Page 75: ...V02 00 2021 05 75 else printf failed on writing n return 1 return EXIT_SUCCESS...
Page 93: ...V02 00 2021 05 93 Select RS485 RFID and confirm with OK Fig 67 Selecting the RS485 interface...
Page 97: ...V02 00 2021 05 97 Click the Select BL File button Fig 73 Button selecting a BL file...