CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
92
#define ACCEL_TIME 1 /* Acceleration/deceleration time */
/* constant 10 mSEC */
#define ACCEL_DATA 40 /* Number of acceleration/deceleration */
/* incremental revolutions rpm */
#define WATCH_START 500 /* Speed monitor start time 10 mSEC */
#define ACCEL_VAL_1ST 50 /* Initial acceleration/deceleration */
/* time constant */
#define ACCEL_VAL 3 /* Acceleration/deceleration time */
/* constant */
#define ACCEL_SPD 50 /* Acceleration/deceleration constant */
#define PWM_INIT PWM_DATA/4 /* PWM initial value */
/****************************************************************************** /
/* Function constant */
/****************************************************************************** /
void fcalcu( signed int *wrm, signed int *trm );
void OUT_data( unsigned short reg, unsigned short data );
unsigned short IN_data( int reg );
void led_num( int no, long data ) ;
/****************************************************************************** /
/* Motor-related common area */
/****************************************************************************** /
signed short iua ; /* U-phase current */
signed short iva ; /* V-phase current */
signed int o_iqai ; /* Speed integral value area */
signed int base_position ; /* Speed estimation value reference point */
unsigned int sa_time ; /* Speed measurement value */
unsigned short timer_count ; /* Time wait counter */
unsigned short accel_count ; /* Acceleration/deceleration operation time counter */
unsigned short init_co ; /* Initial interrupt counter */
unsigned char init_pat ; /* Initial pattern counter */
unsigned short init_upco ; /* Initial speed-up counter */
unsigned int int_co ; /* UVW interrupt counter */
signed int di ;
signed int pwm_value ; /* PWM output value */
#pragma section const begin
const unsigned char cw_data[6][2] = { {0x09,0x00},{0x21,0x00},{0x24,0x00},
{0x06,0x00},{0x12,0x00},{0x18,0x00} };
const unsigned char ccw_data[6][2] = { {0x18,0x00},{0x12,0x00},{0x06,0x00},
{0x24,0x00},{0x21,0x00},{0x09,0x00} };
const unsigned char up_data[] = { 255, 242, 229, 217, 206, 195, 185, 176, 166, 158,
158, 158, 158, 158, 158, 158, 158, 158, 158, 158 } ;
const unsigned char run_cw_data[8][2] = { {0x00,0x00},{0x21,0x00},{0x06,0x00},
{0x24,0x00},{0x18,0x00},{0x09,0x00},
{0x12,0x00},{0x00,0x00} };