LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write a digital frequency (pulse train) and read a digital pulse train on the same digital line? (Real Time/FPGA)

Hello LV Experts,

 

I have a tricky problem to solve. I thought I had a solution, but am running out of FPGA space.

 

Hardware: cRIO-9075 with a NI-9403 32ch digital input/output module

Software: LV2012 SP1 w/ RT & FPGA modules (NI-RIO 12.1)

OS: Windows Vista

Goal: On the same digital line, write a digital frequency (pulse train) and read a digital pulse train.

 

 

In the attached flow chart, is the Fin and Fout line (highlighted in green). No, Fin and Fout are not two separate 5V TTL level digital lines but one line. Yes, one.  I need to write the code such that it listens to and writes to the same digital line. (This is connected to a microcontroller that reads and writes to that line.) I need to read and write frequencies of 50, 100, 200, and 500 and a DC high and low.

 

Now, it "knows" when to read and write based upon timing. If you refer to the flow chart, the line (Fout) outputs a 100 Hz frequency for 8 cycles. Fine, no problem. Then once the Select line goes low for the second time (74 ms later = 8 to 16 ms + 20 ms + 30 ms + 8 to 16ms), it needs to listen on the line for a 100 Hz frequency for 200 ms.

 

It is possible, using FPGA I/O method nodes, to configure the line direction for the NI 9403 (http://zone.ni.com/reference/en-XX/help/370984T-01/criodevicehelp/9403_configuring_the_line_directio...). See below:
 

The RT code should be able to access the "DIO28 Change Direction" enum to switch the state from "F-Out Freq" state to the "F-In" state. It should be able to generate a frequency specified by the "Fout 1/2 Period (mSec)" control when in the "F-Out Freq" state. It should be able to count the rising edges of incoming pulses on DIO28.

 

But it doesn't count the pulses when in the Fin state.

 

Any thoughts?

0 Kudos
Message 1 of 3
(2,415 Views)

Here's the flow chart and the code.

Download All
0 Kudos
Message 2 of 3
(2,414 Views)

Can you confirm that you are in fact reading a digital signal from DIO28? I am just curious if it is the code calculating the rising edges or if it is the changing DIO direction that could be the issue. 

dK
0 Kudos
Message 3 of 3
(2,344 Views)