EasyManua.ls Logo

Renesas V850 Series - Common Area Initialization Processing Function; Revolution Start Initialization Processing Function

Renesas V850 Series
186 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
187
/* Set A/D */
ADM2 = 0x00; /* Stop (reset) A/D clock */
ADM2 = 0x01; /* Supply A/D clock */
ADM0 = 0x03;
ADM1 = 0x24; /* Select timer trigger mode */
ADTS = 0x01; /* Use timer trigger selected with TQ0OPT2 of */
/* motor control function */
ADM0 |= 0x80; /* A/D operation enabled */
ADIC = 0x03 ;
/* Set zero-cross signal interrupt pin */
INTR3 = 0x07; /* INTP130/INTP131/INTP132 both-edge interrupt */
INTF3 = 0x07;
P13IC0 = 0x01;
P13IC1 = 0x01;
P13IC2 = 0x01;
}
4.5.12 Common area initialization processing function
/****************************************************************************** /
/* Common area initialization */
/****************************************************************************** /
void ainit( void )
{
/* Initialization of flags */
error_flag = 0 ; /* Clear error flag */
init_flag = OFF ; /* Initial flag off */
disp_co = 100 ;
d_speed = 0 ;
/* Motor control area initialization */
stop_flag = ON ; /* Stop flag on */
object_speed = 0 ; /* Target speed 0 */
o_iqai = 0 ; /* Speed integral value 0 */
}
4.5.13 Revolution start initialization processing function
/****************************************************************************** /
/* Revolution start initialization */
/****************************************************************************** /
void start_init( void )
{
int i;
/* */
for ( i = 0 ; i < 21 ; i++ ) before_posi[i][1] = 0;
total_sa = 0 ;
sum_speed = 0 ;
speed_co = 100000 / TS ;

Table of Contents