#pragma sfr
#define   uchar unsigned char
#define   uint  unsigned int
void delaynms(uint n)
{
 uint i,j;
 for(i=n;i>0;i--)
 for(j=110;j>0;j--); 
}
void main()
{
 IMS    = 0xc8;      
 IXS    = 0x0c;      
 OSCCTL = 0X41;     
 PCC = 0x00;        
    MOC = 0X00;
    MCM = 0X05;
 for(;;)
 {
     uchar temp = 0x01;
     uchar i;
     PM6 = 0xf0;
     P6 = 0xfe;
     delaynms(500);
      for(i = 3;i >0;i --)
     {          
   temp <<= 1;
   P6 = ~temp;
   delaynms(500);   
  }
 }
}
delaynms是利用sm+仿真出来的,大约1ms

 
					
				
 
			
			
			
						
			 
					
				 
										 
					
				 
					
				 
					
				 
					
				 
					
				 我要赚赏金
 我要赚赏金 STM32
STM32 MCU
MCU 通讯及无线技术
通讯及无线技术 物联网技术
物联网技术 电子DIY
电子DIY 板卡试用
板卡试用 基础知识
基础知识 软件与操作系统
软件与操作系统 我爱生活
我爱生活 小e食堂
小e食堂

