Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

MHDDK Manual

Hi Tom,

 I have a new problem with my PCI-6713 card. When I try to write a buffered signal on channel 1 and an other buffered signal on channel 2, I can just see a signal in channel 1 which is the concatenation of my 2 signals.

You will find my code enclosed ( I don't understand how to resolve this problem)

Could you help me ?
0 Kudos
Message 11 of 24
(6,257 Views)

Hi Stephanie-

 

Your initialization looks correct, but you should interleave the data in the FIFO instead of concatenating two waveforms end-to-end.  I would recommend calling Configure_Board() and then Configure_Board2(), then pushing voltArray[i], voltArray2[i] into the FIFO on each iteration of your loop.

 

Please let me know if this does not work.

Tom W
National Instruments
0 Kudos
Message 12 of 24
(6,253 Views)

Thanks but if I write this code in my loop :

board->DACFIFOData.writeRegister(voltArray[(data_index+1)]<<16  | (voltArray[data_index] & 0x0000FFFF));
board->DACFIFOData.writeRegister(voltArray2[(data_index+1)]<<16  | (voltArray2[data_index] & 0x0000FFFF));

 

I see the signal enclosed (on attachment PrintScreen.png) on my first channel and nothing on channel 2.

 

0 Kudos
Message 13 of 24
(6,250 Views)

Hi Stephanie-

 

I found the settings that I overlooked previously.  First, we need to tell the STC that we are using multiple channels, and how many channels will actually be used.  I made this and other modifications to the Configure_Board() function.  We also need to interleave data within the 32-bit boundaries imposed by the device FIFO.  I have made modifications to support 2 channels in the attached example.

 

Most places where I made changes, I marked them with and // TW: 2chan some comments (where necessary). 

 

Also, I did not test this on a 6711 or 6731 device, so I removed those devices from the example.  Please give these modifications a try with your 6713 and let me know your results.

Tom W
National Instruments
0 Kudos
Message 14 of 24
(6,210 Views)

Hi Tom,


I have tested your aoex2.cpp for the 6713 card but it doesn't work. No signal comes out. Have you tested it with a 6713 ?

On my card 6723 the aoex3 works well but not the aoex1. I don't have 5v in channel 0 like in the other channels.

 

 

0 Kudos
Message 15 of 24
(6,193 Views)

Hi Stephanie-

 

Yes, I tested my modified example with a 6713.  Which output channels are you observing, and what exactly do you see when you run my example as posted?  How do you have your signals connected, and how are you measuring the outputs?

 

The real purpose of aoex1 for 6723 is to verify the FPGA image was downloaded correctly.  You may not see the exact 5V output because the calibration and scaling for the board is not taken into account.  Do you see some change on the AO channel when you run aoex1?  If so, what does the output voltage level come out to on ao0?  How do you have your signals connected, and how are you measuring the outputs?

 

Thanks-

Tom W
National Instruments
0 Kudos
Message 16 of 24
(6,185 Views)

Hi Tom,

Your modified example for 6713 works well. In fact, my oscilloscope was not able to detect the signal because it was too short in time.

But I do have problems with the 6723 again. When I modifiy your code in order to generate 2 different signals in channel 0 and 1it generates a concatenation of my 2 signals in the 2 channels ( see printscreen in attachment ). I have just modified the part where you load the voltage array. You can see my code bellow :

    //Load voltage array with values to be output.
    //The waveform in this example ramps linearly from the minimum voltage
    //to the maximum voltage, as determined by MaxReading.
    //A ramp is generated for each channel that is used.
    int j = 0;
    for (int i=0; i < PointsPerBuffer; i+=numChans)
    {
        //ramp from smallest voltage to largest voltage
        voltage = i * 2.0F * MaxReading / (PointsPerBuffer - 1.0F) - MaxReading;
        voltage2 = 1024*(float)(sin((2*3.1415926 * i/PointsPerBuffer)));
        j=0;
        while((j<numChans) && ((j+i)<PointsPerBuffer))
        {

            if(j==0) voltArray[i+j] = (int)voltage;
            if(j==1) voltArray[i+j] = (int)voltage2;

            //voltArray[i+j] = (int)voltage;
            j++;
        }
    }

Where is my error, please ?

My second problem is that I don't know how to write a value directly in a channel. And how can I do to use some channels with FIFO and other ones directly ?

 

Thanks

0 Kudos
Message 17 of 24
(6,167 Views)
0 Kudos
Message 18 of 24
(6,163 Views)

Hi Stephanie-

 

What modifications did you make to the example to make it multi-channel compatible?  Please post your code example here.

Tom W
National Instruments
0 Kudos
Message 19 of 24
(6,120 Views)

Hi Tom,

 
I have changed some parts of the code that I have pasted above. You can see bellow the parts that have been modified (in bold).
 
 numChans = 2; I change this value at the beginning of the code


//Load voltage array with values to be output.
    //The waveform in this example ramps linearly from the minimum voltage
    //to the maximum voltage, as determined by MaxReading.
    //A ramp is generated for each channel that is used.
    int j = 0;
    for (int i=0; i < PointsPerBuffer; i+=numChans)
    {
        //ramp from smallest voltage to largest voltage
        voltage = i * 2.0F * MaxReading / (PointsPerBuffer - 1.0F) - MaxReading;
        voltage2 = 1024*(float)(sin((2*3.1415926 * i/PointsPerBuffer)));

        j=0;
        while((j<numChans) && ((j+i)<PointsPerBuffer))
        {

            if(j==0) voltArray[i+j] = (int)voltage;
            if(j==1) voltArray[i+j] = (int)voltage2;
            //voltArray[i+j] = (int)voltage;

            j++;
        }
    }

I tried to write directly on the 6723 and it works well. But I noticed that it was not possible to write directly in some channels and to write a waveform in other ones at the same time.
Is it normal or is there an error in my code?

0 Kudos
Message 20 of 24
(6,112 Views)