📄 io.c
字号:
//****************************************************************************
// @Module Parallel Ports
// @Filename IO.C
// @Project BUTTON1.dav
//----------------------------------------------------------------------------
// @Controller Infineon XC164CS-16F20
//
// @Compiler Keil
//
// @Codegenerator 2.8
//
// @Description This file contains functions that use the IO module.
//
//----------------------------------------------------------------------------
// @Date 2007-5-25 14:37:35
//
//****************************************************************************
// 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-5-25
//
//****************************************************************************
// 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:
/// -----------------------------------------------------------------------
/// - no pin of port P0H is used
P0H = 0x0000; // load data register
POCON0H = 0x0000; // load output control register
DP0H = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P0L:
/// -----------------------------------------------------------------------
/// - no pin of port P0L is used
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 general input
/// 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 general purpose output
/// - the pin status is low level
/// P1L.0 - P1L.3 output driver characteristic: strong driver
/// P1L.4 - P1L.7 output driver characteristic: strong driver
/// P1L.0 - P1L.3 output edge characteristic: sharp edge mode
/// P1L.4 - P1L.7 output edge characteristic: sharp edge mode
P1L = 0x0000; // load data register
ALTSEL0P1L = 0x0000; // load alternate output function select
// register 0
POCON1L = 0x0000; // load output control register
DP1L = 0x0001; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P3:
/// -----------------------------------------------------------------------
/// - no pin of port P3 is used
ODP3 = 0x0000; // load open-drain register
P3 = 0x0000; // load data register
ALTSEL0P3 = 0x0000; // load alternate output function select
// register 0
ALTSEL1P3 = 0x0000; // load alternate output function select
// register 1
POCON3 = 0x0000; // load output control register
DP3 = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P4:
/// -----------------------------------------------------------------------
/// P4.0 is used as alternate input for the Port Pin (A16)
/// P4.1 is used as alternate input for the Port Pin (A17)
/// P4.2 is used as alternate input for the Chip select (CS1_n)
/// P4.3 is used as alternate input for the Chip select (CS0_n)
/// P4.0 - P4.7 threshold type: TTL input
/// P4.0 - P4.3 output driver characteristic: strong driver
/// P4.4 - P4.7 output driver characteristic: strong driver
/// P4.0 - P4.3 output edge characteristic: sharp edge mode
/// P4.4 - P4.7 output edge characteristic: sharp edge mode
ODP4 = 0x0000; // load open-drain register
P4 = 0x0000; // load data register
ALTSEL0P4 = 0x0000; // load alternate output function select
// register 0
ALTSEL1P4 = 0x0000; // load alternate output function select
// register 1
POCON4 = 0x0000; // load output control register
DP4 = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P5:
/// -----------------------------------------------------------------------
/// - no pin of port P5 is used
P5 = 0x0000; // load data register
/// -----------------------------------------------------------------------
/// Configuration of Port P9:
/// -----------------------------------------------------------------------
/// - no pin of port P9 is used
ODP9 = 0x0000; // load open-drain register
P9 = 0x0000; // load data register
ALTSEL0P9 = 0x0000; // load alternate output function select
// register 0
ALTSEL1P9 = 0x0000; // load alternate output function select
// register 1
POCON9 = 0x0000; // load output control register
DP9 = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P20:
/// -----------------------------------------------------------------------
/// - no pin of port P20 is used
P20 = 0x0000; // load data register
POCON20 = 0x0000; // load output control register
DP20 = 0x0000; // load direction register
// USER CODE BEGIN (IO_Function,3)
// USER CODE END
} // End of function IO_vInit
// USER CODE BEGIN (IO_General,10)
// USER CODE END
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -