Siemens SIMATIC IOT Operating Instructions Manual page 83

Hide thumbs Also See for SIMATIC IOT:
Table of Contents

Advertisement

the offset must be set to 0 before the next read */
SIMATIC IOT2050
Operating Instructions, 03/2024, A5E39456816-AF
return 0;
}
ssize_t ret = 0;
for (int i = 0; i < 3; i++) {
int dq_value = i & 0x01;
/* Convert dq value to string */
snprintf(tmp, TMP_SIZE, "%d", dq_value);
/* Output value in string format to dq0 */
ret = write(dq0, tmp, strlen(tmp));
if (ret < 0) {
printf("Write failed, %d\r\n", ret);
break;
}
printf("Set dq0 to %s\r\n", dq_value);
/* Note that when reading a file node multiple times,
lseek(di0, 0, SEEK_SET);
memset(tmp, 0, TMP_SIZE);
/* Read value from di0 */
ret = read(di0, tmp, TMP_SIZE);
if (ret < 0) {
printf("Read di0 value failed, %d\r\n", ret);
break;
}
printf("Get di0 value: %s\r\n", tmp);
/* Convert di0 string value to integer */
int di_value = strtol(tmp, NULL, 10);
if (di_value != dq_value) {
Maintaining and repairing the device
6.6 Configure IOT2050 SM
83

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic iot2050Simatic iot2050 smSimatic iot2050 m.2

Table of Contents