g.mccormick
Lifetime Supporting Member
I am going to attempt to use a EL5151 and EL5101 to read a torque flange (freq output) and encoder. I need to be able to do calculations that will calculate a moving average of the torque flange and the motor speed based on motor revolutions. To increase the accuracy of these calculations, I am wanting to utilize the timestamp for the EL modules as well as the count values.
Basically when the calculation is triggered, I want to calculate the delta counts and delta time from last calculation. The timestamp is a 64bit number. So far I have found that including the TcUtilities.lib and creating the variables as follows:
n_Trq_Inpt_Nanotime AT %I*: T_ULARGE_INTEGER;
n_Trq_Inpt_Lastime : T_ULARGE_INTEGER;
n_Trq_Inpt_Deltatime: T_ULARGE_INTEGER;
I have been able to link the Timestamp from the 5151 to n_Trq_Inpt_Nanotime.
I have created a quick calculation as:
n_Trq_Inpt_Deltatime := UInt64Sub64(ui64a:= n_Trq_Inpt_Nanotime, ui64b:= n_Trq_Inpt_Lastime);
I have build this without error. My question is now what? This will leave me with a relatively small value in n_Trq_Inpt_Deltatime as a 64bit ULARGE. For me to do other calculations with that, I really need it in a 32 bit correct? Is there anyway to convert the value to a different value that is 32bit?
Basically when the calculation is triggered, I want to calculate the delta counts and delta time from last calculation. The timestamp is a 64bit number. So far I have found that including the TcUtilities.lib and creating the variables as follows:
n_Trq_Inpt_Nanotime AT %I*: T_ULARGE_INTEGER;
n_Trq_Inpt_Lastime : T_ULARGE_INTEGER;
n_Trq_Inpt_Deltatime: T_ULARGE_INTEGER;
I have been able to link the Timestamp from the 5151 to n_Trq_Inpt_Nanotime.
I have created a quick calculation as:
n_Trq_Inpt_Deltatime := UInt64Sub64(ui64a:= n_Trq_Inpt_Nanotime, ui64b:= n_Trq_Inpt_Lastime);
I have build this without error. My question is now what? This will leave me with a relatively small value in n_Trq_Inpt_Deltatime as a 64bit ULARGE. For me to do other calculations with that, I really need it in a 32 bit correct? Is there anyway to convert the value to a different value that is 32bit?