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

📄 io.c

📁 用c语言实现对单片机端口的设置
💻 C
📖 第 1 页 / 共 2 页
字号:
  ///  P1L.1 is used as alternate output for the Port Pin (A1)
  ///  P1L.2 is used as alternate output for the Port Pin (A2)
  ///  P1L.3 is used as alternate output for the Port Pin (A3)
  ///  P1L.4 is used as alternate output for the Port Pin (A4)
  ///  P1L.5 is used as alternate output for the Port Pin (A5)
  ///  P1L.6 is used as alternate output for the Port Pin (A6)
  ///  P1L.7 is used as alternate output for the Port Pin (A7)

  ///  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           =  0x0000;      // load direction register

  ///  -----------------------------------------------------------------------
  ///  Configuration of Port P2:
  ///  -----------------------------------------------------------------------
  ///  - no pin of port P2 is used

  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.0 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.1 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.2 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.3 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.4 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.5 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.6 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.7 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.8 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.9 is used as general purpose output
  ///  - push/pull output is selected
  ///  - the pin status is low level
  ///  P3.12 is used as alternate output for the Byte High Enable Output 
  ///  (BHE_n)

  ///  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            =  0x03FF;      // 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
  ///  - Port5 Data register P5(Read only)


  ///  -----------------------------------------------------------------------
  ///  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.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:
  ///  -----------------------------------------------------------------------
  ///  - no pin of port P7 is used

  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            =  0x0000;      // load direction 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:
  ///  -----------------------------------------------------------------------
  ///  P20.4 is used as alternate output for the address latch enable signal 
  ///  (ALE)

  ///  P20.0 - P20.7 threshold type: TTL input
  ///  P20.8 - P20.15 threshold type: TTL input

  ///  P20.0 - P20.3 output driver characteristic: strong driver
  ///  P20.4 - P20.7 output driver characteristic: strong driver
  ///  P20.12 - P20.15 output driver characteristic: strong driver

  ///  P20.0 - P20.3 output edge characteristic: sharp edge mode
  ///  P20.4 - P20.7 output edge characteristic: sharp edge mode
  ///  P20.12 - P20.15 output edge characteristic: sharp edge mode

  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 + -