Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Can an onboard programme wait for Bit 13/14/15 of MCS?

Solved!
Go to solution

Hi. I want to use an onboard programme on a NI7344 card to WAIT until it is flagged to proceed by the host machine.

The "flex_wait_on_event" function would seem the only logical possibility but documentation implies that bits 8-15 of the MustON and MustOff masks are ignored.

Is there another function I am not aware of ?  Presumably there is a way to do this since the host computer can set the MCS register with "flex_set_status_momo".

 

Thanks in advance   SDG

0 Kudos
Message 1 of 6
(3,771 Views)
Solution
Accepted by topic author Nottingham_SDG

SDG,

 

as you have already found out, flex_wait_on_event doesn't work for you. There are several alternative options to pause the execution of an onboard program. E. g. you could write to an onboard variable from the host. The onboard program could read this value and use a compare operation to satisfy the ocndition of a conditional jump operation. Then jump back to a label before the compare operation and jump out of this loop when the host has sent the command to continue (= changed the value of the onboard variable).

 

Could you please explain, what you are trying to accomplish with your onboard program? In general there are only very very few applications that really require onboard programs. Onboard programs don't run significantly faster than host programs and they also don't run with better determinism, as they are executed in a low priority task on the 68331 on the board.

A typical usecase for an onboard program is stopping a move, if forces become too high by monitoring an analog input, but they ar rarly used for implementing complete move sequences, as there is almost no real advantage for tasks like that.

 

Regards,

Jochen

0 Kudos
Message 2 of 6
(3,764 Views)

Nottingham_SDG wrote:

 

Jochen, many thanks for your quick response. I don't know how to respond to you other than to post a new query.

I am using the 7344 board to control a single axis to follow a profile and simultaneously sample 4 analog inputs and the encoder position.

Running a program on the host machine and using "flex_read_pos_rtn" and "flex_read_adc16_rtn" seems to cause the sampling loop on the host computer to take 50ms! (Removing one "flex_read_adc16_rtn" seems to decrease the loop time to 40ms etc. etc.)  I was hoping to get sampling rates in the order of 2ms. I thought that if I ran an onboard program, I could put the "flex_read_pos" and four "flex_read_adc16" commands in series, put the data into a buffer and then empty the buffer perhaps every 100 samples. To get some timing in there, I had intended to get the onboard program to wait on bit 13 of MCS going high, set that bit low again after it was detected high and then use the host computer to set the bit high every 2ms.

 

Is there an easier way ?? 

 

I have bought a PXI rack recently with a 7344 card and lots of multifunction IO and I will want to sample 20 channels of ADC simultaneously with encoder position so I guess ultimately I will want to use a RTSI pulse. Perhaps I should just bite the bullet and start using that straight away ?

 

0 Kudos
Message 3 of 6
(3,759 Views)

SDG,

 

the 7344 is not meant to be a measurement device. You won't be able to finish your operations in a 2 ms timeframe - even not in an onboard program - and you won't be able to accurately synchronize your readings at all. I strongly recommend to skip this approach, as it's probably just a waste of time and use your multifunction DAQ boards for the measurement task.

 

Regards,

Jochen

Message Edited by Jochen on 02-27-2009 11:05 AM
0 Kudos
Message 4 of 6
(3,755 Views)

Jochen, thanks for quick response. OK. I'll use "Plan B". Obviously, I'll still need to use the 7344 to acquire motor encoder position. Can you advise what function I can use to do that (signalled by a RTSI pulse (?)) and what sample rate I can hope to achieve on at least the encoder position. (and what manual do I need to read to discover how to call the multi-function IO board ?)

 

SDG

0 Kudos
Message 5 of 6
(3,752 Views)

SDG,

 

if you need position data with rates higher than about 100 Hz, you should use the counters of your DAQ boards for this task also. Please refer to this thread for more details.

 

Jochen

0 Kudos
Message 6 of 6
(3,750 Views)