EasyManua.ls Logo

Renesas V850 Series - Main 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
98
mov #_ _sbss, r13 -- clear bss section
mov #_ _ebss, r12
cmp r12, r13
jnl .L14
.L15:
st.w r0, [r13]
add 4, r13
cmp r12, r13
jl .L15
.L14:
#
jarl _main, lp -- call main function
_ _exit:
halt -- end of program
_ _startend:
nop
# #
#-------------------------- end of start up module ----------------------------#
# #
4.2.5 Main processing function
#include "Common.h"
#include "Motor.h"
#pragma ioreg /* Peripheral I/O register definition */
static int save_psw;
/****************************************************************************** /
/* 3-phase motor control program */
/****************************************************************************** /
void main()
{
unsigned char proc_no ; /* Present processing number */
signed int speed ; /* Indication speed rms */
signed int accel_spd ;
int sw, sw_mode ;
/* */
hinit() ; /* Hardware initialization */
ainit() ; /* Initialization of area used */
proc_no = 0 ;
_ _EI();
while( 1 ) {
accel_spd = ( SPEED_MAX - SPEED_MINI ) / 100;
speed = ( ( SPEED_MAX - SPEED_MINI ) * volume / 1024 )
+ SPEED_MINI ; /* Indication speed calculation by volume */
sw = ~IN_data( SW ) & 0x07 ; /* Read operation button */
if ( sw == 1 ) {
sw_mode = CW ;

Table of Contents