Click here to Skip to main content
15,793,624 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have been tasked with creating an interface between a delta motion controller which is attached to a servo valve.

I want to read back the position in real-time.
I started coding in C# and even though the loop is running continually with no delay, I am missing values.


My question is, what techniques can I use to speed up the communication and are there any articles?

I am new to Windows programming but have over 30 years of programming experience.


What I have tried:

This is my main code which is run as a thread


<pre>           Comms_Thread = new Thread(new ThreadStart(Delta_Comms.ProcessWork));
            Comms_Thread.Priority = ThreadPriority.Highest;



public  void ProcessWork()

{

    while (Static_Delta_Data.Connected)
    {
            Static_Delta_Data.rmc.ReadLFile((int)FileNumber70.fn70StatusAxis0 + axis, 0, Local_Controller_Data.Status_Register, 0, 1);

            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Command_Position, RMC_Floats, 0, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Target_Position, RMC_Floats, 1, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Actual_Position, RMC_Floats, 2, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Command_Velocity, RMC_Floats, 3, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Target_Velocity, RMC_Floats, 4, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Actual_Velocity, RMC_Floats, 5, 1);
            Static_Delta_Data.rmc.ReadFFile((int)FileNumber70.fn70StatusAxis0 + axis, Control_Output, RMC_Floats, 6, 1);

    }

}
Posted
Updated 7-Mar-22 5:52am
Comments
CHill60 7-Mar-22 8:56am    

1 solution

You can't realistically sample "continuously and without delay". You need to determine the frequency / cycle time of the device, and establish a comparable "frame rate" / cycle time for your app.

Even if the source is "continuous", your app isn't; it needs to "tick over" at a certain rate; so use a timer with a suitable interval - once you determine the "minimum amount of cycle time you need to get a valid set of numbers".

Any numbers "missing" can be extrapolated / interpolated based on the sample rate and intermediate samples.
 
Share this answer
 
Comments
Member 15535708 8-Mar-22 8:41am    
Thank you for your input.

There is a Delta Motion Tools program which can plot the real time data and it captures and plots the data around every 2.2 mS.

I have written code to ask for data.
I have setup a window high precision timer to run every 1 mS but looking at the data it is reading the data between 1.5 and 15 mS which obviously isn't quick enough.

What techniques can I use to improve performance?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900