📄 io.c
字号:
/// P2.15 is used as alternate input for the Fast External Interrupt 7
/// Input (EX7IN)
/// P2.8 - P2.15 threshold type: TTL input
/// P2.8 - P2.11 output driver characteristic: strong driver
/// P2.12 - P2.15 output driver characteristic: strong driver
/// P2.8 - P2.11 output edge characteristic: sharp edge mode
/// P2.12 - P2.15 output edge characteristic: sharp edge mode
ODP2 = 0x0000; // load open-drain register
P2 = 0x0000; // load data register
ALTSEL0P2 = 0x0000; // load alternate output function select
// register 0
POCON2 = 0x0000; // load output control register
DP2 = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P3:
/// -----------------------------------------------------------------------
/// P3.4 is used as alternate input for the Timer 3 Count Input (T3EUD)
/// P3.6 is used as alternate input for the Timer 3 Count Input (T3IN)
/// P3.10 is used as alternate output for the ASC Transmit Data Output
/// (TxDA0)
/// - push/pull output is selected
/// P3.11 is used as alternate input for the ASC0 Receive data Input
/// (RxDA0)
/// P3.0 - P3.7 threshold type: TTL input
/// P3.8 - P3.15 threshold type: TTL input
/// P3.0 - P3.3 output driver characteristic: strong driver
/// P3.4 - P3.7 output driver characteristic: strong driver
/// P3.8 - P3.11 output driver characteristic: strong driver
/// P3.12 - P3.15 output driver characteristic: strong driver
/// P3.0 - P3.3 output edge characteristic: sharp edge mode
/// P3.4 - P3.7 output edge characteristic: sharp edge mode
/// P3.8 - P3.11 output edge characteristic: sharp edge mode
/// P3.12 - P3.15 output edge characteristic: sharp edge mode
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.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 P6:
/// -----------------------------------------------------------------------
/// P6.0 is used as alternate input for the Chip select (CS0_n)
/// P6.1 is used as alternate input for the Chip select (CS1_n)
/// P6.2 is used as alternate output for the CAPCOM1 Output (CC2IO)
/// - push/pull output is selected
/// P6.3 is used as alternate output for the CAPCOM1 Output (CC3IO)
/// - push/pull output is selected
/// P6.4 is used as alternate output for the CAPCOM1 Output (CC4IO)
/// - push/pull output is selected
/// P6.0 - P6.7 threshold type: TTL input
/// P6.0 - P6.3 output driver characteristic: strong driver
/// P6.4 - P6.7 output driver characteristic: strong driver
/// P6.0 - P6.3 output edge characteristic: sharp edge mode
/// P6.4 - P6.7 output edge characteristic: sharp edge mode
ODP6 = 0x0000; // load open-drain register
P6 = 0x0000; // load data register
ALTSEL0P6 = 0x0000; // load alternate output function select
// register 0
POCON6 = 0x0000; // load output control register
DP6 = 0x0000; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P7:
/// -----------------------------------------------------------------------
/// P7.4 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P7.5 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P7.6 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P7.7 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P7.0 - P7.7 threshold type: TTL input
/// P7.0 - P7.3 output driver characteristic: strong driver
/// P7.4 - P7.7 output driver characteristic: strong driver
/// P7.0 - P7.3 output edge characteristic: sharp edge mode
/// P7.4 - P7.7 output edge characteristic: sharp edge mode
ODP7 = 0x0000; // load open-drain register
P7 = 0x0000; // load data register
ALTSEL0P7 = 0x0000; // load alternate output function select
// register 0
ALTSEL1P7 = 0x0000; // load alternate output function select
// register 1
POCON7 = 0x0000; // load output control register
DP7 = 0x00F0; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P9:
/// -----------------------------------------------------------------------
/// P9.4 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P9.5 is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// P9.0 - P9.7 threshold type: TTL input
/// P9.0 - P9.3 output driver characteristic: strong driver
/// P9.4 - P9.7 output driver characteristic: strong driver
/// P9.0 - P9.3 output edge characteristic: sharp edge mode
/// P9.4 - P9.7 output edge characteristic: sharp edge mode
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 = 0x0030; // 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)
P9=0x0010; // SET PORT 9.4 OUTPUT LATCH
// 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 + -