EasyManuals Logo

Renesas V850 Series User Manual

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
Page #175 background imageLoading...
Page #175 background image
CHAPTER 4 PROGRAM LIST
Application Note U17209EJ1V0AN
178
4.5.6 LED display function
/****************************************************************************** /
/* LED value display subroutine */
/* no : Display area number (1 to 4) */
/* data : Display data (0 to 99) */
/****************************************************************************** /
void led_num( int no, long data )
{
if ( no == 1 ) {
data = data % 10000;
OUT_data( LED11, ~led_pat[data/1000]&0xff ) ;
OUT_data( LED12, ~led_pat[(data%1000)/100]&0xff ) ;
OUT_data( LED13, ~led_pat[(data%100)/10]&0xff ) ;
OUT_data( LED14, ~led_pat[data%10]&0xff ) ;
} else if ( no == 2 ) {
OUT_data( LED21, ~led_pat[(data%100)/10]&0xff ) ;
OUT_data( LED22, ~led_pat[data%10]&0xff ) ;
} else if ( no == 3 ) {
OUT_data( LED31, ~led_pat[(data%100)/10]&0xff ) ;
OUT_data( LED32, ~led_pat[data%10]&0xff ) ;
} else {
OUT_data( LED41, ~led_pat[(data%100)/10]&0xff ) ;
OUT_data( LED42, ~led_pat[data%10]&0xff ) ;
}
}
/****************************************************************************** /
/* External I/O output subroutine */
/* reg : Output register number */
/* data : Output data */
/***************************************************************************** /
void OUT_data( unsigned short reg, unsigned short data )
{
if ( reg == WRESET ) {
P4.3 = 0;
data = 1; /* Dummy step */
P4.3 = 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 )
{

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Renesas V850 Series and is the answer not in the manual?

Renesas V850 Series Specifications

General IconGeneral
BrandRenesas
ModelV850 Series
CategoryInverter
LanguageEnglish