www.pudn.com > RL78_G14-Demo.rar > main.c, change:2013-04-25,size:1226b


 
/************************************************************* 
  Copyright (C),Getsoon (China) 
  File name: 
  Author:    			ZTX		 
  Version:				1.0         
  Date:						27th, April., 2013 
  Description:		when you press the button(number) ,the led will show the number 
  Others:					None 
  Function List: 
  History: 
    1. Date: 
       Author: 
       Modification: 
    2. ... 
 
**************************************************************/ 
 
#include "main.h" 
void Port_init() 
{ 
PM1=0; 
PM5=0XC3; 
PM7=0XF0; 
PU7=0XF0; 
P7|=0x0F; 
} 
void Led_display(int m) 
{ 
 if(m!=0) 
 	{ 
	if(m<10) 
		{ 
		P5.5=1; 
		P1=mun[m]; 
		delay(1000); 
		P5.5=0; 
		delay(5); 
		} 
	else 
		{ 
		delay(5); 
		P5.5=1; 
		P1=mun[m%10]; 
		delay(1000); 
		P5.5=0; 
		delay(100); 
		P5.4=1; 
		P1=mun[m/10]; 
		delay(1000); 
		P5.4=0; 
		} 
	} 
 else  
 ; 
} 
void main() 
{  
  int mun=0; 
  DI();          /*disable interrupt*/ 
  Port_init();     /*port configure*/ 
  while(1) 
  { 
    mun=Keyboard_scan(); /*scan which button pressed*/ 
	if(mun!=0) /*value of PCLOE0 between 0 and 1 */ 
	  {                                                /*num_buzzer express changing times*/ 
	     Led_display(mun); 
	  } 
  } 
 
}