Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

Onboard program breakpoints not always enabling

Hi,

 

I have a PCI-7342 board connected to a MID-7652 box that is being used to control a servo motor on a rotary axis with an encoder. As the axis rotates, it passes breakpoints and outputs a falling-edge trigger signal. I am programming in C. Due to other restrictions, I need to use the onboard breakpoint re-enabling functions.

 

My onboard program is as follows:

   flex_begin_store(, ucProgramNumber);

   flex_configure_breakpoint_out_polarity(, , NIMC_ACTIVE_HIGH, NIMC_OPEN_COLLECTOR);

   flex_configure_breakpoint(, , NIMC_MODULO_BREAKPOINT, NIMC_RESET_BREAKPOINT);

   flex_load_bp_modulus(, , , );

   flex_load_pos_bp(, , , );

   flex_insert_program_label(, usLabelNumber);

      flex_enable_breakpoint(, , NIMC_TRUE);

      flex_wait_on_event(, , NIMC_WAIT_OR, NIMC_CONDITION_MOVE_COMPLETE, , MATCH_ALL, usTimeOut, );

      flex_wait_on_event(, , NIMC_WAIT, NIMC_CONDITION_POSITION_BREAKPOINT, , MATCH_ALL, usTimeOut, );

      flex_jump_on_event(, , NIMC_TRUE, , NIMC_MATCH_ALL, usLabelNumber);

   flex_end_store(, ucProgramNumber);

 

Later on in my program I call the following functions:

   flex_load_target_pos(, , iTarget, );

   flex_run_prog(, ucProgramNumber);

   flex_start(, , );

   {

      ...

   }

   flex_stop_prog(, ucProgramNumber);

 

My problem is that sometimes (not all the time) I don't detect any output signal from the breakpoint. When this happens, during the motion an error in the MAX will appear. The error code is -70136 NIMC_eventTimeoutError A wait operation timed out or a read function timed out. It also specifies that the error occurred on the flex_wait_on_event() function. Since this occurs during the motion (usually at the start), I am inferring that the timeout occurred waiting for the breakpoint condition.

 

Given my trajectory, my breakpoint position and modulus, it should not be timing out at all. It seems that the problem lies in the (re)enabling of the breakpoints. As I said, it only occurs some of the time, other times it works.

 

Can anybody please help?

0 Kudos
Message 1 of 3
(5,482 Views)

Hi,

 

If you aren't detecting any breakpoint signal, then your timeout will almost certainly be from not detecting that. You have correctly setup the wait functions to wait for either the end of the move or a breakpoint signal.

 

A couple of things:

 

Did you mean to have a modulus of 0? Having not put an input, it will now just behave like an absolute breakpoint. In which case we could have set it up to be absolute.

 

I didn't quite figure out the order of instructions in the way you had set it out (I'm more familiar programming in LV than C, though the functions are the same)

 

Normally the order of instructions is as follows:

*breakpoint configuration*

start move

Wait on event

 

You can enable the breakpoint after the start at any point as well.

 

As mentioned, I didn't figure out if this is the way you have set it up, it could be ordering of functions which is opening the possibility of missing the re-enabling of breakpoint or similar.

 

Regards,

Ian S
Applications Engineer CLA
National Instruments UK&Ireland
0 Kudos
Message 2 of 3
(5,441 Views)

Hi Ian,

 

Thank you for your reply.

 

Sorry, I should have been clearer. I have set the breakpoint modulus to 100, not 0. I have set the breakpoint position to 0.

 

The order of instructions in my program are as follows:

  Breakpoint configuration

  Wait on event

  Start move

 

The reason for this difference from your suggestion is that the breakpoint configuration and the wait on event take place in the onboard program which is started before the move is started.

Thanks for your suggestion, I will certainly try to reorder the instructions, perhaps moving the breakpoint configuration out of the onboard program. Hopefully it will work.

0 Kudos
Message 3 of 3
(5,436 Views)