LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI - how to use hardware performance?

Hallo,
 
I would understand about writing single sample at high rate as 20ns (the rate of NI-6733 Analog Output Module).
 
I write this code in CVI:
 
#include <cvirte.h>
#include "cvidll.h"
#include <userint.h>
#include <ansi_c.h>
#include <math.h>
#include "nidaqmx.h"
#include <stdio.h>
static int init=0;

int __stdcall DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    switch (fdwReason)
        {
        case DLL_PROCESS_ATTACH:
           
            /* Respond to DLL loading by initializing the RTE */
            if (InitCVIRTE (hinstDLL, 0, 0) == 0)
                return 0;
            break;
        case DLL_PROCESS_DETACH:
           
            /* Respond to DLL unloading by closing the RTE for its use */
            if (!CVIRTEHasBeenDetached ())
                CloseCVIRTE ();
            break;
        }
   
    /* Return 1 to indicate successful initialization */
    return 1;
}

int __stdcall DLLfunc3 (int voltage)
{
 int Err_output=1;
 int TuttoOk=0;
 int i=0;
 float64 data[1000];
 float64 voltaggio;
 TaskHandle mytaskHandle=0;
 
 
 /* Creazione del task */
 Err_output = DAQmxCreateTask("",&mytaskHandle);
 
 if(Err_output==0)
 {
  
  TuttoOk++;
  
  /*for(;i<1000;i++)
   data[i] = 1*sin((double)i*2.0*3.14/1000.0);*/
  
  
  Err_output = DAQmxCreateAOVoltageChan(mytaskHandle,"PXI1Slot4/ao0","",
   -10,10,DAQmx_Val_Volts,""); 
  if(Err_output==0)
  {
   TuttoOk=TuttoOk+10;
  }
  
    
  /*Err_output = DAQmxStartTask(mytaskHandle);
  if(Err_output==0)
  {
   TuttoOk=TuttoOk+100;
  }*/
  
  Err_output = DAQmxWriteAnalogScalarF64(mytaskHandle, 1, 0.0, voltage, NULL);
  if(Err_output==0)
  {
   TuttoOk=TuttoOk+1000;
  }
  
 }
 
 return Err_output;

}
 
Then create Debuggable DLL for real time target, I call created DLL in deterministic loop in Real-Time project (LabView).
There are some problem:
 
- DAQmxStartTask(mytaskHandle);
probably is incorrect! why?

  
- DAQmxWriteAnalogScalarF64(mytaskHandle, 1, 0.0, voltage, NULL);
probably is incorrect! why?
 
- Can I write a single sample at rate of 20ns? Can I fully use the hardware performance? How make this?
 
I desire generate a single sample at high rate for control of sound where it is necessary high frequency!!!
 
 
Thanks for help in advance. Michael
 
 
0 Kudos
Message 1 of 1
(3,082 Views)