11hours Posted October 8 Share Posted October 8 (edited) I upadte some data of "double" by saving them in ModbusBuffer. The updating function code is some like below: { double *g_modbus_buff = (double*)(pshm->ModbusServerBuffer); g_modbus_buff[0] = something_i; g_modbus_buff[1] = something_ii; g_modbus_buff[2] = something_iii; g_modbus_buff[3] = something_iv; g_modbus_buff[4] = something_v; ...... } I put the code in "Realtime Routines" directory, and call the code in "user_pid_ctrl". Is there any potential risk of "thread-safety" problem when I read holding registers from PC continuously? After all the Servo Frequency is 20kHz, "user_pid_ctrl" running so fast. Or, on the other hand, if the read-write process is thread-safe, will the modbus function slow down the servo task? Edited October 8 by 11hours Quote Link to comment Share on other sites More sharing options...
steve.milici Posted October 8 Share Posted October 8 Modbus is a background task in Power PMAC, so if you have enabled the server sockets (Sys.ModbusServerEnable = 1) for the documented Modbus use then this will not function properly in Power PMAC "Realtime Routines". Quote Link to comment Share on other sites More sharing options...
11hours Posted October 9 Author Share Posted October 9 2 hours ago, steve.milici said: Modbus is a background task in Power PMAC, so if you have enabled the server sockets (Sys.ModbusServerEnable = 1) for the documented Modbus use then this will not function properly in Power PMAC "Realtime Routines". thank you Steve, I will move this code to background. Quote Link to comment Share on other sites More sharing options...
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.