- Main
- Tutorials
- Library
- Samples

- Namespace List
- Namespace Members

Functions | Variables
rtd Namespace Reference

## Functions
def | main ()

## Variables
int | RTD_SENSOR_TYPE_PT100 = 1

## Detailed Description

    Copyright (C) 2019 Moxa Inc. All rights reserved.
    SPDX-License-Identifier: Apache-2.0

    RTD Python Sample Application

    Date          Author            Comment
    2019-02-11    William Chang     Created it.

## Function Documentation

def rtd.main | ( |  | ) |

Definition at line 26 of file rtd.py.

26 def main():
27 parser = argparse.ArgumentParser(description="RTD sample program.")
28 parser.add_argument("-s", "--slot", dest="rtd_slot", type=int, default=8)
29 parser.add_argument("-c", "--channel_start", dest="rtd_channel_start", type=int, default=0)
30 parser.add_argument("-n", "--channel_count", dest="rtd_channel_count", type=int, default=2)
31 args = parser.parse_args()
32
33 rtd_slot = args.rtd_slot
34 rtd_channel_start = args.rtd_channel_start
35 rtd_channel_count = args.rtd_channel_count
36 print("RTD slot = {}".format(rtd_slot))
37 print("RTD start channel = {}".format(rtd_channel_start))
38 print("RTD channel count = {}".format(rtd_channel_count))
39
40 # initialize ioThinx I/O
41 device = ioThinx_4530_API.ioThinx_4530_API()
42
43 # temporarily set config
44 rtd_types = [RTD_SENSOR_TYPE_PT100] * rtd_channel_count
45
46 device.ioThinx_RTD_Config_SetSensorTypes(rtd_slot, rtd_channel_start, rtd_channel_count, rtd_types)
47
48 # reload config
49 device.ioThinx_IO_Config_Reload()
50
51 # get value
52 while True:
53 rtd_values = device.ioThinx_RTD_GetValues(rtd_slot, rtd_channel_start, rtd_channel_count)
54 rtd_statuss = device.ioThinx_RTD_GetStatuss(rtd_slot, rtd_channel_start, rtd_channel_count)
55 for i in range(rtd_channel_count):
56 print("[ {}:{}] value = {}, status = {}".format(rtd_slot, rtd_channel_start + i, rtd_values[i], rtd_statuss[i]))
57 if input("Press 'q' to exit. other keys to continue") == 'q':
58 break
59
60
rtd.main
def main()
Definition: rtd.py:26
format
char const int const cJSON_bool format
Definition: cJSON.h:161

## Variable Documentation

int RTD_SENSOR_TYPE_PT100 = 1

Definition at line 23 of file rtd.py.