| C Program Screen
C onstants: FALSE 0 TRUE 1 PI 3.14159265358979323846264 PI_F 3.1415926535f TWO_PI (2.0 * PI) TWO_PI_F (2.0f * PI_F ) PI_2F (PI_F * 0.5f) TRAJECTORY_OFF 0 TRAJECTORY_INDEPENDENT 1 TRAJECTORY_LINEAR 2 TRAJECTORY_CIRCULAR 3 TRAJECTORY_SPECIAL 4 Axis Input Modes ENCODER_MODE 1 ADC_MODE 2 RESOLVER 3 USER_INPUT_MODE 4 Axis Output Modes MICROSTEP_MODE 1 DC_SERVO_MODE 2 BRUSHLESS_3PH_MODE 3 BRUSHLESS_4PH_MODE 4 DAC_SERVO_MODE 4 Data Gather/Plot Functions: void SetupGatherAllOnAxis(int c, int n_Samples); void TriggerGather(); int CheckDoneGather(); Analog I/O Functions: ADC(ch); DAC(ch, value); Power Amp Functions: void WritePWMR(int ch, int v); void WritePWM(int ch, int v); void Write3PH(int ch, float v, double angle_in_cycles); void Write4PH(int ch, float v, double angle_in_cycles); Timer Functions: double Time_sec(); void WaitUntil(double time_sec); void Delay_sec(double sec); double WaitNextTimeSlice(void); Axis Move Functions: void DisableAxis(int ch); void EnableAxisDest(int ch, double Dest); void EnableAxis(int ch); void Zero(int ch); void Move(int ch, double x); void MoveRel(int ch, double dx); int CheckDone(int ch); void MoveXYZ(double x, double y, double z); int CheckDoneXYZ(); void DefineCoordSystem(int axisx, int axisy, int axisz, int axis a); Digitial I/O Functions: void SetBitDirection(int bit, int dir); int GetBitDirection(int bit); void SetBit(int bit); void ClearBit(int bit); void SetStateBit(int bit, int state); int ReadBit(int bit); Print to Console Screen Functions: int printf(const char *format, ...); Print to Windows File Functions: FILE *fopen(const char*, const char*); int fprintf(FILE *f, const char * format, ...); int fclose(FILE *f); Thread Functions: void StartThread(int thread); void PauseThread(int thread); void ThreadDone(); int ResumeThread(int thread); Math Functions: double sqrt(double x); double exp(double x); double log(double x); double log10(double x); double pow(double x, double y); double sin(double x); double cos(double x); double tan(double x); double asin(double x); double acos(double x); double atan(double x); double atan2(double y, double x); float sqrtf (float x); float expf (float x); float logf (float x); float log10f(float x); float powf (float x, float y); float sinf (float x); float cosf (float x); float tanf (float x); float asinf (float x); float acosf (float x); float atanf (float x); float atan2f(float y, float x); | The C Program Screen allows the user to edit C language programs, compile, link, download, and run them within the KMotion board. C programs executing within the KMotion board have direct access to all the Motion, I/O, and other miscellaneous functions incorporated into KMotion System. One of the most powerful features of the KMotion system is the ability for a user to compile and download native DSP programs and have them run in real time. Native DSP code runs faster than interpreted code. The TMS320C67x DSP that powers the KMotion system has hardware support for both 32 bit and 64 bit floating point math. Multiple threads (programs) may execute simultaneously (up to 7). The integrated C compiler allows with a single pushbutton to save, compile, link, download, and execute all within a fraction of a second. After programs have been developed and tested they may be flashed into memory and run stand alone with no host connection. Other features of the C Program Screen include a rich text editor with syntax highlighting, keyword drop down lists, function tips, unlimited undo/redo, and Find/Replace with regular expressions. See list on left for available constants and functions. For a more details on the functions, see the KMotionDef.h header file. This file is normally included into a user program so that all accessible base functions and data structures are defined. See PC-DSP.h for common definitions between the PC host and KMotion DSP.