06-08-2010 02:49 PM
Digital waveform generator has 8 channels. I need to generate two different signals to HSDIO. How to modify and control two different channels? Also, how to translate pin outs from PXI-6541 to channels? I need to control signal into pin 1,3,29,and 31 individually.
Thank you!!
Solved! Go to Solution.
06-08-2010 03:45 PM - edited 06-08-2010 03:49 PM
You need to create a 1D array of U8. The first LSB bit (D0) of each element will go out on the first channel specified. The next bit (D1) will go out on the second channel. NI's website should have a document showing the pin out and what channels they belong to. Search for PXI-6541, then look at the data sheets, spec sheet, etc until you find the document with the connector on it. Its there somewhere.
06-08-2010 03:53 PM
06-09-2010 10:33 AM
I couldn't do what you did in the binary display part with array. But I found DWDT U32 binary to digital.vi to convert individual binary to digital signal. I am not sure how to combine them together and feed them into HSDIO write name waveform.vi as separate channels.
Thank you for your help very much!
06-09-2010 12:39 PM
You must combine your individual data into an array. The digital waveform is simply a digital representation of the binary array. It still boils down to bit 0 of each array element going to channel 0 (or the first channel you specify in Create Dynamic Channels). The next bit goes to the next channel. My last post is quite clear. To display the array in binary, right click on an array element, then select Display Format, then select Binary. You can also right click on the element, select Visible, then select Show Radix to display the small b before the number. One more thing, in the Display Format window, uncheck the box next to Use minimum field width. Then set the numeric just under the box to 8. Then select Pad with zeros on left in the box below.
You should not use waveforms until you learn more about how the HSDIO operates on input data. It isn't hard to combine waveforms, but it also isn't as clear as using an array of U8 or U16 or U32.
Trying to explain further. The first number to be writen to the HSDIO will have this effect: Bit 0 (LSB) of the number gets written to the first HSDIO channel you specify. Bit 7 goes to the 8th channel you specify. If you don't specify 8 channels, the bits get ignored. So wiring in one number will produce only one bit on each channel. In other words, the number already combines the bits of all the channels you specify. You don't combine anything yourself. Look again at my picture on my last post. By wiring in an array, you cause a bit pattern to be generated.
I hope this is more clear.
06-09-2010 02:39 PM
thank you for your help. It works. I also need to put 3ms interval between two signals. It means once first signal goes from one to zero, the second signal has to wait for 3ms for it to go from zero to one. Is binary still applicable in this case? I also need to control the frequency and number of cycle for both signals, does binary array still work here and how?
Thank you!
06-09-2010 03:25 PM
If the frequency and number of cycles must be different for both signals, you would be better off creating two threads, one for each signal. Then you could set the frequency and number of cycles separately. You write data would be an array of 0s and 1s if you are only controlling one channel per thread. Only the LSB counts. See the picture:
06-09-2010 04:33 PM
There is an error message saying that "niHSDIO Close.vi<ERR> The session handle is not valid" at the second Close end. I don't know why there's no error for the first Close end. Even though they are the same, except for time delay. I tried to set time delay to zero to make both signal the same, the same error message still exist.
Please help me to explain this, thank you very much!
06-09-2010 05:08 PM - edited 06-09-2010 05:14 PM
I could not try it here because I don't have an HSDIO setup. But I think it is because there is only one HSDIO device, even though there are two sessions. I have only one HSDIO init, at the beginning. The session number is the same for both threads. So only one Close function is needed. Delete one of them, any one. Keep the Error Outs going to the Merge Error. I'm sorry I didn't catch that mistake.
Besides that, is it working like you want it to?
Edited: I just thought of something. Change the order of Close and Merge Errors. Put Merge Errors after the Wait function for both threads. Wire the Error from Wait for both threads to the Merge. Then put the Close function. Wire the Error out from Merge to Error In for Close. Wire session out from any of the Waits to the Close session in. This will force the two threads to become one before the Close.
06-10-2010 12:46 PM