Jump to content
  • 0

USB-2001-TC Move Python program from Linux to Windows


John Brock

Question

3 answers to this question

Recommended Posts

  • 0

Thank you for the response. Yes, I can't get any of those examples to work on Windows for this board yet. For Linux, I'm using the uldaq package and was hoping to be able to build drivers on Windows that work with that module so there would be no rewrite on my code. I'll keep working on it.

Link to comment
Share on other sites

  • 0

No exact examples on setting the TC Type for the USB-2001-TC in python on Windows so here is what works in case it helps someone else:

from mcculw import ul
from mcculw.enums import ULRange
from mcculw.ul import ULError

board_num = 0
channel = 0
scale = 1   # for setting scale parameter to Fahrenheit
dev_num = 0
info_type = 2    #2 sets BOARDINFO
CHANTCTYPE = 347  #needed to point set_config options to change the TC type

TCType = 2   #B=7, E=4, J=1, K=2, N=8, R=5, S=6, T=3

# Set thermocouple type to type K
ul.set_config(info_type, board_num, dev_num, CHANTCTYPE, TCType)

try:
    # Get a value from the device
    value = ul.t_in(board_num,channel,scale)
    # Display the value
    print("Value = " + str(value))
except ULError as e:
    util.show_ul_error(e)

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...