Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use 6254 DIO with filtered digital input for port scan trigger

Hello Forum,

I'm just getting confused now, because I've tried hundreds ways to solve this little requirement on a 6254:

- Reading a digital edge which have to be filtered and using this event to trigger a digital port scan on P0 -

Sounds easy, doesn't it ?

Whatever solution I've tried, it always comes up with an error popup telling me, that I'm doing something wrong.
Now I start to think there is no way to do it.
Is there anybody who can tell me whether this is possible or not for sure ?
I have wasted so much time !

What I have recognized very early (help files say this very clearly) is that digital filtering on a 6254 is only supported
on "counter inputs". So, I started to realize that:

  DAQmxErrChk (DAQmxCreateCICountEdgesChan(Task, "/Dev1/Ctr0", "", DAQmx_Val_Rising, 1, DAQmx_Val_CountDown));
  DAQmxErrChk (DAQmxSetCICountEdgesTerm(Task, "/Dev1/Ctr0", "/Dev1/PFI5"));

Because, I don't want to poll on the result, I installed an event handler:

  DAQmxErrChk (DAQmxRegisterSignalEvent(Task,DAQmx_Val_CounterOutputEvent,0,(DAQmxSignalEventCallbackPtr) SampleCallback,eventrec));

The help says, "Counter Output Event" is raised whenever "Terminal Count" reaches zero. This is why I let it count back from 1 to 0.
But, it doesn't work, telling me something about sample clocks to use.

This is just the simplest way I've tried. Out of this many trials end up the same.
What I've tried so far:

- the digital filtering workaround example given by NI as VI (translated into Labwindows)
  -> no edge detection on PFI possible
- trying to react on the counter output/input with edge detection method
- using a sample clock on the counter -> only external clocks supported
- generating a pulse train using Ctr1
  -> DAQmx Create Timing Source create an invalid source because the specified
      Sample Timing Type is not supported when the signal is Sample Clock  -200800
- using the counter output as a trigger for immediate port scan within 1 task

Now, I'm out of ideas.
0 Kudos
Message 1 of 1
(3,254 Views)