LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Change Detection

Solved!
Go to solution

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.

 

  • Could it possible that I can do only where I must always quote every electrical connection in a line like above (28, 29, 30, 31 --> line; 22, 25, 28, 30 --> not a line).
  • Is it even possible to do a change detection like I would like to have for the connections 22, 25, 28, 30? I heard in the last post something from binary mask.
  • In the sample above I set three digital inputs from 0 to 1 and one digital input from 1 to 0. Later there will be a lot more inputs that I would like to set from 1 to 0. In my sample it will not be possible to set a second connections from 1 to 0 because DIChannelSensor1_digitalMode[]="Dev1/port0/line28"; can only be a line. When I write for example line28:30 the electrical connections 28,29 and 30 will also have the change detection from 1 to 0 but I only would like to have it on 28 and 30. In this code segment I can only fill in two arguments for the rising edge and the falling edge: DAQmxErrChk(DAQmxCfgChangeDetectionTiming(DigitalTaskHandle, DIChannel_digitalMode, DIChannelSensor1_digitalMode, DAQmx_Val_ContSamps, 1));So it is only possible to set lines at the moment and not a single connection.

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

 

 

0 Kudos
Message 1 of 10
(3,660 Views)

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.

 

best regards
Alexander
0 Kudos
Message 2 of 10
(3,625 Views)

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

0 Kudos
Message 3 of 10
(3,614 Views)

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

 

 

best regards
Alexander
0 Kudos
Message 4 of 10
(3,609 Views)

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

 

0 Kudos
Message 5 of 10
(3,600 Views)
Solution
Accepted by topic author Fasching_K

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.

 

best regards
Alexander
0 Kudos
Message 6 of 10
(3,589 Views)

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

 

0 Kudos
Message 7 of 10
(3,587 Views)

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.

best regards
Alexander
0 Kudos
Message 8 of 10
(3,582 Views)

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

0 Kudos
Message 9 of 10
(3,580 Views)

Hello Fasching_K,

 

yes, but it could be that change selection is not supported on all ports.

best regards
Alexander
0 Kudos
Message 10 of 10
(3,576 Views)