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

📄 ticlength.c

📁 aduc842的c程序例子
💻 C
字号:
//********************************************************************
//
// Author        : ADI - Apps            www.analog.com/MicroConverter
//
// Date          : October 2003
//
// File          : ticlength.c
//
// Hardware      : ADuC842/ADuC843
//
// Description   : Demonstrates the use of the Time Interval Counter to
//					count an interval of 96 hours		
//					A message is displayed constantly on the hyperterminal window
//					after the time has elapsed.
//					Note: This code can be chaged to 96second period by
//					setting Timecon=0x01B; to show its use 	
//********************************************************************

#include <stdio.h> 
#include <ADuC842.h>

sbit LED = 0x0B4;

void TIC_int () interrupt 10
{
	TIMECON=0x00;
	LED ^= 1;
}

void main (void)
{
						//Configure the baud rate 9600
	T3CON = 0x83;
	T3FD  = 0x2D;
	SCON  = 0x52;

						//Configure Time Interval Counter  
	TIMECON = 0x3B; 	// configure the Time Interval Counter to count a single period in hours
					  	//set to 0x01B to time 96 seconds
	INTVAL = 0x60;   	// 96 hours

						//Configure External Interrupt
	IEIP2 = 0xA4;   	// enable TIC interrupt
   	EA = 1;				// enable interrupts

	PCON = 0x22;		// enterpowerdown
	while (1)
	{
	printf("96 Hour Have Elapsed\n");
	}
}

⌨️ 快捷键说明

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