Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support of other DAQmx channels #13

Open
murenrb opened this issue Apr 9, 2014 · 5 comments
Open

Support of other DAQmx channels #13

murenrb opened this issue Apr 9, 2014 · 5 comments

Comments

@murenrb
Copy link

murenrb commented Apr 9, 2014

I am using PyDAQmx to measure temperatures via thermocouples and a NI 9213 board. I am using the normal thermocouple DAQmx call: http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxcreateaithrmcplchan/

This is working great when I don't use the Task object but I am wondering if these other channel types will be supported in the Task object in the future or if I can somehow add them manually. I am fairly new to Python, so this may be easy and I just don't know how to do it.

@clade
Copy link
Owner

clade commented Apr 11, 2014

Can you send me the python code that works without Task.

Le 10/04/2014 00:27, murenrb a écrit :

I am using PyDAQmx to measure temperatures via thermocouples and a NI
9213 board. I am using the normal thermocouple DAQmx call:
http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxcreateaithrmcplchan/

This is working great when I don't use the Task object but I am
wondering if these other channel types will be supported in the Task
object in the future or if I can somehow add them manually. I am
fairly new to Python, so this may be easy and I just don't know how to
do it.


Reply to this email directly or view it on GitHub
#13.

@murenrb
Copy link
Author

murenrb commented Apr 11, 2014

Clade,
The code is attached. I am using the standard DAQmxCreateAIThrmcplChan call
as described by NI. All I had to do was comment out the Create Voltage
Channel call and input this call. Seems like it would be trivial to make
the Task object include other standard NI calls, but I don't really know.

Let me know if I can help any other way.

On Fri, Apr 11, 2014 at 4:25 AM, Pierre Cladé [email protected]:

Can you send me the python code that works without Task.

Le 10/04/2014 00:27, murenrb a écrit :

I am using PyDAQmx to measure temperatures via thermocouples and a NI
9213 board. I am using the normal thermocouple DAQmx call:

http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxcreateaithrmcplchan/

This is working great when I don't use the Task object but I am
wondering if these other channel types will be supported in the Task
object in the future or if I can somehow add them manually. I am
fairly new to Python, so this may be easy and I just don't know how to
do it.

Reply to this email directly or view it on GitHub
#13.

Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-40190096
.

Russell Muren
CO-founder
Rebound Technology LLC
303 330-2712 | email [email protected] |
websitehttp://www.REbound-tech.com|
linkedin http://www.linkedin.com/in/russellmuren

Unless otherwise noted, please consider all information in this email
confidential

@clade
Copy link
Owner

clade commented Apr 14, 2014

I don't see any file attached to your message.

Pierre

Le 11/04/2014 14:22, murenrb a écrit :

Clade,
The code is attached. I am using the standard DAQmxCreateAIThrmcplChan
call
as described by NI. All I had to do was comment out the Create Voltage
Channel call and input this call. Seems like it would be trivial to make
the Task object include other standard NI calls, but I don't really know.

Let me know if I can help any other way.

On Fri, Apr 11, 2014 at 4:25 AM, Pierre Cladé
[email protected]:

Can you send me the python code that works without Task.

Le 10/04/2014 00:27, murenrb a écrit :

I am using PyDAQmx to measure temperatures via thermocouples and a NI
9213 board. I am using the normal thermocouple DAQmx call:

http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxcreateaithrmcplchan/

This is working great when I don't use the Task object but I am
wondering if these other channel types will be supported in the Task
object in the future or if I can somehow add them manually. I am
fairly new to Python, so this may be easy and I just don't know
how to
do it.

Reply to this email directly or view it on GitHub
#13.

Reply to this email directly or view it on
GitHubhttps://github.com//issues/13#issuecomment-40190096
.

Russell Muren
CO-founder
Rebound Technology LLC
303 330-2712 | email [email protected] |
websitehttp://www.REbound-tech.com|
linkedin http://www.linkedin.com/in/russellmuren

Unless otherwise noted, please consider all information in this email
confidential


Reply to this email directly or view it on GitHub
#13 (comment).

@murenrb
Copy link
Author

murenrb commented Apr 14, 2014

Clade,
How odd, it was attached and I can still see that it was attached on this
email chain. There must be an issue with the mail clients somewhere along
the way. I have attached it again to this message and also pasted the code
below:

'''

Created on Apr 7, 2014

@author: russellmuren

'''

from PyDAQmx import *

import numpy

Declaration of variable passed by reference

taskHandle = TaskHandle()

read = int32()

data = numpy.zeros((1000,), dtype=numpy.float64)

try:

# DAQmx Configure Code

DAQmxCreateTask("",byref(taskHandle))

DAQmxCreateAIThrmcplChan(taskHandle,"cDAQ1mod1/ai0","",-100.0,100.0

,DAQmx_Val_DegC,DAQmx_Val_K_Type_TC,DAQmx_Val_BuiltIn,25.0,"")

#

DAQmxCreateAIVoltageChan(taskHandle,"cDAQ1Mod1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,None)

DAQmxCfgSampClkTiming(taskHandle,"",10000.0

,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000)

# DAQmx Start Code

DAQmxStartTask(taskHandle)


# DAQmx Read Code

DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,

1000,byref(read),None)

print "Acquired %d points"%read.value

print data[-1]

except DAQError as err:

print "DAQmx Error: %s"%err

finally:

if taskHandle:

    # DAQmx Stop Code

    DAQmxStopTask(taskHandle)

    DAQmxClearTask(taskHandle)

On Mon, Apr 14, 2014 at 1:07 AM, Pierre Cladé [email protected]:

I don't see any file attached to your message.

Pierre

Le 11/04/2014 14:22, murenrb a écrit :

Clade,
The code is attached. I am using the standard DAQmxCreateAIThrmcplChan
call
as described by NI. All I had to do was comment out the Create Voltage
Channel call and input this call. Seems like it would be trivial to make
the Task object include other standard NI calls, but I don't really know.

Let me know if I can help any other way.

On Fri, Apr 11, 2014 at 4:25 AM, Pierre Cladé
[email protected]:

Can you send me the python code that works without Task.

Le 10/04/2014 00:27, murenrb a écrit :

I am using PyDAQmx to measure temperatures via thermocouples and a NI
9213 board. I am using the normal thermocouple DAQmx call:

http://zone.ni.com/reference/en-XX/help/370471W-01/daqmxcfunc/daqmxcreateaithrmcplchan/

This is working great when I don't use the Task object but I am
wondering if these other channel types will be supported in the Task
object in the future or if I can somehow add them manually. I am
fairly new to Python, so this may be easy and I just don't know
how to
do it.

Reply to this email directly or view it on GitHub
#13.

Reply to this email directly or view it on
GitHubhttps://github.com//issues/13#issuecomment-40190096

.

Russell Muren
CO-founder
Rebound Technology LLC
303 330-2712 | email [email protected] |
websitehttp://www.REbound-tech.com|
linkedin http://www.linkedin.com/in/russellmuren

Unless otherwise noted, please consider all information in this email
confidential

Reply to this email directly or view it on GitHub
#13 (comment).

Reply to this email directly or view it on GitHubhttps://github.com//issues/13#issuecomment-40338240
.

Russell Muren
CO-founder
Rebound Technology LLC
303 330-2712 | email [email protected] |
websitehttp://www.REbound-tech.com|
linkedin http://www.linkedin.com/in/russellmuren

Unless otherwise noted, please consider all information in this email
confidential

@clade
Copy link
Owner

clade commented Apr 14, 2014

In order to use Task object, the following code should work. If it
doesn't, please send me the error you get (preferably using ipython).
Don't use the try .. except, so I can see where the error occurs.

Pierre

from PyDAQmx import *
import numpy

Declaration of variable passed by reference

read = int32()
data = numpy.zeros((1000,), dtype=numpy.float64)

task = Task()
task.CreateAIThrmcplChan("cDAQ1mod1/ai0","",-100.0,100.0,DAQmx_Val_DegC,DAQmx_Val_K_Type_TC,DAQmx_Val_BuiltIn,25.0,"")
task.CfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000)

DAQmx Start Code

task.StartTask(taskHandle)

DAQmx Read Code

task.ReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,byref(read),None)

print "Acquired %d points"%read.value

Le 14/04/2014 17:56, murenrb a écrit :

from PyDAQmx import *

import numpy

Declaration of variable passed by reference

taskHandle = TaskHandle()

read = int32()

data = numpy.zeros((1000,), dtype=numpy.float64)

try:

DAQmx Configure Code

DAQmxCreateTask("",byref(taskHandle))

DAQmxCreateAIThrmcplChan(taskHandle,"cDAQ1mod1/ai0","",-100.0,100.0
,DAQmx_Val_DegC,DAQmx_Val_K_Type_TC,DAQmx_Val_BuiltIn,25.0,"")

DAQmxCreateAIVoltageChan(taskHandle,"cDAQ1Mod1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,None)

DAQmxCfgSampClkTiming(taskHandle,"",10000.0
,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000)

DAQmx Start Code

DAQmxStartTask(taskHandle)

DAQmx Read Code

DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,
1000,byref(read),None)

print "Acquired %d points"%read.value

print data[-1]

except DAQError as err:

print "DAQmx Error: %s"%err

finally:

if taskHandle:

DAQmx Stop Code

DAQmxStopTask(taskHandle)

DAQmxClearTask(taskHandle)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants