Jump to content
OMRON Forums

C-API Function Call Speed


bradp

Recommended Posts

The PPmac C-API has several functions to get or set data. Each function has advatages in ease-of-use and robustness and the tardeoff is usually with regards to speed. This is a chart giving some simple timing specifications for the common C-API function calls. [attachment=1423:name] The test code used to generate this data is: [code] void user_plcc() { char szdata[100]; double dAnswer; int i, j; pshm->P[1] = pshm->ClockSF*u64btod(fclock()); // start time for(i = 0; i < 1000; i++){ //j = GetPmacVar("MyVar", &dAnswer); // 940 usec //j = SetPmacVar("MyVar", 2.0); // 850 usec //dAnswer = pshm->P[MyVar]; // 23 usec //pshm->P[MyVar] = 3.0; // 23 usec //j = GetPmacNativeVar("P8192", &dAnswer); // 264 usec //j = SetPmacNativeVar("P8192", 4.0); // 295 usec //j = GetResponse("MyVar", szdata, 90, 7); // 18325 usec //j = Command("MyVar=5"); // 2465 usec //dAnswer = GetGlobalVar(MyVar); // 54 usec //SetGlobalVar(MyVar, 1.0); // 46 usec //dAnswer = GetPtrVar(MyVar); // 130 usec //SetPtrVar(MyVar, 6.0); // 155 usec //dAnswer = GetCSGlobalVar(MyCsVar, 1); // 60 usec //SetCSGlobalVar(MyCsVar, 1, 7.0); // 53 usec //dAnswer = pshm->Coord[1].Q[1024]; // 23 usec pshm->Coord[1].Q[1024] = 8.0; // 23 usec } pshm->P[2] = pshm->ClockSF*u64btod(fclock()); // end time pshm->P[3] = pshm->P[2] - pshm->P[1]; // total in usec pshm->P[5] = (double) i; pshm->P[4] = dAnswer; sprintf(szdata,"%d\n", pshm->P[4]); Send(SEND1_PORT,szdata); Send(SEND1_PORT,szdata); usleep(1000000); } [/code]
Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Posted Images

Guest
This topic is now closed to further replies.

×
×
  • Create New...