Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

64 bit data write using DAQmxWriteDigitalU32

Hi to everyone,

How i can write to my pci-dio-96 board a data of 64 bits using the DAQmxWriteDigitalU32 function?
Im doing the following steps:

DAQmxCreateTask("taskDO",handler);
DAQmxCreateDOChannel(taskDO,"Dev1/port0_32","port0_32",1);
DAQmxCreateDOChannel(taskDO,"Dev1/port4_32","port0_32",1);
DAQmxStartTask(handler);
.........
After this, when im trying to write the data, if for example i have the data in a write_value[ ] variable:

uint32 write_value[2];

write_value[0] = data from bit 0 to 32;
write_value[1] = data from bit 33 to 64;

//im doing this because if not, when i call the DAQmxWriteDigitalU32 funtion, it sais that 64 bit port its too big, so i need to divide the data.

DAQmxWriteDigital32(taskDO,1,0,10.0,0,&write_value[0],&num,NULL);
DAQmxWriteDigital32(taskDO,1,0,10.0,0,&write_value[1],&num,NULL);

The first 32 bits are going good, but the relays got crazy with the second 32 bits (from 33 to 64).

I dont know whats happening, anyone can help me with this little missconcept?

Thanks a lot in advance,

Ruzz


0 Kudos
Message 1 of 4
(3,521 Views)
Please im very stuck with this. Anyone knows how i can do it?
0 Kudos
Message 2 of 4
(3,502 Views)
Please i need help with this...

Just want to know how to write the 64 bits data to the pci-dio-96 board. I dont know if im confuse with the function DAQmxWriteDigitalU32, but i asume that if i group dev1/port0:3 it will work, but not with dev1/port0:7.

Please, any help and little tip will be very helpfull.

Ruzz
0 Kudos
Message 3 of 4
(3,487 Views)
I have found a solution!

I have created 2 task, taskDO and taskDO2:
DAQmxCreateTask("taskDO",&taskDO);
DAQmxCreateTask("taskDO2",&taskDO2);

I have added each channel to one of these tasks: Dev1/port0:3 to the taskDO, Dev1/port6:9 to the taskDO2:
DAQmxCreateDOChan(taskDO,"Dev1/port0:3","port0_3",DAQmx_Val_ChanForAllLines)
DAQmxCreateDOChan(taskDO2,"Dev1/port6:9","port6_9",DAQmx_Val_ChanForAllLines)

Start the two tasks:
DAQmxStartTask(taskDO)
DAQmxStartTask(taskDO2);

After these steps, when i recive the data, i split 0-31 and 32-63 bit into data1 and data2, and using the DAQmxWriteDigitalU32 function i can see the relays working perfect:

    //we have the incoming data in a data[64] array

    uint32 data1[1];
    uint32 data2[1];
    uint8 index;

    write_value[0] = 0;
    write_value2[0] = 0;

    //put in write_value[0] the first 32 bits
            
          //first 32 bits
            for(index = 0;index<32;index++)
            {
                data1[0] = data1[0]<<1|*((uint8*)data[31-index]);
            }
            DAQmxWriteDigitalU32(taskDO,1,0,10.0,0,data1,&numEscritos,NULL);

          //second 32 bits
            for(index=0;index<mitad;index++)
            {
                data2[0] = data2[0]<<1|*((uint8*)data[63-index]);
            }
            DAQmxWriteDigitalU32(taskDO2,1,0,10.0,0,data2,&numEscritos,NULL);



Hope this can help to anyone with a similar problem.


Message 4 of 4
(3,473 Views)