From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

trigger NI motion daq

Triggering DAQ with NI-Motion trigger

 

I have read in this section about the RTSI with DAQ file for triggering NI-DAQ from NI-Motion which is ok if you are using a NI compatible DAQ board with RTSI cable. However, can I still use the Breakpoint External Scan Clock.vi if I do not have a compatible NI-DAQ board as I am currently using NI-Motion with a NI PCI7344 controller and MID-7604 driver power unit with a Data Translation DT9824 DAQ 24 bit USB device.

My application is moving backwards and forwards between 2 points in one dimension taking measurements at each of the 2 points in the sequence - measure - move forwards -stop - measure - move backwards -stop etc. I have built this sequence up in NI-Motion and just need a trigger for DAQ at both points. Alternatively I have looked at Software -Triggered Timing Sources and Internal Timing Sources.

 

Thanks,

Martin

 

0 Kudos
Message 1 of 7
(7,257 Views)

Hi Martin,

 

From your description of your application, I would say that software triggering is going to be the easiest way to do what you want. The RTSI with DAQ is more designed for applications where you want to take a DAQ reading whilst in motion, whereas you only need to take measurements in 2 positions where it is not moving.

 

Let me know if you have any further questions, perhaps with more desciption of what sort of measurements you are doing.

 

Best regards,

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 7
(7,239 Views)

Hi Ian,

 

Thanks for your reply.

 

The application is the measurement of oxygen (ie oxygen consumption) from single cells using microelectrodes, micron sized platinum wires that record a current which is directly related to the oxygen concentration.
As the signal is very small and impossible to measure directly we move the electrode backwards and forwards (about 10 microns distance) ie next to the cell and far away from the cell  via a motion controller. So we have three stages: (1) stop (one second) - electrode next to cell - measurement taken (2) move (one second) - no measurement taken (3) stop (one second) - electrode away from cell - measurement taken. This is repeated a number of times and then an average is taken for each measurement and the one near to the cell is subtracted from the measurement taken far from the cell to give very small current signals in fAmps. I am planning to do this part  in MatLab.

 

I have already generated a vi in NI Motion (see attached block diagram vi) for this and also could use the Data Translation example vi (also attached complete vi) for the data acquisition. Its just a case of meeting the two together with an appropriate trigger system.

 

Any tips on how I could integrate these two together with a trigger for the two measurements would be appreciated.

 

Regards,

Martin

 

Download All
0 Kudos
Message 3 of 7
(7,237 Views)

Hi Martin,

 

Looking at your code as it is, and with the explanation of how it should work, I think you should put all your code into a design pattern called the state machine. If you haven't come across state machines, you should definitely read up on them! They are a really easy to use and key design which most applications can be fitted into.

 

There's a good starter tutorial here, will only take 10 minutes reading. The only thing it misses out is to make the enum a type def, this is important.

 

So I think your states would be something like "move forward" "move backward" "measure" but of course make this how you want it.

 

Another useful document on state machines here.

 

Give it a go and see how you get on.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 4 of 7
(7,202 Views)

Hi Ian,

 

Thanks for the suggestion of using "State Machines". I have organised it so I have 4 states which are Measure, Move Forward, Measure and Move Backward and then this will be repeated going back to "Measure" again a given number of times. Each case structure will have the vi's inserted in each one so for the first one  "Measure" would include data acquisition and then "Move Forward would have the vi from NI Motion inserted into the second case structure etc. Is this ok?

 

Thanks,

Martin

 

0 Kudos
Message 5 of 7
(7,184 Views)

Sounds great. You may also find that some code can be moved out of the vi's, such as initialisation code (setting up parameters for your acquisition etc), you can put these to the left of the state machine and pass it into all the cases and use it in the relevant ones, or have an initialisation case, and use shift registers to store the settings.

 

You are definitely on the right lines though.

 

All the best with putting it all together.

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 6 of 7
(7,179 Views)

Hi Ian,

 

I have had a go with the "State Machine" as mentioned in my previous post. Please see attached standard NI Motion with measurements and  State Machine design. I know this is not correct but wondered if you had any comments to help me out a bit with this. Do I need to include the "Programming>Comparison" as in the examples although I am not quite sure how to incorporate them into the block diagrams?

You might not get the full data acquisition vi as it has been generated using Data Translation as I am using there own data acquisition board.

 

thanks,

Martin

 

Download All
0 Kudos
Message 7 of 7
(7,178 Views)