Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

I need an example for connecting 2 PCI-6115 cards via RTSI using MS Visual c

I am trying to link two PCI-6115 cards together using NI-DAQ 7.1 and Microsoft Visual C++ 7.1 (unmanaged code). I do not want to use Measurement Studio. I would like an example specific to the cards I am using. There are several generic examples, but they do not include the information for S-series cards. Anyone that answers - please include a VERY specific answer that has Functions and parameters. I think I know which functions to use, but not necessarily the right parameters. Thanks to all that can help!

I am trying to :
1) Set up cards parameters including external trigger (from PFI0)
2) Arm Both cards
3) Have both cards trigger simultaneously and take data simultaneously on
ce PFI0 goes high.
4)Retrieve data from the cards via DMA

If you need any more specifics, let me know and I'll post them.

My current attempt includes using Select_Signal to port the master's clock to the slave and to port PFI0 to the slave
I have also used Select_Signal or DAQ_Config to set PFI0 as the trigger
Scan_Setup to configure the cards further
Scan_Start to arm the cards.
0 Kudos
Message 1 of 4
(2,862 Views)
Hi infrared,

If this is similar to your other post about waveform sequencing, then I will have to modify my response slightly to accommodate this request.

We are going to want to route the output of counter 0 to RTSI 0. Also, instead of getting your sample clock directly from counter 0, you should get the sample clock (scan clock) from RTSI 0 instead. It will be the same clock but you will be able to reuse that same line of code for you 2nd board, as it will get the clock from the RTSI line as well.

As for your trigger signal, you will want to route it to the analog output sample clock (update clock) and then route this signal to RTSI 1. It is basically a 2-step process in getting a signal on the PFI line to route to the RTSI bus. That is the reason we use the analog output subsystem (hopefully you don't need it). Finally, you will have to use the RTSI 1 line as your AI Start Trigger for both boards.

Therefore, 1 board will have all this configuration to put the trigger and the clock on 2 RTSI lines and both boards will use the same two functions to get the AI Start Trigger from RTSI 1 and the AI Scan Start from RTSI 0.

Here are the specific configuration functions to accomplish this:

/* Configure PFI 6 Trigger to RTSI 1 */
Select_Signal(1, ND_OUT_UPDATE, ND_PFI_6, ND_LOW_TO_HIGH);
Select_Signal(1, ND_RTSI_1, ND_OUT_UPDATE, ND_LOW_TO_HIGH);

/* Configure Counter 0 Output to RTSI 0 */
Select_Signal(1, ND_GPCTR0_OUTPUT, ND_RTSI_0, ND_LOW_TO_HIGH);

/* Now you want to have your AI start trigger and sample clock come from those 2 RTSI lines for both boards. */
Select_Signal(1, ND_IN_SCAN_START, ND_RTSI_0, ND_LOW_TO_HIGH);
Select_Signal(1, ND_IN_STAR_TRIGGER, ND_RTSI_0, ND_LOW_TO_HIGH);

In all these circumstances, you might want to use your other PCI card to see if your signals are appearing on the RTSI bus. You can look at an individual signal by routing your RTSI line to the source of a counter and then route the PFI line to the same source so that you can see the RTSI line on the output of that PFI line.

Hopefully this makes sense. Have a good day.

Ron
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(2,862 Views)
This post is for the same application that will be using waveform sequencing. I have tried your functions as written, but haven't had any more luck getting both cards to acquire data simultaneously.

I do have a couple questions about the specifics of these functions, but it may be easier for you to just see what I'm doing and maybe point out what I need to change. My current code looks like the following :
//////ATTEMPT TO ROUTE TRIGGER AND CLOCK TO SLAVE CARD FROM MASTER CARD WHERE 1 IS THE MASTER AND 2 IS THE SLAVE//////

/* Configure PFI 6 Trigger to RTSI 1 */
Select_Signal(1, ND_OUT_UPDATE, ND_PFI_6, ND_LOW_TO_HIGH);
Select_Signal(1, ND_RTSI_1, ND_OUT_UPDATE, ND_LOW_TO_HIGH);

/* Configure Counter 0 Output to RTSI 0 */
Select_Signal(1, ND_GPCTR0_OUTPUT, ND_RTSI_0, ND_LOW_TO_HIGH);

/* Now you want to have your AI start trigger and sample clock come from those 2 RTSI lines for both boards. */
Select_Signal(2, ND_IN_SCAN_START, ND_RTSI_0, ND_LOW_TO_HIGH);
Select_Signal(2, ND_IN_STAR_TRIGGER, ND_RTSI_0, ND_LOW_TO_HIGH);

//////THE FOLLOWING IS A CLASS METHOD THAT IS CALLED ONCE FOR EACH CARD WITH ALL PARAMETERS IDENTICAL EXCEPT FOR THE CARDNUMBER WHICH IS CALLED FOR cardNumebr = 1 AND THEN cardNumber = 2 where 1 is the master and 2 is the slave//////

iStatus = SCAN_Setup(this->cardNumber, this->numberOfChannelsToAcquire, this->channelsToAcquire, this->channelGains);
iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Setup", iIgnoreWarning);

iStatus = Timeout_Config(this->cardNumber, lTimeout);
iRetVal = NIDAQErrorHandler(iStatus, "Timeout_Config", iIgnoreWarning);

//////THEN BOTH CARDS ARE ARMED, SLAVE FIRST. THIS IS ALSO A CLASS FUNCTION THAT RECEIVES IDENTICAL PARAMETERS FOR BOTH CARDS EXCEPT FOR cardNumber.//////
iStatus = SCAN_Op( this->cardNumber,
this->numberOfChannelsToAcquire,
this->channelsToAcquire,
this->channelGains,
this->dataBuffer,
this->numberOfChannelsToAcquire * this->samplesPerChannel,
0, //This parameter is not used by simultaneous sampling devices
this->sampleRate
);
iRetVal = NIDAQErrorHandler( iStatus, "SCAN_Op", iIgnoreWarning);

//////THE NEXT STEP IS TO RETREIVE THE DATA FROM THE CARDS//////
//Organize the converted values according to channel
iStatus = SCAN_Demux(this->dataBuffer, this->samplesPerChannel * this->numberOfChannelsToAcquire, this->numberOfChannelsToAcquire, 0);
iRetVal = NIDAQErrorHandler(iStatus, "SCAN_Demux", iIgnoreWarning);

//Scale integer values to voltage values according to each channel's gain setting
for(int i=0;i{
iStatus = DAQ_VScale(this->cardNumber, 0, this->channelGains[i], 1//dGainAdjust
, 0//dOffset
, this->samplesPerChannel
, &this->dataBuffer[samplesPerChannel * i]
, &data[samplesPerChannel * i]);
}

iRetVal = NIDAQErrorHandler(iStatus, "DAQ_VScale",iIgnoreWarning);

The variables for my default case are as follows:
cardNumber = 1 or 2 depending on the call. 1=master, 2=slave.
numberOfChannelsToAcquire = 4
channelsToAcquire = [0,1,2,3]
channelGains = [0,1,2,3]
lTimeout = 180 //10 second time out
dataBuffer is an array of data type i16 that is (numberOfChannelsToAcquire * samplesPerChannel) elements long.
samplesPerChannel = 250
sampleRate = 20000 //2kS/s

On the last Select_Signal function, did you mean ND_IN_START_TRIGGER ? I know that PXI busses have a STAR trigger, so I thought I'd ask, but ND_IN_START_TRIGGER is not a valid constant. Also - you wrote "1" for each function.. are all of those functions for the master card?

Hopefully this helps. Before you wrote I was trying :
//Set as the master card, and send it's clock signal to all other slave boards.
Select_Signal(1,ND_RTSI_CLOCK, ND_BOARD_CLOCK,ND_DONT_CARE);
//Set as slave board, and recieve clock signal from master
Select_Signal(2,ND_BOARD_CLOCK, ND_RTSI_CLOCK,ND_DONT_CARE);
//Send trigger from the master card
Select_Signal(1,ND_RTSI_1,ND_IN_START_TRIGGER,ND_LOW_TO_HIGH);
//Recieve trigger from the master card
Select_Signal(2,ND_IN_START_TRIGGER,ND_RTSI_1,ND_LOW_TO_HIGH);

Select_Signal(1,ND_IN_START_TRIGGER,ND_PFI_0,ND_LOW_TO_HIGH);

This code resulted in the slave card timing out, but the master would trigger off of PFI0. When you wrote PFI 6 in your example code, was that because I need to use PFI 6? Or can I use PFI 0.

Thank you again for your help,

infrared
0 Kudos
Message 3 of 4
(2,862 Views)
Hi infrared,

You will have to program and test code in individual logical steps. The first step is to route a PFI line to the RTSI bus on both cards and then send a signal down the one card's PFI line. You should be able to see the signal on the other cards PFI line. Does this work?

Once you have that working, you can slowly start incorporating the counters, the analog input etc.

You can use the code in previous post to route a PFI line to the RTSI bus. You can also use a different subsystem to route your signal through to get to the RTSI bus. For example, you can route a PFI line to the output of a counter and then route that output to a RTSI line.

Anyway, give that a try. Have a good day.

Ron
0 Kudos
Message 4 of 4
(2,862 Views)