V01.00 | 2019/04
55
7.5.5
Programming DXP channels with C or C++
The following example shows the programming of the digital I/O channels with Ansi C/C++.
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
// initialize function (use extern for C++)
int access(const char *pfad, int modus);
int main(void) {
//choose DXP / GPIO for connection
char input[2];
/*
==============================================================
==============
READ:
==================================================================
==========*/
{
// file doesn't exist!
// export gpio...
if((fh = fopen("/sys/class/gpio/export", "w")) !=
{
fputs("59",fh);
fclose(fh);
}
else
{
printf("failed on export to read...\n");
printf("result: %i \n", (int)fh);
return -1;
}
}
// set direction to read...
if((fh =fopen("/sys/class/gpio/gpio59/direction", "w")) !=
{
fputs("in",fh);
fclose(fh);
}
else
{
printf("failed on setting direction to read...\n");
return -1;
}
// set active low to read...
{
fputs("1",fh);
Summary of Contents for TN-UHF LNX Series
Page 1: ...Your Global Automation Partner Instructions for Use TN UHF LNX UHF Read Write Head ...
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 75: ...V01 00 2019 04 75 Select RS485 RFID and confirm with OK Fig 62 Selecting the RS485 interface ...