www.pudn.com > 74hc595-STM8.rar > main.c, change:2015-04-01,size:683b


 
 
 
#include "Systerm.h" 
#include "hc595-drive.h" 
 
 
extern u8 	LED8[8];		//显示缓冲 
main() 
{ 
	u8 i=0, k; 
	Systerm_Init(); 
        H595_Init(); 
         
         
	asm("rim");//开中断,sim为关中断 
         
         
	while (1) 
        { 
			for(i=0; i<8; i++)	 
                          LED8[i] = k;	//刷新显示 
			if(++k > 0x10)	k = 0;				//8个数码管循环显示0,1,2...,A,B..F,消隐. 
        DisplayScan();	//显示扫描函数 
        Delay(650); 
        } 
} 
 
 
 
 
//将收到的数据再发送出去 
#pragma vector= UART1_R_OR_vector//0x19 
__interrupt void UART1_R_OR_IRQHandler(void) 
{ 
      unsigned char ch; 
      ch=UART1_DR; 
			UART1_sendchar(ch); 
      return; 
}