Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for rising edge on digital input line

I am using a PCI6143 with VB.NET. I need to wait for a rising edge on Dev1/Port0/Line1.

When I try the ReadDigChan_ChangeDetection example, I get an error: "Requested value is not a supported value for this property - Sample timing type ChangeDetection - Use OnDemand".

Similar error trying: myTask.Timing.ChangeDetectionDIRisingEdgePhysicalChannels = "Dev1/Port0/Line1"

This should be easy???
0 Kudos
Message 1 of 6
(3,902 Views)
Hello Mike,

Thank you for contacting National Instruments.

The reason for this error is that Change Detection is not supported by the PCI-6143. What will you be doing with this rising edge? If you are just using it to trigger something, then you should configure it as a trigger and wire the signal in to a PFI line. Otherwise, you will have to poll the digital line to detect a change.

Regards,

Sean C.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 6
(3,894 Views)
Sean-

Thanks for the reply. I was concerned that polling in a multi-tasking system could miss a pulse but I have set up on a sample reference trigger on PFI 1 which is close enough for what I want to do.

One other question - I have 4 channels I have been experimentig with independently:

1 outgoing trigger pulses to an external device
pulseTriggerTask.DOChannels.CreateChannel("Dev1/Port0/Line0", "Pulse Trigger", _
ChannelLineGrouping.OneChannelForEachLine)

2 incomming confirmation pulses that are counted
pulseCountTask.CIChannels.CreateCountEdgesChannel("Dev1/ctr1", "Pulse Count", _
CICountEdgesActiveEdge.Rising, 0, CICountEdgesCountDirection.Up)

3 & 4 analog signals that are sampled at 100000/sec for 2000 samples reference triggered on PFI 1
pulseReadTask.AIChannels.CreateVoltageChannel("Dev1/Ai0", _
"Current", AITerminalConfiguration.Differential, rangeMin, rangeMax, _
AIVoltageUnits.Volts)

pulseReadTask.AIChannels.CreateVoltageChannel("Dev1/Ai1", _
"Voltage", AITerminalConfiguration.Differential, rangeMin, rangeMax, _
AIVoltageUnits.Volts)

I am going to put them all together in one subroutine now. Should they all be in the same task?

-Mike
0 Kudos
Message 3 of 6
(3,885 Views)
Hello Mike,

The DO and CI channels should be configured in separate tasks. You should then create a third task with both AI channels. You will get an error if you try to run two AI tasks on the same board simultaneously. The reason for this is that all AI channels share the same sample clock, so you cannot have two tasks trying to control that clock at the same time.

Let me know if you have any further questions.

Sean C.
0 Kudos
Message 4 of 6
(3,877 Views)
Thanks, Sean

One more round, if you would:

Turns out I won't get a nice digital pulse to count. I had to add a third analog channel and I will have to examine the data instead.

Could you take a look at the attached subroutine for obvious errors?

Do I need a StartTrigger?

Is pulseReadTask.Stream.ReadAllAvailableSamples = True necessary in this case?

A relatively long trigger pulse is necessary for the target device. Am I correct that this pause won't have any effect on the analog sample ReferenceTrigger?

Am I correct that I can make the call: readingArray = pulseReader.ReadMultiSample(numReadings) at any time and it will return after all 2000 samples are read into the array?
0 Kudos
Message 5 of 6
(3,860 Views)
Hello Mike,

I don't see any obvious errors in your code.

"Do I need a StartTrigger?"
You don't need a start trigger if you want your task to start as soon as you call the AnalogMultiChannelReader function.

"Is pulseReadTask.Stream.ReadAllAvailableSamples = True necessary in this case?"
I do not believe this is necessary in this case. Because you are reading a finite number of samples and you are waiting on a reference trigger, you should probably wait until all 2000 samples are acquired to read them.

"A relatively long trigger pulse is necessary for the target device. Am I correct that this pause won't have any effect on the analog sample ReferenceTrigger?"
Yes, you are correct.

"Am I correct that I can make the call: readingArray = pulseReader.ReadMultiSample(numReadings) at any time and it will return after all 2000 samples are read into the array?"
Yes, this function will wait until all 2000 samples are acquired.

Let me know if you have any further questions.

Sean C.
0 Kudos
Message 6 of 6
(3,845 Views)