Motion Control and Motor Drives

cancel
Showing results for 
Search instead for 
Did you mean: 

on board programming

Hi,
 
I made an application using c for a PCI 7350 which was not on-board. Now I want to modify it so that the application can run on-board.
I am calling all the load parametrs and flex_start functions in subroutines like doMove1(u8& boardID) etc.
 

------------------------------------------------------------------------------------------------------------------------------

void

__cdecl main(void){

i32 status=0;

u8 boardID=1; //PCI 7350 board

u8 program=1;

if(status == NIMC_noError){

//Begin on board program storage

status = flex_begin_store (boardID, program);

printf(

"\n On Board Program Storage started\n");

}

if (status == NIMC_noError){

//Do the sequential moves

status = doMove1(boardID);

if (status)ErrorHandler((u16)status, 0, 0); //do Move1 loads the trajectory parameters and runs the "flex_start" function.

status = doMove2(boardID); if (status)ErrorHandler((u16)status, 0, 0); //do Move2 loads the trajectory parameters and runs the "flex_start" function.

}

//////End program storage/////

if(status == NIMC_noError){

status = flex_end_store (boardID, program );

printf(

"\n On Board Program Storage completed\n");

}

/////Now run the stored program/////

if(status == NIMC_noError){

status = flex_run_prog(boardID, program);

printf(

"\n Running the program now\n");

}

printf(

"\n\nFinished.\n");

}//end main

------------------------------------------------------------------------------------------------------------------------------

The program compiles, but when I try to run it, I only see 1 printf, that is the first printf statement  " On Board Program Storage started". I want to be sure that the program will be able to make all the moves on-board. Can someone please comment or suggest any improvements?

Thanks,

-Karan

0 Kudos
Message 1 of 2
(3,089 Views)
  1. The reason why you see only the first printf is the fact that you have used functions in your onboard program that can't be downloaded to the board. This will result in errors that cause the other printf calls not to execute. In fact you are just allowed to use NI Motion function calls inbetween the start and the end of the storage of your onboard program. You can't use subroutines, C-loops and so on.

    The reason for this is the way onboard programs work. After calling flex_begin_store() the CPU on the board doesn't execute the motion commands that are sent to the board immediately but stores them in memory to execute them later. It can't store subroutines or structures. Please refer to the shipping onboard programming examples to find out how to program loops and so on in an onboard program.

  2. Why do you want to run the moves in an onboard program? The onboard CPU is just a little 20 MHz µController with low performance. Many years ago it helped to remove some load from the host CPU but with current PC CPUs this doesn't make any sense anymore. Today onboard programs are typically used to monitor some critical conditions (e. g. forces) and react independently from the PC/Windows. You shouldn't use them to execute the motion task as there are really almost no benefits. It's just a bit more complicated...

Best regards,

Jochen
0 Kudos
Message 2 of 2
(3,079 Views)