motion control

Hi all,
I am writing a control program in QNX using C++. The aim of this program is to maintain the angle of the motor’s rotor constant in time no matter what disturbances may occur. After running for three minutes the program hangs and i suspect that an overflow takes place. I checked the variable declarations but I can’t find any mistakes. Is there a command in C++ to help me solve this problem? I am using the ServotoGo model II card! Thank you all in advance!

Usually an overflow will cause the program to crash, not to hang ( by hang I assume you mean it become unresponsive)

There is no C++ command to debug this, you need to play detective, or use a debugger. The command sin and psin can give you some clue as to what the program is doing when its non responsive.

Thanks Mario! I reduced the sampling frequency and it seems to be ok. If not iwill try what you suggested! Thanks :slight_smile: