TC Sample
More...
Go to the source code of this file.
TC Sample
- Copyright
- 2019 Moxa Inc. All rights reserved.
- Date
- 2019-02-11
- Author
- William Chang
- Version
- V1.0
2 Copyright (C) 2019 Moxa Inc. All rights reserved. 3 SPDX-License-Identifier: Apache-2.0 5 TC Python Sample Application 8 2019-02-11 William Chang Created it. 20 from ioThinx_4530
import ioThinx_4530_API
27 parser = argparse.ArgumentParser(description=
"TC sample program.")
28 parser.add_argument(
"-s",
"--slot", dest=
"tc_slot", type=int, default=7)
29 parser.add_argument(
"-c",
"--channel_start", dest=
"tc_channel_start", type=int, default=0)
30 parser.add_argument(
"-n",
"--channel_count", dest=
"tc_channel_count", type=int, default=2)
31 args = parser.parse_args()
33 tc_slot = args.tc_slot
34 tc_channel_start = args.tc_channel_start
35 tc_channel_count = args.tc_channel_count
36 print(
"TC slot = {}".format(tc_slot))
37 print(
"TC start channel = {}".format(tc_channel_start))
38 print(
"TC channel count = {}".format(tc_channel_count))
41 device = ioThinx_4530_API.ioThinx_4530_API()
44 tc_types = [TC_SENSOR_TYPE_K] * tc_channel_count
45 device.ioThinx_TC_Config_SetSensorTypes(tc_slot, tc_channel_start, tc_channel_count, tc_types)
48 device.ioThinx_IO_Config_Reload()
52 tc_values = device.ioThinx_TC_GetValues(tc_slot, tc_channel_start, tc_channel_count)
53 tc_statuss = device.ioThinx_TC_GetStatuss(tc_slot, tc_channel_start, tc_channel_count)
54 for i
in range(tc_channel_count):
55 print(
"[ {}:{}] value = {}, status = {}".format(tc_slot, tc_channel_start + i, tc_values[i], tc_statuss[i]))
56 if input(
"Press 'q' to exit. other keys to continue") ==
'q':
60 if __name__ ==
'__main__':
Definition in file tc.py.