Jump to content
  • 0

MCC134 - Example code raises HatError: Invalid Board Type


Leo Wolscht

Question

Hi

I am connecting my MCC134 to a Raspberry and started by running your example code from github. All I did was exchange the mcc118 to mcc134 and added a printout line for the board_list.

the hat_list finds my MCC134 but the initialization of the mcc134 object at address 0 raises an HatError: Addr 0: Invalid board type.

What am I missing?

Quote

import sys

from daqhats import hat_list, HatIDs, mcc134

 

# get hat list of MCC daqhat boards

board_list = hat_list(filter_by_id = HatIDs.ANY)

if not board_list:

print("No boards found")

sys.exit()

print(board_list)

 

# Read and display every channel

for entry in board_list:

if entry.id == HatIDs.MCC_134:

print("Board {}: MCC 134".format(entry.address))

board = mcc134(entry.address)

for channel in range(board.info().NUM_AI_CHANNELS):

value = board.a_in_read(channel)

print("Ch {0}: {1:.3f}".format(channel, value))

Quote

[HatInfo(address=0, id=323, version=1, product_name='MCC 134 Thermocouple Input HAT')]
Board 0: MCC 134
Traceback (most recent call last):
  File "/home/cross-ing/Zehnder/Code/daqhat_test.py", line 21, in <module>
    board = mcc134(entry.address)
  File "/usr/local/lib/python3.9/dist-packages/daqhats/mcc134.py", line 119, in __init__
    raise HatError(self._address, "Invalid board type.")
daqhats.hats.HatError: Addr 0: Invalid board type.

 

Edited by Leo Wolscht
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

Hello,

If you started with the MCC 118 Single Value Read and modified it for the MCC 134 and are getting an error obtaining the board object, it could be that you didn't add mcc134 to the import statement. Please have a look at the MCC 134 Single Value Read example to see how to read a temperature channel. 

The following link will take you to the MCC 134 documentation: https://mccdaq.github.io/daqhats/python.html#mcc-134-class

Best regards,

John

Link to comment
Share on other sites

  • 0

Hey John

Thanks for the quick response. I am quite confident that I included mcc134 in the import statement as you can see in the first quote in my question. I simply exchanged mcc118 with mcc134 in the "from daqhats import ..." line.

I also tried the examples for mcc134 on https://github.com/mccdaq/daqhats/tree/master/examples/python/mcc134 with the same error message.

Next step is to try call sudo "daqhats_read_eeproms" and "daqhats_list_boards" to reassign the addresses.

If you have any other idea, please let me know.

Cheers,

Leo

Link to comment
Share on other sites

  • 0

Hey Leo,

That's a good idea, run the DAQ Hat Manger and update the eeproms and then have it list the boards. It also allows you to test the inputs. The DAQ Hat manager can be found on the Accessories GUI menu.

Best regards,

John

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...