11hours Posted September 21 Posted September 21 (edited) 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 September 21 by 11hours Quote
steve.milici Posted September 23 Posted September 23 PMAC C-programming does not support the “long long” integer type. Quote
MoMo Posted September 24 Posted September 24 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. Quote
steve.milici Posted September 24 Posted September 24 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. Quote
11hours Posted September 27 Author Posted September 27 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.