07-02-2008 10:27 AM
07-07-2008
09:27 PM
- last edited on
10-29-2025
08:55 PM
by
Content Cleaner
07-08-2008 07:57 AM - edited 07-08-2008 07:58 AM
Thank you for the reply Rod.
I am able to do eventing. (I don't know if its done via hardware or the NI .net library) I can event on one channel at a time. The example "ReadDigChan_ChangeDetection_Events.2005" shows this. However, it only allows me to event on individual lines or on a port at a time. I want to event on all inputs or event just be able to read all inputs at once. It appears that I can only have one task running at a time to read the events. I can setup change detection on one port fine. When I try to set it up on a second when the first is running I get an exception.
What I am looking for is this. I have a PC which may have 1 or more 6515's or 6511's or a combination of the two in there. The inputs are going to be wired up to various machines as needed. I am looking for an efficient way of collecting all of the data. I will know up front which inputs are connected. I currently have it implemented as something similar to this.
private Dictionary<string, DigitalSingleChannelReader> PortReaders { get; set; }
private Dictionary<string, Task> Tasks { get; set; }
foreach (KeyValuePair<string, DigitalSingleChannelReader> kvp in PortReaders){
byte b = kvp.Value.ReadSingleSamplePortByte();// do something with b
}
I am looking for a way to read everything at once instead of having to loop through like this to read the data.
07-09-2008 03:16 PM
07-09-2008 04:13 PM
Thanks again for the reply Rod,
I couldln't find the method you were referring to. I am actually using the
public DIChannel CreateChannel( string lines, string nameToAssign, ChannelLineGrouping grouping);
on the DIChannelCollection object.