From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

6501 issues

Hi,

 

I have a .net application that reads/writes ports in my ni6501 device.

I set some ports on port 0(door lock and powering on some devices), run my test and reset my ports.

For some reason, this is not working as expected, mainly resetting is not working and seems something may be reinitializing everything. 

I am using 1 task for inputChannel and 1 task for OutputChannel in my device class.

Each task has input and ouputchannels defined.

I have GetState and SetState methods in my device class, where I set only the necessary bits, masking others and using WriteSingleSamplePort.

Each pin setting is a step and I initialize a device class instance for the operation.

Am I doing this correctly, any advise what may be going on? Can I get an example of a set bits, test, retest bits code?

Also, I have a read and a write in the same task on the same port, will this break something?

0 Kudos
Message 1 of 2
(1,638 Views)

I figured the issue. In my application, I was trying to read from an output port and it was returning 255 all the time, no matter what the ports are set to.

I have port 0 as output port, port 1 as input port.

I want to set ports 0.0, 0.1 and 0.2 one after the other in that order. I use WriteSingleSamplePort() but I unable to use bit mask since I can't read the current state of port0(always returns 255). I don't want to assume the value they are set to.

My channelGrouping is OneChannelForAllLines. If I try to use OneChannelForEachLine, I get an exception that I cannot do this with DigitalChannels.

I am not sure how to go about writing the port using bit mask.

Any guidance appreciated.

0 Kudos
Message 2 of 2
(1,566 Views)