CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
103
P3.0 = 1;
} else {
PDL = data | ( reg << 8 );
PDL = reg | ( reg << 8 ) | 0x8000;
}
}
/****************************************************************************** /
/* External I/O input subroutine */
/* reg : Input register number */
/****************************************************************************** /
unsigned short IN_data( int reg )
{
unsigned char *po;
/* */
if ( reg == SW ) {
return P4;
} else {
return 0;
}
}
4.2.7 Motor control interrupt processing function
#include "Common.h"
#include "Motor.h"
#pragma ioreg /* Peripheral I/O register definition */
/****************************************************************************** /
/* Motor control timer interrupt processing */
/****************************************************************************** /
_ _interrupt
void int_MOTOR(void)
{
ADSCM00 = 0x8001 ; /* Start AD0 */
ADSCM10 = 0x8000 ; /* Start AD1 */
}
/****************************************************************************** /
/* Motor control processing */
/****************************************************************************** /
void Motor_CONT(void)
{
signed int wrm, wre, trm, tre ;
signed int o_wre, we, o_iqap, o_iqa ;
signed int s_time, ek, sa ;
unsigned char wk ;
signed int cow ;
signed int o_vua, o_vva, o_vwa ;
signed int o_vda, o_vqa ;
/* */