EasyManua.ls Logo

Renesas V850 Series - Page 72

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
75
object_speed = -speed ;
if ( (sw_mode == CW) || (sw_mode == STOP) ) {
proc_no = 6 ; /* Deceleration, set processing number */
}
break ;
/* CCW stop processing */
case 6 :
if ( accel_count == 0 ) {
accel_count = ACCEL_VAL ; /* Set acceleration/deceleration counter */
if ( object_speed < -SPEED_MINI ) {
object_speed += accel_spd ;
if ( object_speed > -SPEED_MINI ) object_speed = -SPEED_MINI;
timer_count = WATCH_START ; /* Set speed monitor start time to 5 SEC */
} else {
stop_flag = ON ; /* Stop flag on */
proc_no = 0 ; /* Set stop processing number */
}
}
break ;
}
if ( ( proc_no == 2 ) || ( proc_no == 5 ) ) {
if ( timer_count == 0 ) {
if ( abs( object_speed - now_speed ) > SA_SPEED_MAX ) {
error_flag = ERR_NO2 ; /* Set error No. */
}
}
}
if ( disp_co == 0 ) {
led_num(1, d_speed / 100 ); /* Number of revolutions */
d_speed = 0 ;
disp_co = 100 ;
if ( abs(now_speed) == 0 ) {
disp_co = 0;
}
led_num(2, 1000/PWM_TS ); /* Carrier frequency */
led_num(3, cont_time ); /* Overall processing time */
led_num(4, cont_time1 ); /* Vector operation processing time */
}
if ( error_flag ) {
while( 1 ) {
OUT_data( LED41, ~0x00 ) ; /* LED display off */
OUT_data( LED42, ~0x00 ) ;
timer_count = 50 ;
while( timer_count ) ;
if ( error_flag == ERR_NO1 ) {
OUT_data( LED41, ~0x9e ) ; /* E1 display */

Table of Contents