Home > Software engineering >  MFC in action through the message control motor
MFC in action through the message control motor

Time:10-02

Write a control motor action in MFC procedures, according to certain rules first motor action works (forward - stop - forward -... - stop), there are two ways:
A: to create A thread to control the motor operation all the code written in this thread (infinite loop), and then through A message awakened thread;
B: the motor running every movement as a message (forward, stop message), and then send you the message loop in the thread for the motor running,
Consult everybody a great god, and that the two methods is better? Or have any better ideas, thanked the first

CodePudding user response:

Multiple Threads in the User Interface of http://msdn.microsoft.com/zh-cn/library/ms810439.aspx

CodePudding user response:

Look at your request, if the motor drive had been reached, the PC is just communication, then see your response frequency, under the condition of the switching frequency is not high, the problem is not big; The demand is higher, if the frequency is not appropriate; If directly by computer control motor speed, the above methods are not,

CodePudding user response:

A, B is nonsense, B itself run don't need A thread to run?

CodePudding user response:

PC is usually to control motor speed,
Motor itself should have a speed loop, current loop,
Upper machine position loop or a possible,

CodePudding user response:

reference 1st floor zhao4zhong1 response:
Multiple Threads in the User Interface http://msdn.microsoft.com/zh-cn/library/ms810439.aspx

Miss zhao, I'm serious look at this article

CodePudding user response:

A ok, control motor operation will not get stuck in A child line the UI

CodePudding user response:

refer to the second floor ZDGDH response:
look at your request, if the motor drive had been reached, the PC is just communication, then see your response frequency, under the condition of the switching frequency is not high, the problem is not big; The demand is higher, if the frequency is not appropriate; If directly by computer control motor speed, the above methods are not,


Thank you for your answer, motor drive is normal, the PC just to motor control commands via a serial port sent to the motor, don't need a high response frequency, so long as can realize the process

CodePudding user response:

reference worldy reply: 3/f
A, B is nonsense, B itself run don't need A thread to run?


Thank you for your answer, the younger brother novice, still hope glad, thanks again

CodePudding user response:

reference 4 floor schlafenhamster response:
PC is usually to control motor speed,
Motor itself should have a speed loop, current loop,
Upper machine position loop or possible,


Thank you for your answer, the control of motor speed command can already by the upper machine through a serial port communication to motor, and can run normally, now want to achieve such a cycle test process,

CodePudding user response:

Can only be A
B no real-time cannot reach satisfactory, or wrong,
If use servo control card control, not to mention the can only create a thread to manage him, let he's turn, reverse, stop and so on,
The servo load is not big case can still achieve satisfied effect, if big get through lots of experiments to let him run stability,
Clutch of fatigue testing machine, steel quality is not easy to control.
  • Related