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

📄 main.c

📁 此程序为DP256的开关采集实验程序,已经通过实验证明
💻 C
字号:
#include "LIN_Header.h"

#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module. Placement will be in NON_BANKED area. */
interrupt void RTI_ISR(void) { /* simple RTI interrupt service routine */
  /* clear RTIF bit */
  CRGFLG = 0x80;  
  LIN_CurrentTime++;
}

#pragma CODE_SEG DEFAULT
static void RTIInit(void) {
  /* setup of the RTI interrupt frequency */
  /* adjusted to get 1 millisecond (1.024 ms) with 16 MHz oscillator */
  RTICTL = 0x1F; /* set RTI prescaler */ 
  CRGINT = 0x80; /* enable RTI interrupts */ 
	LIN_CurrentTime = 0;
}

void main(void) {
  /* put your own code here */
#if	SWTITCH_TEST_MODE 	== 1
  	unsigned int wETCTimer;
	SWITCHTEST_PIN0_MSK	= 1;
	SWITCHTEST_PIN0		= 0;
	SWITCHTEST_PIN1_MSK	= 1;
	SWITCHTEST_PIN1		= 0;
	SWITCHTEST_PIN2_MSK	= 1;
	SWITCHTEST_PIN2		= 0;
	SWITCHTEST_PIN3_MSK	= 1;
	SWITCHTEST_PIN3		= 0;
	Swt_stTest			= 0;
	wETCTimer			= 0;
  	Swt_tiSteady = 49;
#endif
  RTIInit();
  EnableInterrupts;
  for(;;)
  {
  	Swt_GetInput();
#if	SWTITCH_TEST_MODE 	== 1
	if(LIN_CheckTimeOut(wETCTimer, LIN_GetCurrentTime(), Swt_tiSteady))
	{
		wETCTimer	= LIN_GetCurrentTime();	
		if(Swt_stTest == 0) Swt_stTest = 0xff;
		else Swt_stTest = 0;
	}
	SWITCHTEST_PIN0		= Swt_stKeyACC;
	SWITCHTEST_PIN1		= Swt_stKeyStrt;
	SWITCHTEST_PIN2		= Swt_stKeyON;
	SWITCHTEST_PIN3		= Swt_stBrake;
#endif
  }
}

⌨️ 快捷键说明

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