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

📄 mcu.c

📁 Bitek 公司 bit1611b模拟屏驱动芯片外接MCU驱动DEMO源码
💻 C
字号:
/* **********************************************************************

         Copyright (c) 2002-2006 Beyond Innovation Technology Co., Ltd

        All rights are reserved. Reproduction in whole or in parts is
    prohibited without the prior written consent of the copyright owner.
   ----------------------------------------------------------------------

    Module: MCU.C

    Purpose: Implementation of MCU.

    Version: 0.01                                   07:16PM  2005/05/13

    Compiler: Keil 8051 C Compiler v8.01

    Reference:
    [1] BIT5101 8051 MICROCONTROLLER WITH 64K FLASH AND ISP Version 0.01,
        2004/10/25, Beyond Innovation Technology
    [2] TP2804  8051 MICROCONTROLLER WITH 64K FLASH AND ISP Version 1.2,
        June 2004, TOPRO

   ----------------------------------------------------------------------
    Modification:

    R0.01 07:16PM  2005/05/13 Jeffrey Chang
    Reason:
        1. Original.
    Solution:

   ********************************************************************** */


#define  _MCU_C_

/* ------------------------------------
    Header Files
   ------------------------------------ */
#include "mcu.h"
#include "timer.h"

/* ------------------------------------
    Macro Definitions
   ------------------------------------ */

/* ------------------------------------
    Type Definitions
   ------------------------------------ */


/* ------------------------------------
    Variables Definitions
   ------------------------------------ */

/* ------------------------------------
    Function Prototypes
   ------------------------------------ */

/* -------------------------------------------------------------------
    Name: MCU_Init -
    Purpose: To initialize MCU module.
    Passed: None.
    Returns: None.
    Notes:
   ------------------------------------------------------------------- */
void MCU_Init (void)
{
    /* [4]87 Disable interrupts */
    IE0 = 0;
    IE1 = 0;

    /* Initiate I/O PORTs */
    P0 = 0xFF;
    P1 = 0xFF;
    P2 = 0xFF;
    P3 = 0xFF;

    // PANEL POWER should be turned off
    MCU_PANEL_OFF;


    // Backlight should be turned off
    MCU_BL_OFF;



    #if (MCU_CFG == BIT5101)        ||  \
        (MCU_CFG == TP2804)

    P4 = 0x0F;

    /* Interrupt Priority Level [5]18,19, [8]19,20, [9]19,20 */
    IP      = 0x08;     // Timer 1 priority level 3

    /* [5]7 Power control */
    PCON    = 0xC0;     // [3]77 Baud rate is double (SMOD = 1)
                        // Disable power-down and idle modes

    // To use Timer 0 (ET0) as System Timer
    ET0     = 1;        // To confirm TIMER_CFG in TIMER module

    // To use Timer 2 (ET2) as UART baud rate generator
    ET2     = 1;        // To confirm UART_TIMER_CFG in UART module

    CHPCON  = 0x10;     // To enable on-chip AUX-RAM


    #else
        #error MCU.C - Invalid MCU_CFG !
    #endif /* MCU_CFG */


} /* MCU_Init */



/* **********************************************************************

    Description:


   ********************************************************************** */

/* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */

⌨️ 快捷键说明

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