From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Setting the state of a digital line indefinitely

Solved!
Go to solution

First off, I'm not sure if I'm approaching this problem in the right way, so feel free to point me in another direction.

 

What I'm trying to implement: I'm using the NI-USB 6251 that is connected to a custom board. The relevant part is that one of the devices I'm communicating with is a chip that uses the C-BUS protocol. There are  CDATA and RDATA line to write/read values to/from (8-bit) registers, a CLK line to clock those values in/out, and a CSN (chip select) line that needs to be pulled low whenever data is written to the chip. 

 

My attempted implementation:

I'm using one task for the CDATA/RDATA + CLK lines. I'm connecting the CLK by setting the ExportSignals.SampleClockOutputTerminal value to the physical address of the CLK line. I am then using a DigitalChannel + Writer to write to the CDATA.

 

I have a separate task for the CSN and this is the part I'm very unsure about. This line needs to be pulled low during any communication with the chip. So what I basically have is this:

 

 

            chipSelectWriter.WriteSingleSampleSingleLine(true, false);
            commWriter.WriteWaveform(true, waveform);
            chipSelectWriter.WriteSingleSampleSingleLine(true, true);

 

What I don't know is whether this actually pulls the line low long enough for the waveform to be written, or whether it pulls it low for a single sample and then reverts. 

 

My first instinct was to use the DataActiveEventOutputTerminal property, however because these lines are connected to "PFI" lines (pardon my lack of grasp of the terminology), the DAQ informs me that this feature is not supported for PFI lines.

 

What would be the proper way to program this scenario. Can you point me to any examples? I can post code if needed.

 

0 Kudos
Message 1 of 2
(4,116 Views)
Solution
Accepted by topic author zkhan.cimtec

I found out through more testing that the code above is doing what I want it to do, so consider this problem solved.

0 Kudos
Message 2 of 2
(4,090 Views)