Pico tc-08 Temperature reading related Python code

Post your Python discussions here.
Post Reply
ubuntu1
Newbie
Posts: 0
Joined: Mon May 06, 2024 3:34 am

Pico tc-08 Temperature reading related Python code

Post by ubuntu1 »

hello

The code I am currently using can only read the temperature of one channel, and I want to read the temperature of eight channels. Can someone help me

from picosdk.usbtc08 import usbtc08 as tc08
# import ctypes
import numpy as np
from picosdk.functions import assert_pico2000_ok

# open unit
status = {}
status["open_unit"] = tc08.usb_tc08_open_unit()
device = status["open_unit"]
print(status)


# set mains rejection to 50 Hz
status["set_mains"] =tc08.usb_tc08_set_mains(device,50)
print(status)

# set up channel
# therocouples types and int8 equivalent
# B=66 , E=69 , J=74 , K=75 , N=78 , R=82 , S=83 , T=84 , ' '=32 , X=88
tc_chan_num=8
tc08.usb_tc08_set_channel(device, 0, 0 )
tc_type=ord('K')
status["set_channel"] = tc08.usb_tc08_set_channel(device,tc_chan_num,tc_type)
print(status)

# get minimum sampling interval in ms
status["get_minimum_interval_ms"] = tc08.usb_tc08_get_minimum_interval_ms(device)
print(status)

# collect data
temp = np.zeros( (9,), dtype=np.float32) # [cold junction, det1, det2, det3, det4, det5, det6, det7, det8]
overflow_flags = np.zeros( (1,), dtype=np.int16)
status["get_single"] = tc08.usb_tc08_get_single( device, temp.ctypes.data, overflow_flags.ctypes.data, 0)
assert_pico2000_ok(status["get_single"])
print(temp)

# stop and close unit
status["stop"] = tc08.usb_tc08_stop(device)
status["close_unit"] = tc08.usb_tc08_close_unit(device)
print(status)

ubuntu1
Newbie
Posts: 0
Joined: Mon May 06, 2024 3:34 am

Re: Pico tc-08 Temperature reading related Python code

Post by ubuntu1 »

Or if someone sees relevant posts that can be recommended, I also need them very much. I now need to read 8 temperatures. Thank you everyone

Post Reply