Datasheet
15. Application Customisation
The software designed on the RL78G14 is very flexible and can be easily configured via a single file called:
“customize.h” located in the Workspace of the RL78G14 project.
The “customize.h” is a file containing some macros used to specify some important program parameters. The most
important of them are summarized below.
PWM and Sampling frequencies:
#define PWM_FRE_CUSTOM 24000 // PWM freq [Hz], 8K < PWM_FRE_CUSTOM < 24K
#define SAM_FRE_CUSTOM 8000 // Sampling freq [Hz], 2K < SAM_FRE_CUSTOM < 8K
Parameter’s table measurement units:
#define AMP_DIV 10 // current parameters expressed in ampere/AMP_DIV
#define OHM_DIV 10 // resistance parameters expressed in ohm/OHM_DIV
#define HEN_DIV 10000 // resistance parameters expressed in ohm/OHM_DIV
Parameter’s table default values (these are the values which should be used with the motor included in the demo set):
#define RPM_MIN_CUSTOM 2000 // 200 < X < 5000 // min speed in rpm
#define RPM_MAX_CUSTOM 6000 // 1000 < X < 20000 // max speed in rpm
#define R_ACC_CUSTOM 4000 // 1 < X < 10000 // accel. ramp in rpm/sec
#define R_DEC_CUSTOM 2000 // 1 < X < 10000 // accel. ramp in rpm/sec
#define C_POLI_CUSTOM 2 // 1 < X < 4 // polar couples number
#define I_START_CUSTOM 3 // 0 < X < 5000 // startup current in A(pk)/AMP_DIV
#define I_MAX_CUSTOM 3 // 0 < X < 5000 // max current in A(pk)/AMP_DIV
#define R_STA_CUSTOM 40 // 0 < X < 5000 // stator phase resist. in Ohm/OHM_DIV
#define L_SYN_CUSTOM 30 // 0 < X < 5000 // synchronous induct. in Henry/HEN_DIV
#define STP_TIM_CUSTOM 800 // 300 < X < 10000 // startup ramp time in ms
#define KP_CUR_CUSTOM 70 // 0 < X < 10000 // K prop. current control
#define KI_CUR_CUSTOM 200 // 0 < X < 10000 // K integ. current control
#define KP_VEL_CUSTOM 50 // 0 < X < 10000 // K prop. speed control
#define KI_VEL_CUSTOM 200 // 0 < X < 10000 // K integ. speed control
Important note: Any modifications to “customize.h” will require re-compilation and re-loading of the program.