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

📄 mainapp.c

📁 PIC串口程序  可以帮助你编写串口程序  里面还有我自己做的协议 很方便
💻 C
字号:
#include "..\includes\includes.h"

 
__CONFIG(INTIO & WDTDIS & PWRTEN & BOREN&  
     MCLRDIS & PROTECT&FCMDIS&IESODIS&CPD);       



	




#define openGIE()	GIE=1
void sysInit(void)
{	

    TRISA = 0x07; 
    PORTA = 0x00; 
    TRISC = 0x30;
    PORTC = 0x00;
    CMCON0=0x07;
    ANSEL=0x00;
    RAPU=0x00;
    WPUA=0x33;
    userKeyCtlInit();
    systimeInit();
	timer1Init();
    timer1Start();    
    loadDefaultParam();
    DelayNms(10);
}	


void userkeyOperation(void)
{
	uint8 key;
	key = readKeyBuff();
	if (key==0x01)
	{	if (oledGain<135)
		{	oledGain+=1;
			oLedOperator(TYPE_OLED_GAIN);
			saveOledParam();
		}	
	}
	else if (key==0x02)
	{   if (oledGain>85) 
		{	oledGain-=1;	
			oLedOperator(TYPE_OLED_GAIN);
			saveOledParam();	
		}
	 }
	 else if (key==0x03)
	 {	 if (oledOffset<85)
		 {	 oledOffset+=1;
			 oLedOperator(TYPE_OLED_OFFSET);
			saveOledParam();
	     }
  	 }
	 else if (key==0x04)
	 {	 if (oledOffset>40)
		 {	 oledOffset-=1;
			 oLedOperator(TYPE_OLED_OFFSET);
			 saveOledParam();
		 }
	  }
 }


int main(void)
{	
    sysInit();
	InitOled();
    openGIE();
	while(1)
	{	uint8 event;
	   	event=EventBurstWait(0,EVENT_NULL);
		if ((event ==EVENT_KEY_DOWN)||(event ==EVENT_KEY_UP))
		{
			if (event ==EVENT_KEY_DOWN)			    
			    userkeyOperation(); 
			                    
		}		
		
	}
}



⌨️ 快捷键说明

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