Discussion:
100 microseconds pulse using PCI6533
(too old to reply)
Fvalenzu
2007-10-22 22:10:06 UTC
Permalink
Hi Everyone,
 
I need to generate a 100uS pulse using PCI6533 on each of its 3 ports.  After generating the first pulse on port A0 (DIOA0), then generate the second pulse on DIOA1 after a delay of 100ms, third on DIOA2 and subsequent pulses until DIOC7.  Basically, a pulse of 100us followed by a delay of 100ms then repeats again on each digital line of PCI6533's ports.
 
Could anyone point me to a link or sample code that I could utilize to generate these pulses?
 
Thanks very much,
 
Frank
 
Fvalenzu
2007-10-23 04:10:06 UTC
Permalink
Thanks Ravens Fan,
Do you happen to have a simple code to start with and then I could expand from that.  Thanks again,
Frank
 
Fvalenzu
2007-10-23 21:10:10 UTC
Permalink
Thanks jaced,
 
I have modified one of the NI samples (Write Dig Port) and now I can create a 100us pulse on each line of each port independently (one at the time).  However, I have run this code 1000 times to verify repeatabilty and accuracy (using a for loop) and I found that the pulse width varies from 100us up to 175us.  Is there a better way to make sure that this timing is more accurate?  Please see attached code for more details.  Thanks,  Frank.
 
 


Write Dig Chan-Ext Clk_Test.vi:
http://forums.ni.com/attachments/ni/170/279870/1/Write Dig Chan-Ext Clk_Test.vi


100uSPulse.gif:
Loading Image...
Fvalenzu
2007-10-23 21:10:09 UTC
Permalink
No problem Ravens Fan . . .your previous input is appreciated.  Thanks,
 
Frank
 
Fvalenzu
2007-10-23 21:10:11 UTC
Permalink
My apologies on above reply . . . The previous attached vi is incorrect.  Here is the correct vi sample that matches above picture:
 


Write Dig Port_100usPulseTest.vi:
http://forums.ni.com/attachments/ni/170/279874/1/Write Dig Port_100usPulseTest.vi


100uSPulse.gif:
Loading Image...
Ravens Fan
2007-10-23 21:40:05 UTC
Permalink
The problem with this VI is that it is software timed, and in reality there is no timing functions in the code so it just executes however fast it can.  On a faster or slower PC, the execution rate would change.  The "wrong" VI in the previous post is probably more in line with what you want.  (I have no way of testing it.)
Create a waveform that has a dt of 100 usec.  The waveform data would be a single sample of true followed by 999 falses.  This should create a 100 ms second long waveform with a 100 usec pulse at the beginning.  (For other waveforms, shift the location of the True.)  Set the clock sample, write the waveform, then start.  So now you have the writing of a waveform and write it 10 times.
Fvalenzu
2007-10-23 22:40:09 UTC
Permalink
Ravens Fan,
I have tried different changes, but not able to get good results.  Would you mind to modify above vi per your comments and I will do the test and advise results.  Thanks,
Frank
 
Ravens Fan
2007-10-24 19:10:07 UTC
Permalink
I was able to create a VI that could handle one line based on the External clock VI you had above.  When I tried expanding it to multiple lines, it gave me an error that said  Error -200463 occurred at DAQmx Write (Digital 1D Wfm NChan NSamp).vi:1
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: 1Number of Lines in Data: 8
Task Name: _unnamedTask<34>
This didn't make sense because I had 8 lines in the physical channel  input to the Daqmx Vi   Dev1/port0/line0:7


Write Dig Chan-Ext Clk_Test MOD.vi:
http://forums.ni.com/attachments/ni/170/280121/1/Write Dig Chan-Ext Clk_Test MOD.vi
Ravens Fan
2007-10-24 22:10:06 UTC
Permalink
Okay try this.  For some reason when I saved it back it through up some erros about the boolean to digital waveform (7.1 doesn't have a sample rate input???)  and an insane object.  It did not like the the digital waveform graph it created.  So I deleted that.  The waveform that came out had a dt of 1 (rather than .0001 in my LV 8.2 system)  It may be necessary to redo some code to fix the dt and add a waveform graph.
I had issues with trying to do multiple lines as I stated before.  But if you can get the concept working with a single line, then that is one step down and a matter of expanding it to more lines.  If things don't work and you post more questions, be sure to include error codes and any messages you get.
Unfortunately, I am about to the limits of how much I can help due to my knowlege of digital waveforms running out, and also the time I need to commit to other work.
Good luck!


Write Dig Chan-Ext Clk_Test MOD.png:
http://forums.ni.com/attachments/ni/170/280169/1/Write Dig Chan-Ext Clk_Test MOD.png


Write Dig Chan-Ext Clk_Test MOD 71.vi:
http://forums.ni.com/attachments/ni/170/280169/2/Write Dig Chan-Ext Clk_Test MOD 71.vi
Fvalenzu
2007-10-25 00:40:07 UTC
Permalink
Ravens Fan. . . Thanks very much for your time and proposed solution.  I tried several changes but I could not make it work yet.  One of the errors that I got is the same as you have mentioned before:
Error -200463 occurred at DAQmx Write (Digital 1D Wfm NChan 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: 1Number of Lines in Data: 8
Task Name: _unnamedTask<3B6>
However I have looked at link mentioned by JaceD and I was able to get 100uS pulses on P0 and P2 for each individual lines (16 lines).  But still I need to find solution for all 32 lines.  Please see reply to JaceD for more details.  Thanks again for your help.
Frank
 
 
Fvalenzu
2007-10-25 01:10:05 UTC
Permalink
JaceD,
Thanks for this info and I have been able to generate 100us pulse on each line of port0 and port2.  I can generate 100us pulse on one, 2, 3 or all 8 lines for each port; but I need to still generate 100us pulse on all 32 lines.  Could you please look at this modified vi and see if you could suggest some changes to make it work for all 4 ports (A,B,C,D).  Thanks,
Frank,
 
 


Cont Write Dig Port-Ext Clk_P0_Working.vi:
http://forums.ni.com/attachments/ni/170/280201/1/Cont Write Dig Port-Ext Clk_P0_Working.vi


100us Pulse.gif:
http://forums.ni.com/attachments/ni/170/280201/2/100us Pulse.gif
Fvalenzu
2007-10-25 21:10:25 UTC
Permalink
Thanks Jaced,
However I have tried your suggested approach I can not make it work quite right.  Here is my latest vi with 2 channels P0 and P1 (only two rows and 16 columns).  Could you please modify this vi with your suggested approach and I will transfer your solution to the 32 lines version (I am using LV7.1).
I don't quite understand your comment "specify which lines to write to use the format of Dev2/Port0/line0:1,Dev2/Port1/line0:1, etc. "   When I tried it gives me the following error:
Error -200898 occurred at DAQmx Write (Digital Wfm 1Chan NSamp).viPossible reason(s):
Measurements: Partial use of physical lines within a physical port is not supported by this device, given the requested Sample Timing Type.
Consider specifying the entire port and tristating the lines you do not want driven.
Property: SampTimingTypeRequested Value: Sample Clock
Output Channels: Dev2/port0/line0...
Therefore it will be better if you could include a sample of how to do this on this attached vi.  This is my first time that I am using this type of hardware and I am not very familiar with its commands or functionaliity.  Thanks again for you help on this matter,
Frank
 


100uSPulseP0_and_P1.gif:
Loading Image...


Cont Write Dig Port-Ext Clk_P0_and_P1_Working.vi:
http://forums.ni.com/attachments/ni/170/280431/2/Cont Write Dig Port-Ext Clk_P0_and_P1_Working.vi
Ravens Fan
2007-10-25 21:40:06 UTC
Permalink
I am curious to see how all of this turns out hoping to learn more about digital input and output in the process.  All of the digital input and output I have done to date has been single sample or line.  Turn on or off a line when desired to drive a single relay.  DIO seems almost more complicated than analog in that it can refer to individual lines, ports as a collection of lines, perhaps even ports strung together.  I can only work with simulated devices in figuring this out, and it seems like different devices have different ways of calling their lines and ports.  Your posted example seems to reflect this as it now says "Dev2/port0_16" which is different from Jaced's channel.  But that was more like what you had in your reply 7 VI as "Dev1/port0/line0:7"
I tried playing with simulated devices at home last night.  At first I thought I was making progress, but them I got error messages about the device not supporting SIMD extensions.  There is such a combination of clock lines and names, port names, line names etc.  I can understand why it is a struggle to get this working right.
With respect to your last e-mail, I saw that Jaced had said"
"specify which lines to write to use the format of Dev2/Port0/line0:1,Dev2/Port1/line0:1, etc."  I think that is causing the error you are seeing because it is calling out only two lines one each port.  Try it with line 0:7 rather than 0:1
Fvalenzu
2007-10-25 22:10:06 UTC
Permalink
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).viPossible 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: 8Number 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
 
 
 
 
 
 
Ravens Fan
2007-10-26 00:10:05 UTC
Permalink
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.
<img src="Loading Image...">
Edit:&nbsp; That constant of 100 in the loop should actually be 1000 and the 1600 outside of the loop should be 16000!&nbsp; 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.&nbsp; Hopefully this will give you the idea.Message Edited by Ravens Fan on 10-25-2007 07:46 PM


Create Boolean Array.png:
http://forums.ni.com/attachments/ni/170/280457/1/Create Boolean Array.png


Create Boolean Array.vi:
http://forums.ni.com/attachments/ni/170/280457/2/Create Boolean Array.vi
Fvalenzu
2007-10-26 18:10:06 UTC
Permalink
Ravens Fan,
&nbsp;I have tried above solution with different combinations/configurations but still does not work:
&nbsp;
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: 1Number of Channels in Data: 1600
In addition I changed rows and columns but still not success.&nbsp; Unfortunately there a so many combinations to select that it is very difficult to find the right solution
&nbsp;
Please see attached updated vi. Thanks again for your help,
&nbsp;
Frank
&nbsp;


Cont Write Dig Port-Ext Clk_P0_and_P1_NotWorking.vi:
http://forums.ni.com/attachments/ni/170/280622/1/Cont Write Dig Port-Ext Clk_P0_and_P1_NotWorking.vi


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


Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_NotWorking[1].png:
http://forums.ni.com/attachments/ni/170/280631/1/Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_NotWorking[1].png
Fvalenzu
2007-10-26 21:10:05 UTC
Permalink
Ravens Fan,
&nbsp;
It&nbsp;works! . . . I made all changes&nbsp;you&nbsp;suggested and It generates a pulse of 100us on P0 line 0 -only.&nbsp;&nbsp;What changes&nbsp;do I need to do to make to&nbsp;cycle thru both ports (0 and 1) at each line (100us pulse (on) 100ms (off)).&nbsp; Running this vi it only generates a pulse on P0-line 0.&nbsp; Or may be I don't quite understand this approach.&nbsp; Could you please expand some more?
&nbsp;
Great progress!&nbsp; Thanks again,
&nbsp;
Frank
&nbsp;
&nbsp;
Fvalenzu
2007-10-26 21:40:08 UTC
Permalink
Ravens Fan,
Here is the latest vi, sa,e as yours:&nbsp; Frank
&nbsp;


Cont Write Dig Port-Ext Clk_P0_and_P1_WorkingNew.vi:
http://forums.ni.com/attachments/ni/170/280674/1/Cont Write Dig Port-Ext Clk_P0_and_P1_WorkingNew.vi


100uSPulseP0_and_P1(3).gif:
Loading Image...
Ravens Fan
2007-10-26 22:10:05 UTC
Permalink
For the challenge, the comparable as my last post with 1 for loop.&nbsp; Not as simple as I would have thought!
<img src="Loading Image...">
Message Edited by Ravens Fan on 10-26-2007 06:02 PM
Frank,&nbsp; I noticed something!
The sample clock is finite samples.&nbsp; The samples per channel is unwired, but the default is 1000.&nbsp; Try either continuous samples. or wiring in the 16000 to that samples per channel&nbsp;terminal and see what happens.&nbsp; I'm thinking the clock only ran for 1000 samples, which is just long enough for the first channel's cycle.&nbsp; The task ended right before the 2nd channel would have started because the clock ran out of samples.Message Edited by Ravens Fan on 10-26-2007 06:06 PM


Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_Working 2.png:
http://forums.ni.com/attachments/ni/170/280685/1/Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_Working 2.png
Fvalenzu
2007-10-30 22:40:09 UTC
Permalink
Ravens Fan,
I played with both above proposed solutions but could not get the right results.&nbsp; It looks like the maximum number of columns is 320 and 40 as the multiplier.&nbsp; If I use any number greater than these numbers then I do not get any signals on the last line P1-7.&nbsp; Please see attached picture for more details.
However I found a solution that is working by using a software delay (~100ms) and a precise pulse of 100us.&nbsp; Please see attached picture for more details (vi also included).
I am not sure if there is an issue with LV or this card or maybe I could not find the right combination of options to make your proposed solutions to work.
At the same time I am really disapointed with NI's application engineers, by&nbsp;not helping in this situation.&nbsp; I think there area many people out there that could utilize this type of information.
Anyway, thanks very much for you help and time on this matter,
Frank
&nbsp;


Cont Write Dig Port-Ext Clk_P0_and_P1_WorkingNew2b.vi:
http://forums.ni.com/attachments/ni/170/281381/1/Cont Write Dig Port-Ext Clk_P0_and_P1_WorkingNew2b.vi


100uSPulseP0_and_P1(4).gif:
Loading Image...


100uSPulseP0_and_P1(5).gif:
Loading Image...
Fvalenzu
2007-10-31 20:40:07 UTC
Permalink
Ravens Fan,
I did not get any errors, I just think&nbsp;is not possible to create a delay&nbsp;of&nbsp;25ms or more using this approach. I have tried many variations and at this point I am running out of time to complete this project.&nbsp; I have attached a simplified&nbsp;approach, that creates a precise 100us pulse &nbsp;with a software delay of 100ms.
Thanks again for you help on this matter.&nbsp; Your input and ideas allowed me to understand and develop this and all previous code.&nbsp; I really appreciate your time and effort to this issue. :smileywink:
Frank
&nbsp;


Generating100usPulse_P0_P1.zip:
http://forums.ni.com/attachments/ni/170/281656/1/Generating100usPulse_P0_P1.zip


100uSPulseP0_and_P1(6).gif:
Loading Image...
Ravens Fan
2007-10-26 22:10:05 UTC
Permalink
Now I'm really getting stumped.&nbsp; I noticed you added a constant of one channel for all lines that wasn't there before.&nbsp; But I saw this is the default for that VI, so I don't think this is any real difference.&nbsp; 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.&nbsp; I give up!
I did come across 1 way to make that setting work, see the attached picture.&nbsp; (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.&nbsp; Switch it back to 16000 and 1000 for your final code.)&nbsp; 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.&nbsp; 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.&nbsp; :smileyvery-happy:
<img src="Loading Image..."> Message Edited by Ravens Fan on 10-26-2007 05:53 PM


Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_WorkingNew[1].png:
http://forums.ni.com/attachments/ni/170/280683/1/Cont%20Write%20Dig%20Port-Ext%20Clk_P0_and_P1_WorkingNew[1].png
Continue reading on narkive:
Search results for '100 microseconds pulse using PCI6533' (Questions and Answers)
3
replies
what is the slot time in half-duplex ethernet timing??
started 2006-09-18 04:18:04 UTC
computer networking
Loading...