-
Notifications
You must be signed in to change notification settings - Fork 10
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
Updating plugins using nidaqmx and not PyDAQmx #6
Comments
concerning the timing, you can use a timer: |
Thanks, threading.Timer seems indeed to be exactly what I want. However, I don't understand where I can find the count_value returned by the function I used: def read(): From this code I have no output. There is probably something I miss. |
Well for sure your async function won't return directly the counts, but the timer callback (self._ready) will be the one reading the counts and you can notify the user using two methods: polling the self.ready boolean or asking it to provide a method signature (callback) to notify a external program (for instance a pymodaq plugin).
If you want a blocking function, then just write what you did before maybe inserting a sleep time in the while loop |
hello @jerlfan |
Hi guys,
I am actually working on the update of the plugin to replace PyDAQmx by nidaqmx (from NI).
The current state of the work can be find on my fork : https://github.com/jerlfan/pymodaq_plugins_daqmx
I created daqmx-ni wrapper using nidaqmx (in hardware) to replace daqmx that uses PyDAQmx
If you can have a look on what I have done at this stage, I would be grateful. It is not fuly tested I have to implement the reading methods (see below)
To finish the work I am actually facing one problem:
reading procedure is much simpler with nidaqmx (no needs to use ctype, or byref...): i.e. task.read(Nsamples, Readout time) and it is independant from the channel type. The time is defined elsewhere (task.timing).
I will start by implementing the counter channels and I would your advices.
There is two ways to use it:
1- we feed a clock to the counter. Usually you use another counter channel for that (Aurore's way). It is really good for short time but you loose a counter channel :-( (at least on the NI board we have in the Lab, I have a USB6341).
2- You can simply use a "machine clock". This is where I may need help. I propose the following solution:
init=time.perf_counter()
task.start()
while time.perf_counter()-init <=Acquisition_time:
pass
counts=task.read()
print(counts)
task.stop()
What do you think? I think it is not really elegant. So sugestions are welcomed!
I will then create a daq_viewer_0D counter-fast and counter-slow.
Cheers
The text was updated successfully, but these errors were encountered: