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.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Triggering waveforms to execute based on DIO input (HSDIO 6551)

My system consists of a PCB that drives the enable on a latch.  When the enable is HIGH the output of the latch (Q) is tri-stated.  When the enable is LOW the output of the latch is equivalent to the data on the input (D).  See the picture for more clarification.

 

My System Setup

 

Here is the problem, I'm trying to do this without the latch configuration.  I want to run the enable to DIO (HSDIO 6551), and then output certain DIO only for a short period of time, then tri-state it.

 

What solutions can NI think of to accomplish this?  I have a few experiments I want to run, but I want to understand what NI thinks the best way to perform something like this.

0 Kudos
Message 1 of 12
(4,285 Views)

Hi Jacob,

 

If I'm reading this correctly, you want the rising edge (or falling edge) of your enable signal to trigger a generation on the 6551 and when that generation is complete, you want the DIO channel to tri-state?

 

You can set the 6551 to tri-state its generation channels when Idle.  (Look at niHSDIO Configure Idle State.vi).

 

For an example of how this is used, you can check out the example "Dynamic Generation Hardware Pause Trigger with Idle State.vi".

 

If you've only got a single set of data to output, this is probably the easiest way.

 

Keith Shapiro

National Instruments R&D

 

 

0 Kudos
Message 2 of 12
(4,268 Views)

I forgot to mention, the Enable will be connected to a DIO channel, and I would want to be able to change the data I generate at any given time.  I think it greatly increases the difficulty of the task.

 

I was thinking of setting up HWC mode with running a script and triggering off of the sample errors.  My initial waveform would be 4 samples (I think that is the minimum samples required) all "Z" with my Enable being "H".  When a sample error occured, meaning the Enable was not "H", thus it must have been "L", it would generate a script trigger which would cause my script to execute a waveform. 

 

The script would be pretty simplistic like:

"generate myWfm"

"if(scriptTrigger0)"

"  generate myWfm2"

"end if"

 

To change the waveform "on-the-fly" I would just try writing over the waveform on the card (I'm hoping that would even work). 

 

Thanks for the response, please e-mail or respond to the thread and I will get back to you ASAP.

Jacob

Message Edited by Jacob Perry on 01-06-2009 01:11 PM
0 Kudos
Message 3 of 12
(4,258 Views)

Is the sequence of waveforms you'd generate fixed?  Or does it depend on some other data out in the system?  (As in, when you start a session, do you know ahead of time all the data you will generate via the 6551?)

 

I think there might be an easier way to accomplish what you're trying to do.

 

Keith Shapiro

National Instruments R&D

0 Kudos
Message 4 of 12
(4,253 Views)

Yes I will know ahead of time all of the waveforms I will generate, but it should be quite a few waveforms, something like 30-40 waveforms, but they should only be around 5-10 samples maximum.

 

I also have to run at high speed, my Enable pulse only occurs for around 340ns.

 

Thanks for the response,

Jacob

0 Kudos
Message 5 of 12
(4,250 Views)

Hi Jacob,

 

If you are using a very exact timing sequence - (after the first pulse, you know when the enable pulse will arrive each time), a single stimulus/response type Hardware Compare waveform using a pattern match start trigger seems like a good approach.  As you suggested, you can just tri-state the D channel as part of the waveform.

 

The only difference is that instead of using a script trigger, you're just using a simple pattern match to kick things off.

 

Of course, this won't work if there's variability in the timing of the enable train.

 

Keith Shapiro

National Instruments R&D

0 Kudos
Message 6 of 12
(4,235 Views)
Unfortunately the Enable signal isn't guarenteed to be exact.
0 Kudos
Message 7 of 12
(4,230 Views)

Hi Jacob,

 

Sorry I haven't been more responsive lately.  Did you ever solve this problem?

 

Thanks,

 

Keith Shapiro

National Instruments R&D

0 Kudos
Message 8 of 12
(4,089 Views)

Actually, I'll get to test it out against the hardware in about 2 or 3 days, but I think so.  I'll let you know how the test against the actual hardware works.

 

Here is the code I plan on using, I used similiar code on one of the HSDIO cards in the lab, and I think it worked.  I have to verify with an oscilloscope the exact timing before I test it on hardware.  I posted only the relevent parts of code.

 

Assume PFI0 is connected to PFI1 and DDC_CLK_OUT is connected to STROBE

 

/*****************/

 /* Script setup */

/*****************

 myScript=
 "script myScript1 "
 "  Repeat forever "
 "  Wait until scriptTrigger0 "
 "    Generate myWfm "
 "  end repeat "
 "end script ";

 

 

  /****************************************/
 /* Generation Setup for HS-DIO Cards */
 /****************************************/

 niHSDIO_InitGenerationSession(genDeviceID[0], VI_FALSE, VI_FALSE, "", &genVi[0]);
 niHSDIO_AssignDynamicChannels(genVi[0], "0-19");
 niHSDIO_ConfigureSampleClock(genVi[0], NIHSDIO_VAL_ON_BOARD_CLOCK_STR, 50000000); 
 niHSDIO_ExportSignal(genVi[0], NIHSDIO_VAL_DATA_ACTIVE_EVENT, "", NIHSDIO_VAL_PFI1_STR);
 niHSDIO_SetAttributeViInt32(genVi[0], "", NIHSDIO_ATTR_HWC_HARDWARE_COMPARE_MODE, NIHSDIO_VAL_HWC_STIMULUS_AND_EXPECTED_RESPONSE );
 niHSDIO_SetAttributeViString (genVi[0], "", NIHSDIO_ATTR_EXPORTED_SAMPLE_CLOCK_OUTPUT_TERMINAL, NIHSDIO_VAL_DDC_CLK_OUT_STR);
 niHSDIO_ConfigureDataVoltageLogicFamily (genVi[0], "0-19", NIHSDIO_VAL_5_0V_LOGIC);  
 
 niHSDIO_ConfigureGenerationMode (genVi[0], NIHSDIO_VAL_SCRIPTED);
 niHSDIO_WriteNamedWaveformFromFileHWS (genVi[0], "myWfm", "A.hws", VI_FALSE, VI_NULL);
 niHSDIO_WriteScript (genVi[0], myScript);

 niHSDIO_CommitDynamic (genVi[0]);

 

 

 /****************************************/
 /* Acquisition Setup for HS-DIO Cards */
 /****************************************/
 niHSDIO_InitAcquisitionSession (acqDeviceID[0], VI_FALSE, VI_FALSE, "", &acqVi[0]);
 niHSDIO_AssignDynamicChannels (acqVi[0], "0-19");
 niHSDIO_SetAttributeViInt32 (acqVi[0], "", NIHSDIO_ATTR_HWC_HARDWARE_COMPARE_MODE, NIHSDIO_VAL_HWC_STIMULUS_AND_EXPECTED_RESPONSE );
 niHSDIO_ConfigureSampleClock(acqVi[0], NIHSDIO_VAL_STROBE_STR, 5000000);   
 niHSDIO_ConfigureDigitalEdgeStartTrigger (acqVi[0], NIHSDIO_VAL_PFI1_STR, NIHSDIO_VAL_RISING_EDGE);
 niHSDIO_ConfigureAcquisitionSize (acqVi[0], 1000000, 1);
 niHSDIO_ConfigureDataVoltageLogicFamily (acqVi[0], "0-19", NIHSDIO_VAL_5_0V_LOGIC);     


 //"0" is the channel to match, "1" is the level
 niHSDIO_ConfigurePatternMatchStartTrigger (acqVi[0], "0", "1", NIHSDIO_VAL_PATTERN_MATCHES);
 niHSDIO_ExportSignal (acqVi[0], NIHSDIO_VAL_START_TRIGGER, "", NIHSDIO_VAL_PFI2_STR);
 niHSDIO_ConfigureDigitalLevelScriptTrigger (genVi[0], NIHSDIO_VAL_SCRIPT_TRIGGER0, NIHSDIO_VAL_PFI2_STR,
                                            NIHSDIO_VAL_HIGH);
 
 /************************************/
 /* Start the Acquisition Sessions */
 /************************************/
    niHSDIO_Initiate (acqVi[0]);

 /************************************/
 /* Start the Generation Sessions */
 /************************************/
 niHSDIO_Initiate (genVi[0]);

 

My waveform is defined as A.hws and looks something like:

Sample Num:[0][1][2][3][4]...[end]

....LogicLevel:[Z][0][0][0][0]...[Z]

0 Kudos
Message 9 of 12
(4,082 Views)

Jacob, you have 2 start triggers enabled for your Acquisition session? One is set to PFI1 and one is a pattern match on channel "0" to logic high state?

 

So, if I follow your example:

 

1. The acquisition session initiates and moves to the "wait for start trigger" state

2. The generation session Initiate starts your script (and immediately begins waiting for Script Trigger 0)

3. The generation session asserts Data Active Event

4. You have exported this Data Active Event to PFI1

5. This signal on PFI1 triggers the Acquisition to move to a sampling state

6. The acquisition session asserts a Start Trigger event

7. You have exported this Start Trigger to PFI2

8. The signal on PFI2 causes Script Trigger 0 to be asserted.

9. Your Script now sees Script Trigger 0 and generates your waveform.

10. While generating your waveform (or sometime after your waveform completes?), as soon as channel "0" is driven high by your DUT this causes the acquisition session to issue another Start Trigger?

11. This start trigger moves us back to step 7 and the loop repeats indefinitely.

 

I'm trying to understand Triggers myself to do something slightly different.  I wasn't sure you could configure the same trigger twice like you have with the Start Trigger.

 

Why do you need to connect PFI0 and PFI1 on your hardware?  I don't see PFI0 in your example.

0 Kudos
Message 10 of 12
(4,077 Views)