Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-6541 dynamic generation pattern problems

I am learning how to use the PCI-6541 and have a few questions about the dynamic generation mode.  I'm working with the example Dynamic Generation.vi, which outputs a waveform that is a counting pattern 256 samples long.  I have selected 5 channels (2 - 6) for the channel list and a clock frequency of 50 MHz.
 
Number of Samples: If I probe the output, I only see the count pattern reach 64, not 256.  If I change the number of samples to 128, I see the pattern read 32.  It seems as if each sample is being held for 4 clock cycles or something like that...  When I input an array that alternates between 11111 and 00000, the number of samples output equals the number of samples in the array.  Does anyone know what is happening with the number of samples in the example VI?
 
Missing Pattern: While the counting pattern showed up on all 5 channels, my array of alternating 1's and 0's only shows up on the lower 3 channels.  Why would the pattern be missing on some channels?
 
Channel Assignment Order: Finally, I thought that writing "2 - 6" versus "6 - 2" in the channel list would change the order in which the pattern was output, but this does not seem to be the case.  Outputting 10000 with the two different channel assignments changes nothing: channel 2 is always a 0 and channel 6 is always a 1.  Was I mistaken in my initial assumption?
 
Thank you very much for your assistance with these questions.  Some cards have a larger learning curve than others, and for me this is one of them...
 
Regards,
MLloyd  Robot tongue
0 Kudos
Message 1 of 4
(3,301 Views)


Missing Pattern: While the counting pattern showed up on all 5 channels, my array of alternating 1's and 0's only shows up on the lower 3 channels.  Why would the pattern be missing on some channels?
 
Channel Assignment Order: Finally, I thought that writing "2 - 6" versus "6 - 2" in the channel list would change the order in which the pattern was output, but this does not seem to be the case.  Outputting 10000 with the two different channel assignments changes nothing: channel 2 is always a 0 and channel 6 is always a 1.  Was I mistaken in my initial assumption?

I'm in the lab again and found the the missing pattern problem was solved when I output "1111100" and "0000000".  From this I can conclude that the channel assignments are "hard-coded" -- that is, that if I want to output a 1 on channel 10, I have to put a 1 in the 10th bit of the output value.
 
This also answers the channel assignment order question that I had.  I see now that I was mistaken in my interpretation of how the 6541 card works!
 
I am still in a quandry about the number of samples in the example VI...  Any insight would be greatly appreciated!
 
Regards,
MLloyd  Robot Happy
 
0 Kudos
Message 2 of 4
(3,297 Views)
MLoyd,

You are exactly right.  The example program you are using ("Dynamic Generation.vi") uses the U32 version of the "niHSDIO Write Named Waveform" function.  When in this configuration, each bit in the U32 word corresponds to a specific channel.  That is, bit 0 corresponds with channel 0, bit 23 with channel 23, etc.  If you want to write to channel 10, you need to put a 1 or 0 in the 10th bit of the U32 data point.  When you set your channel list to be 2-6, the NI 6541 will only enable the outputs of those channels but since the waveform was written using the U32 function, the lower bits of the count will start on channel 0.  If, instead, you used the waveform data type (WDT) version of the function to write a digital waveform rather than the raw U32, channel order will be associated with how the WDT is created.

This relates back to your question about "Number of Samples".  If the code is generating a count from 0 to 256 using the U32, then the count will be presented on bits 0 to 7 of the U32 (channels 0 to 7).  However, if you ignore bits 0 and 1  when you measure it then you will get the observed divide by 4 effect.  Since channel 0 is your LSB, it is toggling the fastest.  Channel 1 toggles at half the rate of channel 0 and channel 2 toggles at half the rate of channel 1.  In this fashion, if you are only probing from channel 2 up to 6, you are essentially ignoring the count of the two most LSB and you get the results you have witnessed.

If, you do a logical shift on the data array by 2 then you will shift bits from 0 to 4 into bit positions 2 to 6.  Now, when you run the program and probe on the channels 2 to 6, the LSB of your data pattern is being generated on channel 2 so you'll better measure the full count.

I hope this helps!  Happy Holidays.

Message Edited by Ryan M on 12-20-2005 04:59 PM

Message 3 of 4
(3,296 Views)
Ryan,
Thank you for the insight into how this board works!  I will check into the WDT data type...  I have not worked with it previously, but it sounds like it might do what I am trying to do a little more easily.
 
Happy Holidays to you as well,
MLloyd  Smiley Happy
0 Kudos
Message 4 of 4
(3,279 Views)