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

📄 io.c

📁 用c语言实现对单片机端口的设置
💻 C
📖 第 1 页 / 共 2 页
字号:
//****************************************************************************
// @Module        Parallel Ports
// @Filename      IO.C
// @Project       PORT3.dav
//----------------------------------------------------------------------------
// @Controller    Infineon XC167CI-32F40
//
// @Compiler      Keil
//
// @Codegenerator 2.5
//
// @Description   This file contains functions that use the IO module.
//
//----------------------------------------------------------------------------
// @Date          2007-4-3 11:53:24
//
//****************************************************************************

// USER CODE BEGIN (IO_General,1)

// USER CODE END



//****************************************************************************
// @Project Includes
//****************************************************************************

#include "MAIN.H"

// USER CODE BEGIN (IO_General,2)

// USER CODE END


//****************************************************************************
// @Macros
//****************************************************************************

// USER CODE BEGIN (IO_General,3)

// USER CODE END


//****************************************************************************
// @Defines
//****************************************************************************

// USER CODE BEGIN (IO_General,4)

// USER CODE END


//****************************************************************************
// @Typedefs
//****************************************************************************

// USER CODE BEGIN (IO_General,5)

// USER CODE END


//****************************************************************************
// @Imported Global Variables
//****************************************************************************

// USER CODE BEGIN (IO_General,6)

// USER CODE END


//****************************************************************************
// @Global Variables
//****************************************************************************

// USER CODE BEGIN (IO_General,7)

// USER CODE END


//****************************************************************************
// @External Prototypes
//****************************************************************************

// USER CODE BEGIN (IO_General,8)

// USER CODE END


//****************************************************************************
// @Prototypes Of Local Functions
//****************************************************************************

// USER CODE BEGIN (IO_General,9)

// USER CODE END


//****************************************************************************
// @Function      void IO_vInit(void) 
//
//----------------------------------------------------------------------------
// @Description   This is the initialization function of the IO function 
//                library. It is assumed that the SFRs used by this library 
//                are in its reset state. 
//
//----------------------------------------------------------------------------
// @Returnvalue   None
//
//----------------------------------------------------------------------------
// @Parameters    None
//
//----------------------------------------------------------------------------
// @Date          2007-4-3
//
//****************************************************************************

// USER CODE BEGIN (IO_Function,1)

// USER CODE END

void IO_vInit(void)
{
  // USER CODE BEGIN (IO_Function,2)

  // USER CODE END

  ///  -----------------------------------------------------------------------
  ///  General Port Settings:
  ///  -----------------------------------------------------------------------
  PICON          =  0x0000;      // load input configuration register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P0H:
  ///  -----------------------------------------------------------------------
  ///  P0H.0 is used as alternate output for the Port Pin (AD8)
  ///  P0H.1 is used as alternate output for the Port Pin (AD9)
  ///  P0H.2 is used as alternate output for the Port Pin (AD10)
  ///  P0H.3 is used as alternate output for the Port Pin (AD11)
  ///  P0H.4 is used as alternate output for the Port Pin (AD12)
  ///  P0H.5 is used as alternate output for the Port Pin (AD13)
  ///  P0H.6 is used as alternate output for the Port Pin (AD14)
  ///  P0H.7 is used as alternate output for the Port Pin (AD15)

  ///  P0H.0 - P0H.3 output driver characteristic: strong driver
  ///  P0H.4 - P0H.7 output driver characteristic: strong driver

  ///  P0H.0 - P0H.3 output edge characteristic: sharp edge mode
  ///  P0H.4 - P0H.7 output edge characteristic: sharp edge mode

  P0H            =  0x0000;      // load data register
  POCON0H        =  0x0000;      // load output control register
  DP0H           =  0x0000;      // load direction register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P0L:
  ///  -----------------------------------------------------------------------
  ///  P0L.0 is used as alternate output for the Port Pin (AD0)
  ///  P0L.1 is used as alternate output for the Port Pin (AD1)
  ///  P0L.2 is used as alternate output for the Port Pin (AD2)
  ///  P0L.3 is used as alternate output for the Port Pin (AD3)
  ///  P0L.4 is used as alternate output for the Port Pin (AD4)
  ///  P0L.5 is used as alternate output for the Port Pin (AD5)
  ///  P0L.6 is used as alternate output for the Port Pin (AD6)
  ///  P0L.7 is used as alternate output for the Port Pin (AD7)

  ///  P0L.0 - P0L.3 output driver characteristic: strong driver
  ///  P0L.4 - P0L.7 output driver characteristic: strong driver

  ///  P0L.0 - P0L.3 output edge characteristic: sharp edge mode
  ///  P0L.4 - P0L.7 output edge characteristic: sharp edge mode

  P0L            =  0x0000;      // load data register
  POCON0L        =  0x0000;      // load output control register
  DP0L           =  0x0000;      // load direction register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P1H:
  ///  -----------------------------------------------------------------------
  ///  P1H.0 is used as alternate output for the Port Pin (A8)
  ///  P1H.1 is used as alternate output for the Port Pin (A9)
  ///  P1H.2 is used as alternate output for the Port Pin (A10)
  ///  P1H.3 is used as alternate output for the Port Pin (A11)
  ///  P1H.4 is used as alternate output for the Port Pin (A12)
  ///  P1H.5 is used as alternate output for the Port Pin (A13)
  ///  P1H.6 is used as alternate output for the Port Pin (A14)
  ///  P1H.7 is used as alternate output for the Port Pin (A15)

  ///  P1H.0 - P1H.3 output driver characteristic: strong driver
  ///  P1H.4 - P1H.7 output driver characteristic: strong driver

  ///  P1H.0 - P1H.3 output edge characteristic: sharp edge mode
  ///  P1H.4 - P1H.7 output edge characteristic: sharp edge mode

  P1H            =  0x0000;      // load data register
  ALTSEL0P1H     =  0x0000;      // load alternate output function select 
                                 // register 0
  POCON1H        =  0x0000;      // load output control register
  DP1H           =  0x0000;      // load direction register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P1L:
  ///  -----------------------------------------------------------------------
  ///  P1L.0 is used as alternate output for the Port Pin (A0)
  ///  P1L.1 is used as alternate output for the Port Pin (A1)

⌨️ 快捷键说明

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