Jump to content
  • 0

Unable to read single-ended analog input - Python and mcculw


Marc-Antoine

Question

Good day,

I tried all the examples available for analog inputs and the results are far from the expected values received from DAQami. It seems that all the examples are set-up for differential measurement and I couldn't find a way to set the configuation to single-ended. Example "usb_2408_2416.py" shows these functions: 

# Set channel type to voltage

    ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADCHANTYPE,  AiChanType.VOLTAGE)

# Set to differential input mode

    ul.a_chan_input_mode(board_num, channel, AnalogInputMode.SINGLE_ENDED)

# Set data rate to 1000Hz

    ul.set_config(InfoType.BOARDINFO, board_num, channel, BoardInfo.ADDATARATE, 1000)

Unfortunately, all the functions return the following error: "Error 41: This function can not be used with this board"

 

Thanks for the support,

image.png.af0bc4120bcfb81fe39e4d36b333cd93.png

image.thumb.png.94abbb78f027f1c62006784ff9455ff2.png

image.png.3752bb71bd2ec96daaeb2e6006f40f3c.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @Marc-Antoine.

The MCC UL Help contains the supported functions of each MCC device.

https://www.mccdaq.com/pdfs/manuals/Mcculw_WebHelp/ULStart.htm

In the 'usb_2408_2416.py' example you referenced, the a_chan_input_mode() function sets the analog input mode for a specified A/D channel.  The USB-2408 and USB-2416 support this function, but the USB-1608G does not.  Instead, use a_input_mode().  

a_input_mode(board_num, AnalogInputMode.SINGLE_ENDED)

 

image.png

 

image.png

 

The MCC Universal Library Python API for Windows (mcculw) examples are located in the 'C:\Users\Public\Documents\Measurement Computing\DAQ\Python\examples' directory and up on GitHub (https://github.com/mccdaq/mcculw/tree/master/examples).

I modified the existing 'a_in_scan_background.py' example to configure the analog input mode to 'SINGLE_ENDED'; see attachment.  I added '# ********* added this line' for each change.

image.png

 

Regards,

Fausto

a_in_scan_background_v1.py

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