LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

100 microseconds pulse using PCI6533

Ravens Fan,

I tried per your sugestion with line 0:7 and it gives me another error:

Error -200463 occurred at DAQmx Write (Digital Wfm 1Chan NSamp).vi
Possible reason(s):

Measurements: Specified read or write operation failed, because the number of lines in the data for a channel does not match the number of lines in the channel.

If you are using the Digital Waveform datatype, make sure the number of lines in the digital waveform matches the number of lines in the channel. If you are using boolean data, make sure the array dimension for lines in the data matches the number of lines in the channel.

Number of Lines in Channel: 8
Number of Lines in Data: 16

Task Name: _unnamedTask<59D>

 

I think the reason is because I am using Dev2/Port0_16 which means P0 and P1, a total of 16 lines.  . .

I got this far and is working fine, I only need an example from Jaced as to how to call these port's lines one at the time so that I can send a 100us pulse at port0 line 0; then another pulse to P0 line 1, P0 line 2, and all the way to P1 line 8 (per previous attached vi).  The time in between pulses is not critical as a software delay (~100ms) will be fine.  Right now I can do this by manually selecting the proper bolean array position and then running this vi.   The question is how to do it programmatically?  Jaced has suggested a viable approach but I don't quite understand how to do it per his instructions.  Hopefully he will post a modification to my last attached vi.  Thanks,

Frank

 

 

 

 

 

 

0 Kudos
Message 21 of 37
(1,581 Views)

I meant the control input would be Dev2/Port0/line0:7,Dev2/Port1/line0:7.  That should be 16 lines.  But I don't have a way to verify if that syntax would work.  If Dev2/Port0_16  (or would it be 0-15?) works that's great.  Like I said before, it gets really confusing as to the different ways these lines can be addressed.


@Fvalenzu wrote:

The time in between pulses is not critical as a software delay (~100ms) will be fine.  Right now I can do this by manually selecting the proper boolean array position and then running this vi.   The question is how to do it programmatically? 



As I understand, you want a 100 microsecond pulse on line 0, wait 100 msec.  Then a 100 microsecond pulse on line 1, wait 100 msec, 100 microsecond on 2, etc through your 16 lines.  The boolean array creates your waveform for each line.  Column 0 is for line 0, column 1 is for line 1,  ....  Each row represents a given instant in time.  So if the waveform is set up with a 100 microsecond dt, then row 0 would be the first 100 usec, row 1 would be the next.

I am going to assume that we are working with 1 100 msec period with each data point being 0.1 msec (100 usec). with a pulse on a given channel for 1 sample, then turned off for the next 999  (the math is easiest as opposed to a 1000 sample off time.)  Then repeat for the next channel.  So what you need to do is build a boolean array with  16 columns, and 16000 rows full of falses, then replace given elements with a true according to that pattern.  You do that once at the beginning of the program and feed the results into the boolean/digital waveform conversion and ultimately into the write VI.  The earliest LV version I have at home is LV8.2 so I will attach that.  But it is simple code so I will attach a screenshot.

Now it is possible I got the rows vs. columns mixed up in this array as to what relates to channels vs. samples.  So if that is the case, a transpose array, or just reworking the code to swap column vs. row inputs should work.  Don't forget to set the sample rate and/or dt so that a single value represents 100 microseconds.


Edit:  That constant of 100 in the loop should actually be 1000 and the 1600 outside of the loop should be 16000!  I wrote the code before I reread the message and saw the 0.1 ms to 100 msec ration which is 1:1000 rather than 1:100.  Hopefully this will give you the idea.

Message Edited by Ravens Fan on 10-25-2007 07:46 PM

Download All
0 Kudos
Message 22 of 37
(1,571 Views)
Ravens Fan,
 
I have tried above solution with different combinations/configurations but still does not work:
 
Error -200524 occurred at DAQmx Write (Digital 2D Bool NChan 1Samp NLine).vi
Possible reason(s):
Measurements: Write cannot be performed, because the number of channels in the data does not match the number of channels in the task.
When writing, supply data for all channels in the task. Alternatively, modify the task to contain the same number of channels as the data written.
Number of Channels in Task: 1
Number of Channels in Data: 1600
In addition I changed rows and columns but still not success.  Unfortunately there a so many combinations to select that it is very difficult to find the right solution
 
Please see attached updated vi. Thanks again for your help,
 
Frank
 
0 Kudos
Message 23 of 37
(1,545 Views)

Jaced,

Ravens Fan and I still having issues to try to make this code work.  Could you please give us a hand?  Thanks,

Frank

0 Kudos
Message 24 of 37
(1,545 Views)
It seems like when you make one change to the code, you are making some other changes that complicate the issue.  For example:
 
1.  You now have a DAQmx configure output buffer that I don't remember seeing before.  Maybe it is necessary, but I don't remember Jaced's examples having it.  (Actually some of Jaced's examples have had some more complicated clock structures.)
 
2.  That configure buffer and the DAQmx Sample clock have constants for 2 samples per channel.  We are looking for 160000 samples per channel  (Make the 1600 a 16000 and the 100 in the loop a 1000 like I said in my edited message before.)
 
3.  You were using a boolean array to digital waveform.  I would recommend feeding the boolean array into that.
 
4.  Before the  DAQmx write was Digtial waveform 1 channel N samples (perhaps N channels N samples for the multiple channels), but now you have 2D boolean N channel 1 sample.  I would continue to use the digital waveforms since it seemed you had that working to some extent before.  I don't know if the 2 samples per channel stuff is somenow restructuring the array data.
 
I would back track and set up an 8 channel (single port) like you were doing before with Dev1/port0/line 0:7.  Set up a 8 channel by 8000 sample array that gets converted to a digital waveform like before.  Try to get that working.  Then you can work on what is needed to do multiple port lines.  It may even be necessary to set up multiple tasks, one for each port, and have them triggered to start simultaneously.
 
It sounds like you have had some successes here or there.  And you are right that there are so many combinations that it complicates things.  But I would try to change only one thing at a time and advance on what works.  It seems like you have changed other things as well and I'm not sure why.  Smiley Happy
Message 25 of 37
(1,536 Views)
This code seemed to run for me without errors.  This was a simulated PCIe-6536.  I couldn't find a simulated PCI-6533 in MAX.  I did find a simulated PXI-6533 and that seemed to work with the same code.  It also seemed to work when I put in PXI1Slot2/port0/line0:7,PXI1Slot2/port1/line0:7 in the channels control.  Also Dev2/port0,dev2/port1,Dev2/port2 worked for 24 channels.

Message Edited by Ravens Fan on 10-26-2007 02:58 PM

Message Edited by Ravens Fan on 10-26-2007 03:01 PM

Message 26 of 37
(1,533 Views)
Ravens Fan,
 
It works! . . . I made all changes you suggested and It generates a pulse of 100us on P0 line 0 -only.  What changes do I need to do to make to cycle thru both ports (0 and 1) at each line (100us pulse (on) 100ms (off)).  Running this vi it only generates a pulse on P0-line 0.  Or may be I don't quite understand this approach.  Could you please expand some more?
 
Great progress!  Thanks again,
 
Frank
 
 
0 Kudos
Message 27 of 37
(1,517 Views)

I'm glad to hear progress is being made.  Can you post this latest VI?  Of course make sure any controls or indicators have their latest values saved by doing a "Make current values default" from the Edit menu before saving.

One thing that has worried me that even if the code runs without errors, that the real hardware may behave different from the way I think it would.  Does the bit pattern that gets turned into a digital waveform ultimately trigger the digital lines like I would think?  I know that you can write to ports by using writing U8 values.  So writing a 255 would turn on all lines.  Writing a 128 would turn on lines 0 and 7.  Stuff like that.

But before we get into anything like that which would be a different programming path, please post what you have now.

0 Kudos
Message 28 of 37
(1,512 Views)

Ravens Fan,

Here is the latest vi, sa,e as yours:  Frank

 

0 Kudos
Message 29 of 37
(1,506 Views)

Now I'm really getting stumped.  I noticed you added a constant of one channel for all lines that wasn't there before.  But I saw this is the default for that VI, so I don't think this is any real difference.  I tried changing that to one channel for each line, but am really struggling getting the right combination of waveforms, arrays, 1-D vs. 2-D to get it to wire correctly, or if it does wire, then it throws an error saying the task is 16 channels but the data is only one.  I give up!

I did come across 1 way to make that setting work, see the attached picture.  (For argument's sake, I made the data 160 samples at the front, and a constant of 1 in the loop just to make it easier to see the display on the front panel arrays.  Switch it back to 16000 and 1000 for your final code.)  Maybe having it go in as individual waveforms will make it behave the way you want.

If this doesn't work, perhaps Jaced is following and can provide any insight to your latest code.

Note: It is Array Subset in that new For loop, the i is wired to the 3rd terminal and the constant 1 is wired to the last.  And for the purists out there, I am sure this can be combined with the first for loop, but for incremental programming attempts (building on something that works without changing too much) this is what you get.  Smiley Very Happy

Message Edited by Ravens Fan on 10-26-2007 05:53 PM

0 Kudos
Message 30 of 37
(1,497 Views)