LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxWriteDigitalLines disables DAQmxReadDigitalU32 on 6533

Hi,

I'm working on a software using NI6533 and Ni-Daqmx
I must get continuously data on 32 bits(port 0-3) and I want to send data on the control line not used(port5).
I build 2 tasks:
- 1 to read data each 0.5s
- 1 to write data on demand

here is a summary of my code:
// continuous acquisition
    i_res = DAQmxCreateTask("Tache Acquisition Dev2",&AcqDev2TaskHandle);
    if(i_res == 0)
        i_res = DAQmxCreateDIChan(AcqDev2TaskHandle, "Dev2/port0_32", "Start Dev2", DAQmx_Val_ChanForAllLines);        
    if(i_res == 0)
        i_res = DAQmxCfgSampClkTiming (AcqDev2TaskHandle, "OnboardClock", 2, DAQmx_Val_Rising, DAQmx_Val_ContSamps,                                                                               ONE_SAMPLE_PER_CHANEL);        
    if(i_res == 0)
    {
       i_res = DAQmxSetBufferAttribute(AcqDev2TaskHandle, DAQmx_Buf_Input_BufSize, 10000);
    }
   
    // output task
    if(i_res == 0)
        i_res = DAQmxCreateTask("Tache output",&SyncDev2TaskHandle);
   if(i_res == 0)
        i_res = DAQmxCreateDOChan(SyncDev2TaskHandle, "Dev2/port5/Line1", "", DAQmx_Val_ChanForAllLines);
    if(i_res == 0)
        i_res = DAQmxCreateDOChan(SyncDev2TaskHandle, "Dev2/port5/Line3", "", DAQmx_Val_ChanForAllLines);
    if(i_res == 0)
        e_res = ACQ_OK;
// read function used 
 i_res = DAQmxReadDigitalU32 (    AcqDev2TaskHandle,
                                    READ_ALL_SAMPLE,
                                    NO_TIMEOUT,
                                    DAQmx_Val_GroupByChannel,
                                    pui_sample,
                                    ONE_SAMPLE_PER_CHANEL,
                                    &iNumRead,
                                    NULL    );
// write function
int             i_sample_written     = 0;
unsigned char     pc_data[2]             = {0,1};
DAQmxWriteDigitalLines (SyncDev2TaskHandle, 1, 0, -1, DAQmx_Val_GroupByChannel, pc_data, &i_sample_written, 0) ;


My problem:
I read data correctly until I write data on port 5!
After a first call of the writing function, I can always read but when I call the write function for the second time, my read function returns always 0 as buffer read!!!
The Ni-DAQmx functions do not return any error.

If someone can help me, It would be wonderfull!!

Thanks

Greg
0 Kudos
Message 1 of 4
(3,284 Views)

Hello,

I can't reproduce this issue with your code. Could you sent me an operational example so that I can test this in the same condition?

Thanks!

 

 

0 Kudos
Message 2 of 4
(3,256 Views)
Hello,

Here are the files!

I use a NI CB-68LP to connect signals with a PCB with 32 switches and 2 LEDs.

It seems that writing on a line of the port5 stop the continuous acquisition internal timer.
I tried to use change detection instead of continuous acquisition and I write on the port5 when modification occurs. It works correctly but the precision is too high for my application.

Thanks

Greg
0 Kudos
Message 3 of 4
(3,245 Views)
Is anybody here to help me?
It's urgent and I do not find the solution

thanks

Greg
0 Kudos
Message 4 of 4
(3,199 Views)