02-07-2017 02:05 AM
Hello everybody,
I had such a topic already but I think I didn't explane it good enough. I use the PCI 6343 with an A/O card.
I have a program that has generates some signals for a motor. The motor itself has some sensor for example for the temperature. So my plan is to connect these sensors to some digital inputs. I know that the PCI 6343 has seperate electrical connections for such temperature sensors that I could use but later there are not only those temperature sensors so I try to explane the problem more general.
So my problem hast to do something with the electrical connections (digital inputs). I need more than one electrical connection for the change detection. One electrical connection for each sensor. I have figured out how I can write the lines so that it works but it is not that what I want.
// Settings for the change detection
DAQmxErrChk(DAQmxCreateTask("",&DigitalTaskHandle));
DAQmxErrChk(DAQmxCreateDIChan(DigitalTaskHandle, DIChannel_digitalMode, "", DAQmx_Val_ChanPerLine));
DAQmxErrChk(DAQmxCfgChangeDetectionTiming(DigitalTaskHandle, DIChannel_digitalMode, DIChannelSensor1_digitalMode, DAQmx_Val_ContSamps, 1));
DAQmxErrChk(DAQmxRegisterSignalEvent(DigitalTaskHandle, DAQmx_Val_ChangeDetectionEvent, 0, ChangeDetectionStopCallback, NULL));
With the code above I do the initialization for the digital electrical connections: DIChannel_digitalMode[]="Dev1/port0/line28:31";
DIChannelSensor1_digitalMode[]="Dev1/port0/line28";
When one of the connections has a change I always read the values of each connection (28,29,30 and 31) in the change detection. So I get an array where I can see which connections changed and then I do the segmentation. So this works fine. When I have a change on the electrical digital inputs connections (28,29,30,31) from 0 to 1 the change detection callback gets activated. When I have a jump from 1 to 0 on the connections 28 the change detection callback gets also activated.
So that was the explanation. How the code works now. My problem is now that the whole project needs a lot of digital I/O. At the moment I have a limited amout of them. In the code above I have use the electrical connections 28,29,30 and 31. But in the reality I can not use these connections. I can only use 22,25,28 and 30. Now I tried to create a change detection like above for each of the connections but that didn't work. There was always a failure that the resouce is already reserved.
So in summary I would like to know if it is possible to initialize not only a line for the change detection. If yes how can I do that?
Is it possible to set the settings so that I can decide which connection should react by 0 to 1 or by 1 to 0.
For me it is at the moment only possible to use whole lines but I can not adress a single connection.
I do not now if it is possible or I if found already the right way and the only thing I must do, is to organize my connections better so that all the change detection connections are in one line. Then all my connections that should react from 0 to 1 in one line and all the connections that should react by 1-0 in one line. One thing I know is that I must read the values in my digital input and can do the segmentation.
I hope I wrote everything understandable and hope someone can help me. 🙂
Best regards
Solved! Go to Solution.
02-08-2017 03:20 AM - edited 02-08-2017 03:25 AM
Hello Fasching_K,
interresting links
Digital Change Detection in NI-DAQmx
What Is Change Detection and How Does It Work On The 653x DIO Boards?
Using Change Detection with the 6527 in CVI
In CVI is also an example ReadDigChan-ChangeDetection-DigFilter.
You have to create one task for all and in the DAQmxCfgChangeDetectionTiming function you can select the lines for the falling and rising edges to filter it.
02-08-2017 08:30 AM
Hello and thank you for the informations. I will read through them. On thing I would like to ask now is the thing with the filtering of the rising edge and the falling edge. My problem is that there are only one parameter for the rising edge and one for the falling edge. Is it correct that I can only select lines for those parameter if I want to have more connections with different filter options.
As example:
I would like to have on the connections 1,3,5 the rising edge filtering and on the connections 2 and 4 the falling edge filtering. Now for those to parameter I cannot select only specific connections. So I must look for example that the rising edge connections build a line and the falling edge connections. Is that correct?
Best regards
02-08-2017 09:04 AM
Hello Fasching_K,
i am using LabVIEW, but the setting should ook like
Used Lines
6343/port0/line1:5
Rising Edge Lines
6343/port0/line1, 6343/port0/line2, 6343/port0/line5
Falling Edge Line
6343/port0/line2, 6343/port0/line4
02-08-2017 02:12 PM - edited 02-08-2017 02:18 PM
Hello,
hm yes I understand that. But how can I use that with the command:
DAQmxCfgChangeDetectionTiming(DigitalTaskHandle, DIChannel_digitalMode, DIChannelSensor1_digitalMode, DAQmx_Val_ContSamps, 1);
DIChannel_digitalMode is the rising egde and DIChannelSensor1_digitalMode is the falling edge.
For the sample we spoke about would be the rising egde DIChannel_digitalMode=Dev1/port0/line1:3 and the falling edge DIChannelSensor1_digitalMode=Dev1/port0/line4:5.
So it is not possible to use more than two arguments. That is my problem. I don't know how I can do the change detection on specific connections (1,3,5) in this command that are not part of a line (line would be line1:3 -> connection 1,2,3).
best regards
02-09-2017 12:19 AM
Hello Fasching_K,
could you please try to enter
Dev1/port0/line1, Dev1/port0/line3, Dev/port0/line5
instead of
Dev1/port0/line1:3
you normally, can enter the lines seperat with a comma.
02-09-2017 01:03 AM - edited 02-09-2017 01:04 AM
Thank you, that was the solution. I never tried it in this way.
In the following you can see the code how I tried it. In my case I have other connections but it did work this way.
DAQmxErrChk(DAQmxCfgChangeDetectionTiming(DigitalTaskHandle, "Dev1/port0/line28, Dev1/port0/line29, Dev1/port0/line30, Dev1/port0/line31", "Dev1/port0/line30", DAQmx_Val_ContSamps, 1));
I have one last question, that the topic is can be closed.
I do not understand the line grouping in this command:
DAQmxCreateDIChan(DigitalTaskHandle, DIInterruptChannel_digitalMode, "", DAQmx_Val_ChanPerLine)
I read the help to this command but I do not really understand it what the difference between DAQmx_Val_ChanPerLine and DAQmx_Val_ChanForAllLines is?
Best regards
02-09-2017 01:23 AM
Hello Fasching_K,
if you are using lines from diffrent ports or you enter the ports direct then the value should set to DAQmx_Val_ChanForAllLines. The driver then internal group the lines together in one task.
02-09-2017 01:40 AM
Hello,
so you mean I can take lines form port 0 or 1 together and this selctions allows me to use it correctly?
Best regards
02-09-2017 01:58 AM
Hello Fasching_K,
yes, but it could be that change selection is not supported on all ports.