植树车适配旧版本采集模块

This commit is contained in:
2025-08-05 07:53:48 +08:00
parent ad771ee812
commit b5f2f3bc5f
6 changed files with 106 additions and 54 deletions

53
IO.C
View File

@@ -188,29 +188,26 @@ void IO_vInit(void)
/// - is used as general input
/// - pull-up device is assigned
/// P1.4:
/// - is used as general input
/// - pull-up device is assigned
/// P1.5:
/// - is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// - pull-down device is assigned
/// - pull device is disabled (tristate)
/// P1.5:
/// - is used as general input
/// - pull-up device is assigned
/// P1.6:
/// - is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// - pull device is disabled (tristate)
SFR_PAGE(_pp3, noSST); // switch to page 3
P1_OD = 0x00; // load open-drain register
SFR_PAGE(_pp1, noSST); // switch to page 1
P1_PUDSEL = 0xDF; // load pullup/pulldown select register
P1_PUDEN = 0xBF; // load pullup/pulldown enable register
P1_PUDSEL = 0xFF; // load pullup/pulldown select register
P1_PUDEN = 0xAF; // load pullup/pulldown enable register
SFR_PAGE(_pp0, noSST); // switch to page 0
P1_DIR = 0x60; // load direction register
P1_DIR = 0x50; // load direction register
/// -----------------------------------------------------------------------
/// Configuration of Port P2:
@@ -223,62 +220,50 @@ void IO_vInit(void)
/// P3.2:
/// - is used as general purpose output
/// - open drain output is selected
/// - the pin status is low level
/// - the pin status is high level
/// - pull-up device is assigned
/// P3.3:
/// - is used as general purpose output
/// - open drain output is selected
/// - the pin status is low level
/// - the pin status is high level
/// - pull-up device is assigned
/// P3.4:
/// - is used as general purpose output
/// - open drain output is selected
/// - the pin status is low level
/// - the pin status is high level
/// - pull-up device is assigned
/// P3.5:
/// - is used as general purpose output
/// - open drain output is selected
/// - the pin status is low level
/// - the pin status is high level
/// - pull-up device is assigned
/// P3.6:
/// - is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// - pull-down device is assigned
/// P3.7:
/// - is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// - pull-down device is assigned
/// - is used as general input
/// - pull-up device is assigned
SFR_PAGE(_pp3, noSST); // switch to page 3
P3_OD = 0x3C; // load open-drain register
SFR_PAGE(_pp1, noSST); // switch to page 1
P3_PUDSEL = 0x3F; // load pullup/pulldown select register
P3_PUDEN = 0xFC; // load pullup/pulldown enable register
P3_PUDSEL = 0xFF; // load pullup/pulldown select register
P3_PUDEN = 0x7C; // load pullup/pulldown enable register
SFR_PAGE(_pp0, noSST); // switch to page 0
P3_DIR = 0xFC; // load direction register
P3_DIR = 0x3C; // load direction register
P3_DATA = 0x3C; // load data output register
/// -----------------------------------------------------------------------
/// Configuration of Port P4:
/// -----------------------------------------------------------------------
/// P4.3:
/// - is used as general purpose output
/// - push/pull output is selected
/// - the pin status is low level
/// - pull-down device is assigned
/// - is used as general input
/// - pull-up device is assigned
SFR_PAGE(_pp1, noSST); // switch to page 1
P4_PUDSEL = 0x00; // load pullup/pulldown select register
P4_PUDEN = 0x08; // load pullup/pulldown enable register
SFR_PAGE(_pp0, noSST); // switch to page 0
P4_DIR = 0x08; // load direction register
// USER CODE BEGIN (IO_Init,3)