macrodriver.h
来自「NEC 的无线通讯方案」· C头文件 代码 · 共 161 行
H
161 行
/*
* $Id: macrodriver.h,v 1.16 2007/08/17 06:21:52 sunny Exp $
*/
/*
*******************************************************************************
**
** 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 : macrodriver.h
** Abstract : This is the general header file
** APIlib: NEC78K0KX2.lib V1.01 [09 Aug. 2005]
**
** Device : uPD78F0537, uPD78F0514
**
** Compiler: NEC/CC78K0
**
*******************************************************************************
*/
#ifndef _MDSTATUS_
#define _MDSTATUS_
#pragma sfr
#pragma di
#pragma ei
#pragma NOP
#pragma HALT
#pragma STOP
#include "config.h"
#include "type.h"
#define ON 1
#define OFF 0
#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif
#define IDLE 0 /* idle status */
#define READ 1 /* read mode */
#define WRITE 2 /* write mode */
#define SET 1
#define CLEAR 0
#define MD_STATUS unsigned short
#define MD_STATUSBASE 0x0
/* status list definition */
#define MD_OK MD_STATUSBASE+0x0 /* register setting OK */
#define MD_RESET MD_STATUSBASE+0x1 /* reset input */
#define MD_SENDCOMPLETE MD_STATUSBASE+0x2 /* send data complete */
#define MD_OVF MD_STATUSBASE+0x3 /* timer count overflow */
/* error list definition */
#define MD_ERRORBASE 0x80
#define MD_ERROR MD_ERRORBASE+0x0 /* error */
#define MD_RESOURCEERROR MD_ERRORBASE+0x1 /* no resource available */
#define MD_PARITYERROR MD_ERRORBASE+0x2 /* UARTn parity error */
#define MD_OVERRUNERROR MD_ERRORBASE+0x3 /* UARTn overrun error */
#define MD_FRAMEERROR MD_ERRORBASE+0x4 /* UARTn frame error */
#define MD_ARGERROR MD_ERRORBASE+0x5 /* Error agrument input error */
#define MD_TIMINGERROR MD_ERRORBASE+0x6 /* Error timing operation error */
#define MD_SETPROHIBITED MD_ERRORBASE+0x7 /* setting prohibited */
#define MD_DATAEXISTS MD_ERRORBASE+0x8 /* Data to be transferred next exists in TXBn register */
#define MD_SPT MD_STATUSBASE+0x8 /*IIC stop*/
#define MD_NACK MD_STATUSBASE+0x9 /*IIC no ACK*/
#define MD_SLAVE_SEND_END MD_STATUSBASE+0x10 /*IIC slave send end*/
#define MD_SLAVE_RCV_END MD_STATUSBASE+0x11 /*IIC slave receive end*/
#define MD_MASTER_SEND_END MD_STATUSBASE+0x12 /*IIC master send end*/
#define MD_MASTER_RCV_END MD_STATUSBASE+0x13 /*IIC master receive end*/
/* main clock and subclock as clock source */
enum ClockMode { HiRingClock, SysClock };
/* the value for IMS and IXS */
#ifdef uPD78F0514_48
#define MEMORY_IMS_SET 0xCC
#define MEMORY_IXS_SET 0x0A
#elif defined( uPD78F0525_52 )
#define MEMORY_IMS_SET 0xCF
#define MEMORY_IXS_SET 0x08
#elif defined( uPD78F0537_64 ) || defined( uPD78F0547_80 )
#define MEMORY_IMS_SET 0xCC
#define MEMORY_IXS_SET 0x00
#else
#error "Unknown MCU type defined."
#endif // #ifdef uPD78F0514_48
/* clear IO register bit and set IO register bit */
#define ClrIORBit(Reg, ClrBitMap) Reg &= ~ClrBitMap
#define SetIORBit(Reg, SetBitMap) Reg |= SetBitMap
enum INTLevel { Highest, Lowest };
#define SYSTEMCLOCK 8000000
#define SUBCLOCK 32768
#define MAINCLOCK 8000000
#define FRCLOCK 8000000
#define FRCLOCKLOW 240000
#ifdef uPD78F0547_80
#ifndef __F054780_
#error "Please change project setting"
#endif
#include "780547.h"
#elif defined( uPD78F0537_64 )
#ifndef __F053764_
#error "Please change project setting"
#endif
#include "780537.h"
#elif defined( uPD78F0525_52 )
#ifndef __F052552_
#error "Please change project setting"
#endif
#include "780525.h"
#elif defined( uPD78F0514_48 )
#ifndef __F051448_
#error "Please change project setting"
#endif
#include "780514.h"
#else
#error "Unknown MCU type defined."
#endif
#define LINK_LED LED2
#define RXTX_LED LED3
#define SAME_LED_LINK_RXTX 0
#define POLLING_LED LED4
#define UART_LED LED4
#define SAME_LED_POLLING_UART 1
#define USER_LED POLLING_LED
/////////////////////////////////////////////////////////////////////
//
// 2007/6/25 09:54, Sunny: Macros for U-NET01
//
#define DisInt() DI()
#define EnabInt() EI()
#define DisMcuInt() DI()
#define EnabMcuInt() EI()
#endif
#include "api.h"
#include "data.h"
#include "serial.h"
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?