⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main program.c

📁 基于s3c2410硬件的 U-boot代码
💻 C
字号:
#include "main.h"
volatile 		BButtons Buttons;
const unsigned char Duty[16]={1,4,8,12,15,20,25,30,40,50,60,70,80,90,95,100};
unsigned char DV; 
void 
main(void)
{
 unsigned char i,j;
Init();



 
while(1){
 
Led0 = (Buttons.Btn0== 1) ? ON : OFF;	// (if : else)

Led1 = (Buttons.Btn1== 1) ? ON : OFF;	// (if : else)
 if(Buttons.Btn0==1){
    for(i=0;i<10;i++)
    DelayMs(250);
    if(DV==DutyMax){
    //for(i=1;i<=16;i++)
    //LcdEmpty(i);
    //DV=DutyMin;
    //LcdFull(DV+1);
    }else{
    for(i=Duty[DV];i<Duty[DV+1];i++){
     for(j=0;j<6;j++)
     DelayMs(250);
     PwmValueSetup(i);
    }
    DV++;
    LcdFull(DV+1);
    }//over else
    PwmValueSetup(Duty[DV]);
    

   } //over Btn0;

if(Buttons.Btn1==1){
     for(i=0;i<10;i++)
     DelayMs(250);
     
     if(DV==DutyMin){
     //for(i=1;i<=16;i++)
     //LcdFull(i);
    
      //DV=DutyMax;
     }else{
     for(i=Duty[DV];i>Duty[DV-1];i--){
     for(j=0;j<6;j++)
     DelayMs(250);
     PwmValueSetup(i);
    }
     LcdEmpty(DV+1);
     DV--;
      
     } //over else
      PwmValueSetup(Duty[DV]);

     
     }  //over Btn1;
   
        
    
    
   
     
    
   

   
   
 
  
 

 
 

}//OVER WHILE(1) LOOP

/*do
{
RA6=0;
RA7=0;
DelayMs(250);
RA6=1;
RA7=1;
DelayMs(250);
}while(1);
*/
}
void
Init(void)
{
unsigned char i;
FoscSetup();
LcdSet();
LcdClear();
LCD_hanzi(1,33,1,4);
for(i=1;i<=16;i++)
LcdEmpty(i);
for(i=1;i<=16;i++)
LcdFull(i);
//LcdEmpty(3);
CapInit();
 
 PwmSetup(Duty[DutyMax]); //启动PWM模块
 DV=DutyMax;
}
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -