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

📄 main.c

📁 the timer control demo source for the NEC mcu
💻 C
字号:
/*
*******************************************************************************
**
**  This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
**  78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
**
**  Copyright(C) NEC Electronics Corporation 2002 - 2005
**  All rights reserved by NEC Electronics Corporation.
**
**  This program should be used on your own responsibility.
**  NEC Electronics Corporation assumes no responsibility for any losses
**  incurred by customers or third parties arising from the use of this file.
**
**  Filename : main.c
**  Abstract : This file implements main function
**  APIlib:  NEC78K0KX2.lib V1.00 [21 Jul. 2005]
**
**  Device :	uPD78F0547
**
**  Compiler:  NEC/CC78K0
**
*******************************************************************************
*/
#pragma sfr
#pragma ei
/*
*******************************************************************************
**  Include files
*******************************************************************************
*/
#include "timer.h"
/*
*******************************************************************************
**  MacroDefine
*******************************************************************************
*/

/* the value for IMS and IXS */
#define  MEMORY_IMS_SET		0xCC
#define  MEMORY_IXS_SET		0x00

int lcount = 0;
int ladd = 1;
int lint = 2;

void led8(int num){
 	static unsigned char led_7seg[] = {
	/* 0     1     2     3     4     5     6     7  */
	0x3f, 0x06, 0x5b, 0x4f, 0x66, 0x6d, 0x7d, 0x07,
	/* 8     9     a     b     c     d     e     f  black */
	0x7f, 0x67, 0x77, 0x7c, 0x39, 0x5e, 0x79, 0x71, 0x00
 	};
 	
	P5 = ~led_7seg[num];
}

/*
**-----------------------------------------------------------------------------
**
**  Abstract:
**	main function
**
**  Parameters:
**	None
**
**  Returns:
**	None
**
**-----------------------------------------------------------------------------
*/
void main( void )
{
	IMS = MEMORY_IMS_SET;
	IXS = MEMORY_IXS_SET;
	/* TODO. add user code */
	EI();
	
	PM5 = 0;
	
while(1){
	lint = 2;
	TM00_Init();
	TM00_Enable();
	TMMK000 = 0;
	while(lcount < 9);
	TM00_Disable();
	lcount = 0;
	
	TM01_Init();
	TM01_Enable();
	TMMK001 = 0;
	while(lcount <9);
	TM01_Disable();
	lcount = 0;
	
	lint = 4;
	TM50_Init();
	TM50_Enable();
	TMMK50 = 0;
	while(lcount < 9);
	TM50_Disable();
	lcount = 0;
	
	lint = 8;
	TM51_Init();
	TM51_Enable();
	TMMK51 = 0;
	while(lcount < 9);
	TM51_Disable();
	lcount = 0;
	
	lint = 32;
	TMH0_Init();
	TMH0_Enable();
	TMMKH0 = 0;
	while(lcount < 9);
	TMH0_Disable();
	lcount = 0;
	
	lint = 8;
	TMH1_Init();
	TMH1_Enable();
	TMMKH1 = 0;
	while(lcount < 9);
	TMH1_Disable();
	lcount = 0;
	}
	
	while(1){
		;
	}
}

⌨️ 快捷键说明

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