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

📄 mcu_constants.h

📁 摩托罗拉08单片机flash程序 采用CodeWarrior开发
💻 H
字号:
/*==================================================================*
 *                                                 
 * Copyright (c) 2002, Motorola Inc.
 * Motorola Application Note
 *
 * File name    : MCU_constants.h
 * Author       : Mauricio Capistran-Garza
 * Department   : Guadalajara - SPS
 *
 * Description  : It contains the defines needed for all constants
 *                used in flash_api.c for the following MCUs:
 *                                                    MC68HC908GR8, 
 *                                                    MC68HC908KX8, 
 *                                                    MC68HC908JL3, 
 *                                                    MC68HC908JK3, 
 *                                                    MC68HC908JB8. 
 *
 * History      :
 *
 *==================================================================*/

#ifndef __MCU_CONSTANTS_H__
#define __MCU_CONSTANTS_H__

#include <MC68HC908JL3.h>

/* API Configuration */

#define MASSBIT            0x06   // CTRLBYT MASS ERASE BIT = 6
#ifndef FLCR
    #define FLCR           0xFE08 // FLASH CONTROL REGISTER
#endif    

#ifdef MC68HC908GR8
    /* Communication Port Constants */
    #define COMMPORT       PTA
    #define COMMPORT_DIR   DDRA
    #define COMMPORT_ADDR  0x00    

    /* FLASH Constants */
//  #define FLASH_START    0xEC00
    #define PAGE_SIZE      32

    /* RAM Constants */
    #define RAMSTART       0x40
    #define CTRLBYT        (*(volatile unsigned char*)(0x48))
    #define CPUSPD         (*(volatile unsigned char*)(0x49))
    #define LADDRH         (*(volatile unsigned char*)(0x4A))
    #define LADDRL         (*(volatile unsigned char*)(0x4B))
    #define DATA(X)        (*(volatile unsigned char*)(0x4C + X))
    /* ROM-resident Routines Constants */
    #define GETBYTE()      {__asm jsr 0x1C00;}
    #define RDVRRNG()      {__asm jsr 0x1C03;}
    #define ERARNGE()      {__asm jsr 0x1D06;}
    #define PRGRNGE()      {__asm jsr 0x1C09;}
    #define DELNUS()       {__asm jsr 0x1D0C;}
    #define GET_BIT()      {__asm jsr 0xFED2;}
    #define PUT_BYTE()     {__asm jsr 0xFEAE;}
#endif  // MC68HC908GR8

#ifdef MC68HC908KX8
    /* Communication Port Constants */
    #define COMMPORT       PTA
    #define COMMPORT_DIR   DDRA
    #define COMMPORT_ADDR  0x00    

    /* FLASH Constants */
//  #define FLASH_START    0xEC00
    #define PAGE_SIZE      32

    /* RAM Constants */
    #define RAMSTART       0x40
    #define CTRLBYT        (*(volatile unsigned char*)(0x48))
    #define CPUSPD         (*(volatile unsigned char*)(0x49))
    #define LADDRH         (*(volatile unsigned char*)(0x4A))
    #define LADDRL         (*(volatile unsigned char*)(0x4B))
    #define DATA(X)        (*(volatile unsigned char*)(0x4C + X))

    /* ROM-resident Routines Constants */
    #define GETBYTE()      {__asm jsr 0x1000;}
    #define RDVRRNG()      {__asm jsr 0x1003;}
    #define ERARNGE()      {__asm jsr 0x1006;}
    #define PRGRNGE()      {__asm jsr 0x1009;}
    #define DELNUS()       {__asm jsr 0x100C;}
    #define GET_BIT()      {__asm jsr 0xFECE;}
    #define PUT_BYTE()     {__asm jsr 0xFEAA;}
#endif  // MC68HC908KX8

#ifdef MC68HC908JL3   //  || MC68HC908JK3
    /* Communication Port Constants */
    #define COMMPORT       PTB
    #define COMMPORT_DIR   DDRB
    #define COMMPORT_ADDR  0x01

    /* FLASH Constants */
    #define FLASH_START    0xEC00
    #define PAGE_SIZE      32

    /* RAM Constants */
    #define RAMSTART       0x80
    #define CTRLBYT        (*(volatile unsigned char*)(0x88))
    #define CPUSPD         (*(volatile unsigned char*)(0x89))
    #define LADDRH         (*(volatile unsigned char*)(0x8A))
    #define LADDRL         (*(volatile unsigned char*)(0x8B))
    #define DATA(X)        (*(volatile unsigned char*)(0x8C + X))

    /* ROM-resident Routines Constants */
    #define GETBYTE()      {__asm jsr 0xFC00;}
    #define RDVRRNG()      {__asm jsr 0xFC03;}
    #define ERARNGE()      {__asm jsr 0xFC06;}
    #define PRGRNGE()      {__asm jsr 0xFC09;}
    #define DELNUS()       {__asm jsr 0xFC0C;}
    #define GET_BIT()      {__asm jsr 0xFF00;}
    #define PUT_BYTE()     {__asm jsr 0xFED0;}
#endif  // MC68HC908JL3 || MC68HC908JK3

#ifdef MC68HC908JB8
    /* Communication Port Constants */
    #define COMMPORT       PTA
    #define COMMPORT_DIR   DDRA
    #define COMMPORT_ADDR  0x00    

    /* FLASH Constants */
//  #define FLASH_START    0xEC00
    #define PAGE_SIZE      64

    /* RAM Constants */
    #define RAMSTART       0x40
    #define CTRLBYT        (*(volatile unsigned char*)(0x48))
    #define CPUSPD         (*(volatile unsigned char*)(0x49))
    #define LADDRH         (*(volatile unsigned char*)(0x4A))
    #define LADDRL         (*(volatile unsigned char*)(0x4B))
    #define DATA(X)        (*(volatile unsigned char*)(0x4C + X))

    /* ROM-resident Routines Constants */
    #define GETBYTE()      {__asm jsr 0xFC00;}
    #define RDVRRNG()      {__asm jsr 0xFC03;}
    #define ERARNGE()      {__asm jsr 0xFC06;}
    #define PRGRNGE()      {__asm jsr 0xFC09;}
    #define DELNUS()       {__asm jsr 0xFC0C;}
    #define GET_BIT()      {__asm jsr 0xFF00;}
    #define PUT_BYTE()     {__asm jsr 0xFED5;}
#endif  // MC68HC908JB8

#endif  //__MCU_CONSTANTS_H__

⌨️ 快捷键说明

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