6602 Synchronize 4 outputs by matlab

Hello,
I am trying to use PCI-6602 counters to generate 4 pulses that start together. The width of these 4 pulses are ms level. However, the delay between channels is ms level too. So how to synchronize trigger the start and stop of 4 channels (with different duty cycle) by matlab?  
I tried to use an external signal to trigger 4 channels together buy using 'addTriggerConnection', 'External' as source. But it didn't work. Matlab said Trigger and clock connections will not affect counter output channels.
And how to connect wires?
Thanks. 

Hi Lindsay,
If you are using the MATLAB® Data Acquisition Toolbox™ to program the PCI-6602, please contact the MathWorks support team since they will be better suited to answer MATLAB programming questions.
To accomplish this in LabVIEW and our NI-DAQmx driver, you can use the information in these documents:
Using a Digital I/O Line as the Start Trigger with a PCI-6602 (you don't have to wire any external lines)
http://digital.ni.com/public.nsf/allkb/9052D691C228A56686256CFB00611D0D
Timing and Synchronization Features of NI-DAQmx (If you want to use an external line, take a look at Figure 4)
http://www.ni.com/white-paper/4322/en/
MATLAB® and Data Acquisition Toolbox™ is a registered trademark of The MathWorks, Inc.
Sincerely,
Aldo A
Applications Engineer
National Instruments

Similar Messages

  • 6602 Synchronize ALL 8 outputs without external signal?

    Howdee all..
    I have an application that's actually pretty simple.  I need to generate pulse trains on all 8 counters of a 6602, and they need to be triggered together via a software trigger (Frequency will be the same, but their delay/Phase and DC may be different channel to channel).
    What's the best way to do this?
    Can I set them all up under the same task and then call "Start"?
    What about using the output of one counter to trigger the others?  That output MUST be available as an output signal though.  But I can set things up so that it's initial swing is used to start the task.
    Does it make sense to physically connect PFI0 to PFI1 and then trigger them off PFI1 using PFI0 as the signal?
    Just a reminder, I am using all 8 counters as output.

    Hi Marcus,
    Right now the code I wrote looks like this (all counters are on the same 6602 card..)...
    This appears to work, but I can't be sure that the counters all started together without a scope.  So the $64K question is, since they are all on the same card, does the code above start all the pulse trains instantaneously, or will I have to go back and set them up to use a digital trigger (and do that thing with the PFI lines)?
    As for the other example...
    https://decibel.ni.com/content/docs/DOC-11755

  • Output to matlab client wiindow

    Hello!
    Does anybody know how to output in the Matlab command window?
    Matlab code:
    disp('Hallo.......')
    does not appear in the client window but is a well known Matlab command for outputing.
    Thanks for helping
    Andi

    I am not able to use sprintf(), fprintf(), or disp() commands in the MATLAB command window, however there is an undocumented feature (or a bug) that allows the input() command to display to the MATLAB command window, _only_ once one input has been accept (for which there was no prompt). In other words, if you have a program with two calls to the input() command (from inside LabVIEW's MATLAB Scripting Node), the _first_ call to input() will show no output, but it will wait for your input at the MATLAB command window. After you enter something, the _second_ call to input() will display its message. All subsequent calls to input() will also display their prompt.
    The attached code demonstrates the above. This bug in the MathScript node has two features in my mind: 1) it allows the user to enter information at the MATLAB command window, and 2) if you are content to hit "enter" every time, it will print debug messages to the MATLAB window.
    A possible alternate workaround is to have MATLAB pop up a figure window, which you can than print text to, or put buttons or string/number inputs on.
    Attachments:
    getting input from matlab command window example.vi ‏10 KB

  • How to display error messages and output from Matlab (which Matlab would typically send to its command window but no longer does when called by Labview) into Labview or allow it to be dumped into Matlab Command Window?

    Using Labview 6i and Matlab 6.1. I want to be able to see Matlab warnings and error messages either in the Matlab Command Window or in Labview itself. Currently Matlab is called by Labview (which is working). However I would like to debug and/or modify my Matlab script file to better understand how the two programs are interfacing. It is difficult since no data or messages can be displayed currently to the Matlab command window. I would like to change that if it is possible - Labview is suppressing that from happening. If not possible to send these
    messages to Matlab Command Window can I make it at least possible to see Matlab's actual warnings and/or error messages in Labview?

    I don't think you can debug your Matlab script from labVIEW. The following webpage talks about this:
    http://digital.ni.com/public.nsf/3efedde4322fef198​62567740067f3cc/19106e318c476e608625670b005bd288?O​penDocument
    My suggestion would be to write a script in Matlab and thoroughly test it before calling the script from a Matlab script node in LabVIEW.
    Chris_Mitchell
    Product Development Engineer
    Certified LabVIEW Architect

  • I need tips on programming a 6602 counter/timer

    I am new to Labview but have been a command line programmer for some time.  I have a 6602 card in a PXI system.  I would like to use the internal clock of the 6602 to control the delivery of triggers to various instruments.  These triggers need to be both user inputted and optionally scanned in time.  Eventually, I will trigger the 5112 NI scope board to recieve signal and plot to the screen. 

    Darrin,
    There are a lot of terrific LabVIEW examples that ship with the
    NI-DAQmx driver that are compatible with the PXI-6602.  These
    include counter examples as well as pulse train generation
    examples.  For example, some of these that would be great to looks
    at can be found by opening the NI Example Finder (Help >> NI
    Example Finder).  Under the Browse tab, navigate to Hardware Input
    and Output >> DAQmx >> Generate Digital Pulses.
    There are also shipping examples that show how to use a common signal
    between boards.  Most of these examples share clocks, but you
    could also apply this to triggering.  These are found in: Hardware
    Input and Output >> DAQmx >> Synchronization >>
    Multi-Device and Hardware Input and Output >> DAQmx >>
    Synchronization >> Multi-Function
    There are also a lot of great examples, DevZone posts, and tutoirals
    that you can find on our website by searching for various keywords like
    6602, synchronization, triggering. etc.
    One example that shows how to export a digital signal from one board
    and use it on another board via the RTSI lines that are built into the
    backplane of the PXI chassis can be seen here.
    Hopefully this gives you a good place to start!
    Regards,
    Doug Mumford
    Applications Engineer
    National Instruments
    Doug M
    Applications Engineer
    National Instruments
    For those unfamiliar with NBC's The Office, my icon is NOT a picture of me

  • Matlab workspace not getting updated while labview mex file is running

    Hi,
    Let me start from the overview of the system for better understanding.
    The system is to acquire data from a DAQ6070e using labview 7.1 . this data is then to be used in matlab for processing. All this needs to happen in real time hence the data is to be acquired from labview and outputted into matlab in real time.
    in order to do this we generated the labview and the matlab codes seperately. After days of hard work we managed to import the labview vi into matlab using a math interface toolkit, but now have run into another interesting problem.
    the workspace in matlab is not getting updated during the time the labview vi is running inside matlab. it only updates after the vi has run . for example if i need to monitor the system for 300 seconds then ideally the labview vi should output the samples for each acquisition and output it to matlab, what actually is happening is that the labview keeps running for 300 seconds without outputting any data during those 300 seconds and only outputs the last set of acquisition values at the end of the 300 seconds. Which beats the purpose of the whole program.
    Kindly help
    Regards
    Manuj

    Thanks Mate,
    What you said about "MEX file will not be able to "store" data between runs" ,i realised in the morning. as a result i dont think your suggestion of for loop will also be effective as labview mex file will not acquire data during matalb code execution and vice versa.
    Hence i have decided to do it the other way...we will now try to run the matlab code in labview.
    this leads to other problem
    As this is a real time operation i need to find out a way of storing the data into computer memory and then reading from it(when i say memory i do not mean writing it to a file and readin from it as that is slow) becasue i think the buffer i am specifying in my AI config is not big enough.
    I was thinking maybe i should use a RT FIFO queue but then i have not been able to find out the difference between buffer memory and fifo memory. ie is buffer memory supposed to be the ram memory or is it the hard disk memory?
    I am posting the vi here for easy understanding
    All help is very much appreciated
    Attachments:
    RT-loop2ver21.vi ‏231 KB

  • 6602 Arm Trigger to Sync Multiple Tasks

    I am using a 6602 card to read the period of multiple TTL square waves.  I am doing this through Matlab using the DAQmx functions.  I was able to read the period on one channel perfectly fine.
    To check the robustness of the code, I tried reading the same TTL wave through two different counters.  The counters were put into seperate tasks, therefore using two StartTask functions.  i noticed this caused the tasks to be offset by 15 or so samples.
    I believe I should be using an arm trigger to sync the two tasks.  I cannot find an arm trigger function for a 6602 to use in Matlab,though.  Is there an arm function or should I take another route?

    Thanks for the response Gerardo,
    I am now collecting the samples continuously.  This yielded simultaneously running tasks that are just delayed from one another (which is almost what I want).  I was running finite before, but am no longer.
    I tried using DAQmxCfgDigEdgeStartTrig but was not successful.  I've attached my Matlab code (as a .txt) with the attempted trigger is clearly labeled.  I was trying to run an internal trigger or sorts.  I am probably way off on this assumption, though.  I was thinking I could generate a pulse signal to counter2 and use that as the trigger signal.  How wrong is that?
    -Mike
    Attachments:
    contper.txt ‏4 KB

  • Using matlab script block

    Hello!
    I'm using a matlab script block and I have a problem that i don't how to solve it,
    I want to import a column that in matlab is cell array or char array type. When you create an output in matlab script block you have to specify the data type....I choose string, but with this option you can only import one string....and I want to import a whole column.
    Someone knows how I have to do to import this data type? I have to do some changes to the data from matlab or I have to use some especific block in labview to adapt the data.
    Please help me!!
     Thanks!!!

    Ooooppss!
    My computer is crazy....sorry.
    I'm near to solve my problem...
    The problem is that I have a column of strings like this
    str=['labview'
            'labview2'
           'labview3'
            'labview4']
    I use the double command but the byte array to string block only converts me an element, do you know is exist another block to change all the elements.
    I've tried to do with a for loop block....using an index array and changing with i the index element, but it doen'st work.
    You have some idea?

  • Array size mismatch error (1047) from matlab to labview

    Hello all,
    I have a very strange situation here and I am hoping someone can come up with some ideas for me...
    I am running labview vi's through a web page, and one of my vi's contains a matlab script with two array inputs, one 2d with a varying length, and the second a 1d array with a fixed set of parameters.
    If I call this report on my local system, web server labview and matlab all running on my laptop. Everything works fine. I receive no errors and the matlab script runs and returns data as expected.
    The problem is I have an Identical setup (as near as I can tell) setup on a server, and I receive a 1047 error, reporting an array size mismatch.
    All the input arrays data sets are identical in the vi at the input into the matlab script. And as best as I can tell all sub VI's and M files are identical. The only difference I can come up with is that one setup is running on a server and the other is not, however other vi's using matlab script (although a simpler configuration (no direct inputs or outputs form matlab, all data transferred in and out via txt files )) run fine in both configurations.
    On both systems I running matlab ver 7 (R14) with a single user license and Labview 7.1.
    any ideas or suggestions would be greatly appreciated. Please let me know if any additional details are needed.
    Thank you in advance,
    Chris

    Hello Matt,
    Yes you were correct upgraded LV to 7.1.1 and everything is running fine now.
    thanks
    NPI_Chris wrote:
    Hello all,
    I have a very strange situation here and I am hoping someone can come up with some ideas for me...
    I am running labview vi's through a web page, and one of my vi's contains a matlab script with two array inputs, one 2d with a varying length, and the second a 1d array with a fixed set of parameters.
    If I call this report on my local system, web server labview and matlab all running on my laptop. Everything works fine. I receive no errors and the matlab script runs and returns data as expected.
    The problem is I have an Identical setup (as near as I can tell) setup on a server, and I receive a 1047 error, reporting an array size mismatch.
    All the input arrays data sets are identical in the vi at the input into the matlab script. And as best as I can tell all sub VI's and M files are identical. The only difference I can come up with is that one setup is running on a server and the other is not, however other vi's using matlab script (although a simpler configuration (no direct inputs or outputs form matlab, all data transferred in and out via txt files )) run fine in both configurations.
    On both systems I running matlab ver 7 (R14) with a single user license and Labview 7.1.
    any ideas or suggestions would be greatly appreciated. Please let me know if any additional details are needed.
    Thank you in advance,
    Chris

  • SIT abs brake model error 14103

    Hi everybody,
    I installed the SIT to communicate between LabVIEW and Matlab simulink. I tried the example with the abs brakes which is given on the NI-homepage because I'm new with this stuff. First there appeared the error 14103. So I went to Tools->Options->Front Panel and unchecked the "Use localized decimal point". Then it seemed to be ok, there was no error anymore. But the program doesn't run. When I start it and change the slider there is no change in the vehicle speed or wheel speed e.g.. They are at 0.
    Does anybody know why? Does the simulink model has to be open or closed? Or could there be another error? Do I have to synchronize LabVIEW and Matlab???
    Thanks for your help.
    Steffi

    Steffi,
    what you gonna try to implement isn't that easy with your approach.
    Simulink and LabVIEW are running independent from each other. Furthermore, Simulink is generally a simulation environment,  to combine it with other targets (HW or SW) you need to use the Real-Time Workshop (RTW) from Matlab to create a DLL of your Simulink model. Afterwards you can implement this DLL in LabVIEW by using the SIT. In case of using the Simulink DLL, the structure of two independent running frameworks changes in the following way: Just imagine that LabVIEW is the only framework and in this framework you call the Simulink model again and again and again... (the model is compiled with a fixed steped solver, therefore, the calling framework (LabVIEW in our case) is the time base for the model)
    If you don't have the RTW, I recommend to go one of the following ways:
    Use either the LabVIEW Simulation module to translate the Simulink model into LabVIEW code or use LabVIEW for controlling (Kp,Ki, etc.) and/or monitoring (specific signals) only.
    Another possible - but really hard way - would be to synchronize Simulink by using a timer obj in combination with a triggered subsystem.
    I hardly recommend to use the RTW.
    Thanks,
    Thomas
    http://www.newgistics.com

  • How do I synchronize a pulse output to a sine wave input on a pci-6602 card?

    I have a sine wave from a function generator as the input on the source of a counter. Input frequencies vary from 2-60 kHz. I want to produce a pulse train at a different frequency (10 Hz), but in phase with the sine wave. I have only been using Labview 5.1 for a short time. I am using the PCI-6602 card with a SCB-68 connecting block.

    Hello;
    Unfortunately, you can't connect a analog sinewave to the counter source. Counters only work with digital TTL signal type. To accomplish that task, you will need a MIO board working in sync with the 6602 you already have.
    Regards
    Filipe A.
    Applications Engineer
    National Instruments

  • How do I program a NI 6602 card to send trigger pulses, one at each output port, triggered by an input trigger signal, using only one counter for each output port?

    Hello,
    I have managed to program a NI 6602 card in LabView to send pulses on three different output ports, one pulse on each output port (with individually chosen delays) for each input trigger pulse coming on a separate input port. It is the DAQmx Create Channel (CO-Pulse Generation-Time)-VI that I have used for this, see attached code. However, this VI controls both pulse delay and pulse width, and therefore uses two counters for each output port (although you only specify one counter in the VI input signals), as I understand.
    In my application though, I only need to have the delay chosen, the pulse width can be arbitrarily short, and thus I should only need one counter for each output port. How do I accomplish to program this in LabView?
    Best regards,
    Claes
    Attachments:
    Configure Side Camera Flash 1 Triggering.vi ‏47 KB

    Well you're welcome to do that--it will work just fine as long as you are configuring a start trigger.
    <rant>
    However, personally I really don't like putting multiple counter outputs in the same task.  I have seen so many people assume that the counter outputs would be synchronized due to having them in the same task when this is not the case (you need to configure a start trigger in order to synchronize the counter outputs even if they are in the same task).  This is the only case I can think of where multiple channels in a DAQmx task are not automatically synchronized.
    As an example:
    Running this on my PCIe X Series gives a measured 2 edge separation of 1 ms + {7.78 us - 10.11 us}.  This would likely be much worse on a bus with more latency (e.g. USB).
    The resulting output is close enough to what you might expect that it might go unnoticed, but really these counter outputs are not synchronized and it would be easy to glance at the code and not even think twice about it.  For the small amount of extra work on my end to create a separate task for each counter, it really clears up some ambiguity about what the counters are actually doing.  For me it's worth it.
    So again, for your case there really isn't a problem with having the counters in the same task since you are using an external start trigger anyway.  I have just gotten in the habit of avoiding doing this.
    </rant>
    Best Regards,
    John Passiak

  • How can I generate synchroniz​ed pulse trains with 6602?

    Hi,
    I would like to generate multiple pulse trains with different frequencies with the 6602 TIO card. Currently I am able to generate pulse trains with different frequencies. But is there any way to synchronize all the pulse trains? For example, I'd like to have all pulse trains with their first low-to-high at the same moment.
    Thanks!
    Dan

    Dan,
    Absolutely, the NI-TIO chip on the PCI-6602 supports a start trigger. If you configure all of the counters that are generating a pulse train to use this start trigger, they will be synchronized. The example Generate Pulse Train - Start Trig (NI-TIO).vi demonstrates this process for one counter. In LabVIEW 7, this example can be found in the following location:
    Examples >> Hardware Input and Output >> Traditional DAQ >> Counters >> NI-TIO
    You will need to add code for the other counters, but this example should give you the general idea. Furthermore, this example demonstrates how you can use one of the digital lines to generate the start trigger.
    Good luck with your application.
    Spencer S.

  • Synchronize PCI- 5421 and PCI-6602

    I am using a PCI 6602 to generate four pulse trains. I am also generating a signal with a PCI 5421 AWG. All signals are started at the same time by using a common start trigger. The problem I am having is that after they run for a while the 6602 and 5421 signal start drifting. I know in the past I had sync clocks in a PXI chassis but I am unsure how to syncronize the clocks using PCI card. I do have an RTSI cable linking the cards together so could someone please give me an example of how to sycronize these cards in Labview (8.2)

    Hello Kiebach,
    You seem to be connecting the signal correctly in your NI-DAQmx program. However, I do not see any NI-FGEN code where you import the signal to be used as an external clock. Have you added this code? I think you would benefit from examining the example program entitled "niFgen_DAQmx_Synchronization_Example.vi". This program shows how to synchronize an NI-DAQmx device and an SMC Arb device. You can find the example by opening the NI Example Finder utility; you can open this utility from LabVIEW by going to the Help menu and selecting Find Examples... Once you have opened the NI Example Finder, you can navigate to this example by selecting the Browse tab and going to Hardware Input and Output>>Modular Instruments>>NI-FGEN (Signal Generators)>>Synchronization. You will notice that this example uses the Export Signals VI rather than the Connect Terminals VI. To help understand the difference between these two, you may want to examine this document.
    Matt Anderson
    Hardware Services Marketing Manager
    National Instruments

  • Counter using PCI-6602 for multi output

    Hi guys,
    currently I tried to control a linearmotor using PCI-6052E and PCI-6602.
    The questions is, how to use PCI-6602 to be a counter which will be converted to several output (multioutput):
    (1) converted to position >> 1count = ...[mm] --> position measurement
    (2) converted to voltage >> 1count = ...[mV] or [V] --> voltage measurement
    (3) converted to current >> 1count = ...[mA] or [A] --> current measurement
    (4) converted to velocity >> 1count = ...[mm/s] --> velocity measurement
    (5) converted to acceleration >> 1count = ...[mm/s^2] --> acceleration measurement
    (6) converted to force >> 1count = ...[N] or [kg.mm/s^2] --> force/load measurement
    (7) converted to frequency >> 1count=...[Hz] --> frequency measurement
    (i) Please assist me how to connect the driver's encoder (Ch. A A/ B B/ Z Z/) with PCI-6602, so I can get all informations above (7 measurements). What/which port of PCI-6602 connect to where from the driver.
    (ii) Please assist me how to connect the feedback signal to the PC. What/which port of PCI-6602 connect to PC.
    (iii) How to test those 7 measurements above using Measuremant and Automation Explorer (MAX) ver.4.4.1?
    Thank you for your kindly help and assistance.
    Best wishes,
    hendro

    Dear Jochen,
    (1) Principally, I'd like to use PCI-6602 to be a motion encoder also be a counter (Is it possible? Due to the manual, it is possible). I expect to have all information, such as position, time, velocity, etc. from that motion encoder (or at least the position and time). It is also expected of using PCI-6602 to do all measurements that I mentioned before . My meaning is, after having a signal from the counter, that 'count' will be converted to desire units under other programs. So, in this case, PCI-6602 is only used to get the 'count'.
    Simplified, the voltage command will send to the system (linear motor) through PCI-6052E (-10V to 10V). The actual position or other actual information will be catched (read) by using PCI-6602 (as a motion encoder, also as a counter). Then, this actual position will be used as a feedback, that will be compared to desired position.
    Is that also possible to use PCI-6602 be a motion controller + a counter + a frequency measurement in a same time parallely?
    I don't decide yet (I don't know) which acquisition rate will be needed/required, higher is better.
    (2) I'd like to apply an adaptive robust controller (yes, it is a closed loop system) under matlab with their feature called Real-Time-Workshop instead of using LV.
    (3) Power drive for the linear system will be driven by AC servo drive.
    Thanks for your help before,
    Warmly regards,
    hendro

Maybe you are looking for

  • Any recommendation for to continue ?

    I was working in Oracle Forms, but now I decided to learn. I am study Java for the first part (Getting started) but there are more chapter but, I like to make application like account system. I was thinking to junk to java Swing for to continue study

  • External drive no longer sleeping

    Just upgraded from Mountain Lion to Mavericks on my Mid 2011 iMac.  Prior to the upgrade, whenever the iMac went to sleep, the external drive (G-Technology G-Drive Firewire) went to sleep too.  Now, the G-Drive doesn't sleep.  Any idea how to fix thi

  • Information in transaction VP01SHP

    Hi After defining new condition type for picking list ,I am trying to enter  details in transaction VP01SHP . I request you to help me to enter information in following fields . Itu2019s not that I do not know , I am not sure which information exactl

  • Found a bug in "Execute Stored Procedure..." command

    Hi...I've found one interesting "feature": if I do click "Execute Stored Procedure"on SP, which contains an XML parameter (doesn't matter if it's input or output), Management Studio generates script without declaring datatype of that parameter. But i

  • Cannot remove a DHCP entry

    A single record keeps returning to my DHCP server. If I delete or edit it it automatically returns as it was. I have deleted the bootp.plist to no avail the record returns. Where is this data stored so I can remove it