Jump to content
OMRON Forums

why does " long long * " in c program make error?


11hours

Recommended Posts

double user_pid_ctrl(struct MotorData *Mptr)
{
    static double    *t_f64;
    static long long *t_i64;

    t_f64 = (double*)pushm;
    t_i64 = (long long*)pushm;

    pshm->P[4096] = (double)t_f64[8];   // success
    pshm->P[4097] = (double)t_i64[8];   // makes error

    t_f64 = (double*)(&(pshm->ModbusServerBuffer[512]));
    t_i64 = (long long*) (&(pshm->ModbusServerBuffer[512]));

    pshm->P[4096] = (double)t_f64[8];   // success
    pshm->P[4097] = (double)t_i64[8];   // makes error


    return 0;
}

I put the codes in function "user_pid_ctrl" in "usrcode.c", and I found that if I used a "long long *" pointer point to pushm or ModbusServerBuffer, the IDE reports error as follow:

[PMAC_PROJECT]
Error: Loading usralgo.ko
Error: Loading RT Address of user_pid_ctrl
Error: Loading RT Address of user_pid_ctrl
Warning: Loading RT Address of CfromScript
Warning: Loading RT Address of CaptCompISR

I think IDE does not report the exact reason, but I can not find any log file of any compile errors. 

The error just happens when I use "long long *" or "unsigned long long *". Everything runs well with any type of 4bytes, even with 8bytes "double". 

Why?

My PMAC is CK3M, CPU is arm,LS1021A, kernel is 4.1.18-ipipe, firmware 2.7.00. 

My Pc is windows10 64 bit.

Edited by 11hours
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

As Steve mentioned, the PPMAC servo algorithm considers operational efficiency and does not support the standard C library functions, so the type casting you're currently doing is not usable in user-written servo algorithms.

Link to comment
Share on other sites

Thanks, guys!

On 9/24/2024 at 10:01 PM, MoMo said:

As Steve mentioned, the PPMAC servo algorithm considers operational efficiency and does not support the standard C library functions, so the type casting you're currently doing is not usable in user-written servo algorithms.

 

On 9/24/2024 at 11:07 PM, steve.milici said:

I would need to see the text of the error but casting a “long long” to a “double” may end up with a conversion that “Realtime Routines” cannot use. This should work in “Background Programs” though.

 

On 9/24/2024 at 1:45 AM, steve.milici said:

PMAC C-programming does not support the “long long” integer type.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...