Technical information

SCI to SPI Peripheral Communication in V850ES Microcontrollers
/* void led_dig(unsigned char num) */
/* display number as hex digits */
/* num - number to display */
/* bits 0-3 in right digit */
/* bits 4-7 in left digit */
void led_dig(unsigned char num)
{
led_out_right(dig_tab[num & 0x0F]);
led_out_left(dig_tab[(num >> 4) & 0x0F]);
}
/* void led_dig_bcd(unsigned char bcdnum) */
/* display two digits of BCD coded bcdnum */
/* bcdnum - number to display in BCD */
/* 0 - 9 displayed as right decimal digit, left blank */
/* 10 - 99 displayed as two decimal digits */
/* 100 - 255 displayed as blank */
void led_dig_bcd(unsigned char bcdnum)
{
unsigned char tens_dig;
if (bcdnum > 99) {
led_out_right(LED_PAT_BLANK); /* display both digits blank */
led_out_left(LED_PAT_BLANK);
return;
}
if (bcdnum < 10) {
led_out_right(dig_tab[bcdnum]); /* just display right LED */
led_out_left(LED_PAT_BLANK); /* blank left LED */
return;
}
/* 10 <= bcdnum <= 99 */
tens_dig = 0;
do { /* calculate ten's place and remainder */
bcdnum -= 10; /* by multiple subtractions of 10 */
tens_dig++; /* while counting up the tens digit */
} while (bcdnum >= 10);
/* now tens_dig has ten's place */
/* and bcdnum has remainder */
led_out_right(dig_tab[bcdnum]);
led_out_left(dig_tab[tens_dig]);
}
4.2 Files Common to Serial Communication Demonstration Programs
4.2.1 Macrodriver.h
/*
*****************************************************************************
**
** This device driver was created by Applilet for the V850ES/KJ1+,
V850ES/KG1+,
77