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,