• 大小: 17KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-10
  • 语言: 其他
  • 标签: demo源码  

资源简介

78K0-Kd2系列单片机demo源码78K0-Kd2系列单片机demo源码78K0-Kd2系列单片机demo源码78K0-Kd2系列单片机demo源码78K0-Kd2系列单片机demo源码

资源截图

代码片段和文件信息

/*
*****************************************************************************
**
**  For NEC 78k0/KD2 8-Bit Single-Chip Microcontrollers
**
**  Copyright(C) NEC Electronics Corporation  20022003
**  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.
**
**
**  Device:   Only for uPD78F0524 - uPD78F0527
**  Compiler:  NEC/CC78k0
**
 Parameters: - fastest CPU clock (fx=8.00MHz)
- 32-bit operand A & 16-bit operand B
- generate 32-bit result & 16-bit remainder
- Test 1000 times
-                runtime library | div32by16() 
- Average time :   770.045us  |  17.4us   
- Maximum time :   863.200us     |  17.4us   
- Minimum time :   736.600us     |  17.4us   
*****************************************************************************
*/

#pragma sfr
#pragma nop

#include 

/* Constant value definition */
#define TRUE 1
#define FALSE 0
#define CLEAR 0
#define DISABLE 0
#define ENABLE 1
#define STABILIZE 1

/* Structure / Data type definition */
struct para{
unsigned int opaL;
unsigned int opaH;
unsigned int opb;
};

struct parb{
unsigned long dividend;
unsigned int divisor;
};

struct ret_val{
unsigned long result;
unsigned int remainder;
};

typedef union div_data{
struct para  inp_d0;
struct parb  inp_d1;
struct ret_val out_d;
}DIV_DATA;

/* Global variable */
sreg extern DIV_DATA div_op; /* for div32by16 passing paramater and return value */

sreg unsigned int   divisor;
sreg unsigned long  dividend;
sreg unsigned long  result1result2;
sreg unsigned int   remaind1remaind2;
sreg unsigned int   err_no;

/* Function prototype declaration */
norec extern void div32by16(void);

#pragma section @@CNST SP_ROM AT 080H
const unsigned char opt_byte=0x7E; /* 78K0/Kx2‘s Option Byte */
const unsigned char poc_byte81=0x00;
const unsigned char gap_byte82=0x00;
const unsigned char gap_byte83=0x00;
const unsigned char ocd_byte=0x03; /* 0x00:Disable MINICUBE connection 0x02 and 0x03:Enable On-Chip Debug function */
const unsigned char gap_byte85=0xFF;
#pragma section @@CNST @@CNST

/*========================================================
   Hardware initialization call from startup routine 
========================================================*/
void hdwinit(void)
{
  /* Stop Watchdog operation */
  LSRSTOP=ENABLE; /* Low-speed Ring-OSC stopped */
  while(RSTS!=STABILIZE) NOP(); /* Wait for High Speed Ring-OSC stabilized */

  MCM=0x00; /* select main system clock source = high-speed Ring-OSC */
                /* peripheral clock source = high-speed Ring-OSC */

  MOC=0x80; /* High speed system clock (X1 oscillator) operation stop */
  OSCCTL=0x00; /* X1X2 XT1 and XT2 are I/O

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1765  2006-01-16 20:30  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)\DEFINE.H

     文件       4272  2006-01-18 13:51  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)\main-3wire.asm

     文件         63  2004-07-07 11:32  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)\MAIN-3wire.INC

     文件       2015  2006-01-17 13:08  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)\UART_TX.asm

     文件        294  2006-01-16 20:00  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)\UART_TX.INC

     文件       3928  2006-10-03 07:57  78F052x(78K0-KD2)\Divider(Hardware)\c-language\div_dm.c

     文件       4778  2005-07-06 16:21  78F052x(78K0-KD2)\Divider(Hardware)\c-language\hdivf.asm

     文件       2592  2005-07-06 16:32  78F052x(78K0-KD2)\Divider(Hardware)\c-language\hdivf.c

     文件       6868  2006-10-03 07:57  78F052x(78K0-KD2)\Key_INT(INTKR)\c-language\key_int_dm.c

     文件       4473  2006-10-03 07:57  78F052x(78K0-KD2)\Multiplier(Hardware)\c-language\mult_dm.c

     文件       4495  2006-10-03 07:57  78F052x(78K0-KD2)\TM51(Interval-10ms)\c-language\tm51_dm.c

     文件       4273  2006-10-03 07:57  78F052x(78K0-KD2)\watchtimer(hour-min-sec)\c-language\wt_dm.c

     文件       3729  2006-10-03 07:57  78F052x(78K0-KD2)\watchtimer(interval-7ms81)\c-language\wti_dm.c

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\3-wiredSerial(CSI10)\ASM-language(CALLT)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Divider(Hardware)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Key_INT(INTKR)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Multiplier(Hardware)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\TM51(Interval-10ms)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\watchtimer(hour-min-sec)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\watchtimer(interval-7ms81)\c-language

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\3-wiredSerial(CSI10)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Divider(Hardware)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Key_INT(INTKR)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\Multiplier(Hardware)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\TM51(Interval-10ms)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\watchtimer(hour-min-sec)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)\watchtimer(interval-7ms81)

     目录          0  2006-12-22 16:20  78F052x(78K0-KD2)

----------- ---------  ---------- -----  ----

                43545                    28

............此处省略1个文件信息

评论

共有 条评论