Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing a digital waveform to a single line with DAQmx and the PCIe-6536

Hi,

 

This is a follow-up to a previous question I had using the USB6009, but I decided to switch over to the PCIe-6536 because I couldn't get the 6009 to toggle a line faster than 1 ms.

 

I'm trying to manipulate a single line using DAQmx to write out a binary waveform (say for example CAhex which is 11001010bin). I've written up some code in labview that I think generates the waveform properly, which I've attached.

 

However, I'm having a little bit of trouble getting it to write. The code I've written so far just attempts to write CAhex continuously (via a while loop and the DAQmx write -DigitalWaveform 1 Channel N samples function), but nothing really seems to be written.

 

I'm trying to get it to write at 1 binary bit per 1/9600 seconds or the entire CAhex sequence in 1/1200 seconds, but I seem to be having a little bit of trouble getting it set up.

 

Some additional background to what I'm trying to achieve is:

I'm trying to use a single line to perform some UART serial communications with a signal conditioner chip (MAXIM's MAX1452). The line is bi-directional, half-duplex asynchronous. I've previously received some suggestions to create a virtual channel for writing, then clear the task and create a new one for reading, etc. I understand that there are USB-TTL chips available, but I'd like to integrate as many things into labview if possible, hence me trying to just configure the chip using a labview interface.

 

Thanks.

0 Kudos
Message 1 of 7
(5,225 Views)

Gabriel - 

 

You will want to switch your timing type for generation to "Continuous Samples" so that the DAQmx Write Task is set to write multiple values on a single trigger as opposed to how you had it set up in your original program.  That should fix the issue, let me know how it goes for you.  

Regards,

Ben N.
Applications Engineering
ni.com/support
0 Kudos
Message 2 of 7
(5,215 Views)

Hi Ben,

 

I swapped over to 'Continuous Samples' like you suggested but I get an Error - 200292. 

 

0 Kudos
Message 3 of 7
(5,210 Views)

I've been poking around a bit and found the NI SPI libraries. By looking into some of the VIs, I've tried to replicate some of them. 

 

I have a feeling it's not completely correct, but I think the gist of it is right so far...

 

I've only implemented the write part though, and I have yet to do the read part.

 

I still cannot get the samples to be written out via one of the lines on my card. I've tried changing between Continuous and Finite in the DAQmxTiming vi to no avail. Any suggestions?

 

I've attached my code, if that helps.

0 Kudos
Message 4 of 7
(5,201 Views)

I've managed to resolve it, via a fairly bad way. It feels relatively inelegant, so I'll take suggestions on how to revise it if possible.

 

I transform the hex integer into a boolean array, then build an 8x8 array which I replace the first column with to create a numeric array of 1's and 0's (like a boolean array but numeric).

 

I also add a start bit and stop bit (start bit = 0, stop bit = 1) to the array, because I will be emulating a serial protocol, and then use the Digital 1D U8 1Chan NSample VI to transmit to one line. It seems to work, but I feel it's kinda hack-y.

 

I managed to fix the problem with the sampling clock by swapping to the onboard clock of the pcie-6536. I've attached my code if someone would like to refer to it.

0 Kudos
Message 5 of 7
(5,199 Views)

Hi,

 

I've just been thinking about trying exactly what you're doing to control a system which needs both DAQ and serial communication.

 

Could you save your VI back to LV 8.6? We've not made the leap to the new version yet.

 

Thanks

 

Paul

0 Kudos
Message 6 of 7
(5,125 Views)

Hi Paul,

 

Sorry I missed your reply earlier. It's not so much that the system needs both DAQ and serial communication, rather that chip I was communicating with uses a non-standard single-wire serial interface. Prior trawling of the forums pointed me in the direction of using DAQmx.

 

It's alright though, I've since moved on to using another chip which has a more standard serial interface (SPI and I2C). I'm now having a bit of a headache trying to figure out how to extract data from multiple chips at the same instance in time though.

 

I've attached the .vi file which I think is now saved for version 8.6 if you still wish to take a look.

 

Thanks,

Gabriel

0 Kudos
Message 7 of 7
(5,104 Views)