Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Ni 6562 PFI clock

Hello all,

 

     I am using a 6562 board. It will be used for generation purpose only. I am trying to generate 4 things. A pixel clock, a line clock a frame clock and a 16-bit data.

The pixel clock is a free-running clock whose frequency can be set to between 10MHz and 40 MHz.

The line clock should be a 1 clock wide pulse that occur every 400 pixel clocks.

The frame clock should be a 1 clock wide pulse that occur every 10 line clocks. (4000 pixel clocks)

The 16-bit data should change on each pixel clock with some data.

 

I have to be able to set the bit in PFI 1, PFI 2 and DCC clk-out LVDS. I looked at the examples given under the niHSDIO directory and didn’t find much information on that.

 

Under the Dynamic Generation and Generation-Source Synchronous Example, which export its data active event to PFI 1 (from generation) and the acqusisition will receive the start trigger from PFI 2. But I don’t really understand it.

 

Basically, I would like to know how can I generate the above patterns to the PFI 1, PFI 2 and DDC clk-out LVDS.

I have been stuck for a while and really would like some help.

 

Thank you very much.

0 Kudos
Message 1 of 14
(5,139 Views)
timkoo,

When you create a generation sessions, you have to specify some clock rate.  This clock may be exported to either the CLKOUT SMB terminal or to the bulk connector as DDC CLKOUT LVDS and DDC CLKOUT LVPECL.

The PFI terminals give you access to triggers and events.  A list of these triggers and events are documented in the help file shipped with NI HSDIO:

Devices >> NI 656x >> Generation >> Dynamic Generation >> Dynamic Generation Triggers and Events
Devices >> NI 656x >> Acquisition >> Dynamic Generation >> Dynamic Generation Triggers and Events

While you cannot export a clock or data to these PFI terminals, you may be able to play some tricks using features like the marker event.  With scripting, you may have the 656x drive a pulse on specific samples in a waveform.  For example, if your waveform is 400 samples long and you generate a marker event on the 0th sample then you have created a "clock" that is 400 samples in duration.  Please note, though, that the marker is a rising edge event.  The duration of that event is not constant so if you are using it as a clock, make sure you have the correct polarity programmed.

Generally, the best way to deterministically generate clocks that are functions of the sample clock is to use a data channel to create the toggle pattern.
Message 2 of 14
(5,127 Views)
Hello Ryan,
 
     Thank you for the fast responding. Your information helped a lot. I think I understand the big picture now. I agree with you it's the best to use the data channel to create the toggle pattern. But since I am using all 16 channel on my 6562 for data, I cannot use that approach. When you said “For example, if your waveform is 400 samples long and you generate a marker event on the 0th sample then you have created a "clock" that is 400 samples in duration." I see your logic behind it. I am trying to code it up now and I will let you know if I got anywhere ( I am getting very close now because of you, really thank you very much).
 
Tim
 
0 Kudos
Message 3 of 14
(5,121 Views)
Hi timkoo,

To address your question about the Dynamic Generation and Acquisition-Source Synchronous example, the "data active event" is exported from the generation session on PFI1 for the acquisition session to trigger on PFI2 for a reason.  You can generate a signal on PFI1 and acquire that signal on PFI1 to save yourself a PFI line; however, if you are acquiring data based on the "data active event" it will not be aligned with the generated data.  This is because the data on the PFI lines are wired internally and available immediately, but the data has to pass through the front connector through a cable and back into the device.  Sending the PFI1 through the same cables that you are sending you data allows the two signals to have the same delay.

Regards,
Andrew W
National Instruments

0 Kudos
Message 4 of 14
(5,108 Views)
Thank you for the reply. For the problem I posted, I believe the solution is using marker event like Ryan said. I looked at the example Dynamic Generation with Script>>DynamicGenerationWithMarker>>DynamicGenerationWithMarker.c. Basically, the main flow goes like
 
ViConstString script =
      "script myScript "
      "  repeat forever "
      "     generate myWfm marker0(0, 128) "
      "  end repeat "
      "end script";
 
niHSDIO_ExportSignal(vi, NIHSDIO_VAL_MARKER_EVENT, "Marker0", NIHSDIO_VAL_PFI0_STR);
niHSDIO_WriteScript(vi, script);
niHSDIO_Initiate(vi);
 
I would do the same if I am sending a signal to PFI1 for every 400 clock (or waveform data in myWfm above)
 
Question 1: How does the program knows which marker is which in the niHSDIO_ExportSignal function? Because in the script, the marker name is marker0 while in the niHSDIO_ExportSignal function, the name is Marker0, which start with a Capital M.
 
 
Question 2:
I would like to know if I want to have 2 markers, 1 send a signal to PFI1 for every 400 clocks and 1 send a signal to PFI2 for every 4000 clocks, would the code look like the following if the myWfmhas a size of 4000?
 
ViConstString script =
      "script myScript "
      "  repeat forever "
      "     generate myWfm marker0(0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3600)  marker1 (0)"  
      "  end repeat "
      "end script";
 
niHSDIO_ExportSignal(vi, NIHSDIO_VAL_MARKER_EVENT, "Marker0", NIHSDIO_VAL_PFI1_STR);
niHSDIO_ExportSignal(vi, NIHSDIO_VAL_MARKER_EVENT, "Marker1", NIHSDIO_VAL_PFI2_STR);
niHSDIO_WriteScript(vi, script);
niHSDIO_Initiate(vi);
 
Question 3:
Is this the correct way for making 2 marker
"generate myWfm marker0(0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3600)  marker1 (0)"
 
Thank you.
0 Kudos
Message 5 of 14
(5,101 Views)
timkoo,

You are exactly right.  To specify which marker, you need to specify the signal identifier argument:

signalIdentifier ViConstString Describes the signal being exported.

Defined Values
  • "ScriptTrigger0"
  • "ScriptTrigger1"
  • "ScriptTrigger2"
  • "ScriptTrigger3"
  • "Marker0"
  • "Marker1"
  • "Marker2"
  • "Marker3"
  • "" (empty String)
  • VI_NULL
You are also correct about exporting a marker.  You can have a script with a "Generate mywfm marker0(0,10,20)" where a pulse would be generated on the 0th, 10th, and 20th samples of the waveform.  The marker event will be asserted for some amount of time so there is some minimum allowed spacing between when the markers may be generated but 400 samples is more than adequate to meet that requirement.
0 Kudos
Message 6 of 14
(5,096 Views)
I C. so for "generate myWfm marker0(0, 400, 800, 1200, 1600, 2000, 2400, 2800, 3200, 3600)  marker1(0)" and
"niHSDIO_ExportSignal(vi, NIHSDIO_VAL_MARKER_EVENT, "Marker0", NIHSDIO_VAL_PFI1_STR);"

"niHSDIO_ExportSignal(vi, NIHSDIO_VAL_MARKER_EVENT, "Marker1", NIHSDIO_VAL_PFI2_STR);"

 

If they are correct. I guess it is not case sensitive then, correct? (you can have marker0 up there and when call the exportSignal function, you can use Marker0)

 

Thank you.

0 Kudos
Message 7 of 14
(5,093 Views)
yes, that is correct.  You could use marker0(0,10,20) or Marker0(0,10,20) and get the same functionality.
0 Kudos
Message 8 of 14
(5,087 Views)
Cool Thanks a lot Ryan.Smiley Very Happy
0 Kudos
Message 9 of 14
(5,086 Views)
glad to help out.  don't hessitate to post any other questions.
0 Kudos
Message 10 of 14
(5,082 Views)