2 Commits

Author SHA1 Message Date
e5fe7833e6 修改断开高压开关不休眠 2025-08-18 09:25:26 +08:00
b5f2f3bc5f 植树车适配旧版本采集模块 2025-08-05 07:53:48 +08:00
6 changed files with 108 additions and 56 deletions

View File

@@ -2,6 +2,8 @@
"files.associations": {
"MAIN.C": "cpp",
"CAN.C": "cpp",
"temperature.C": "cpp"
"temperature.C": "cpp",
"IO.C": "cpp",
"PS.C": "cpp"
}
}

File diff suppressed because one or more lines are too long

View File

@@ -320,7 +320,7 @@
<GroupNumber>2</GroupNumber>
<FileNumber>9</FileNumber>
<FileType>1</FileType>
<tvExp>1</tvExp>
<tvExp>0</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<bDave2>0</bDave2>
<PathWithFileName>.\User.c</PathWithFileName>

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)

9
User.c
View File

@@ -155,7 +155,7 @@ void SystemStateMachine(SystemState *RgSTT)
break;
case STATE_ON:
if( (bm8563CheckAlarmFlag()) || (OFF == WAKE_UP_PIN) )//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>عر<D8B9>
if(bm8563CheckAlarmFlag())//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD>Լ<EFBFBD><D4BC><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD>عر<D8B9>
{
bm8563SetTime(&inittime);//20250802 <20><>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊʱ<CEAA><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bm8563SetAlarm(&sleeptime);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
@@ -182,7 +182,7 @@ void SystemStateMachine(SystemState *RgSTT)
break;
case STATE_ON2:
if( (WAKE_UP_PIN == OFF) || (POWER_STANDBY == powerstate) )//<2F>ܿ<EFBFBD><DCBF>عرջ<D8B1><D5BB>߽<EFBFBD><DFBD><EFBFBD>standy
if( POWER_STANDBY == powerstate )//<2F>ܿ<EFBFBD><DCBF>عرջ<D8B1><D5BB>߽<EFBFBD><DFBD><EFBFBD>standy
{
bm8563SetTime(&inittime);//20250802 <20><>ʼ<EFBFBD><CABC>ʱ<EFBFBD><CAB1> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊʱ<CEAA><EFBFBD>Ե<EFBFBD><D4B5><EFBFBD><EFBFBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
bm8563SetAlarm(&sleeptime);
@@ -352,14 +352,15 @@ void CanRXTX(void)
un_inf_can_kgf_output2.bit_data.KGF05 = 0x01;// <20><><EFBFBD><EFBFBD><E7BDBB><EFBFBD><EFBFBD>
un_inf_can_kgf_output2.bit_data.KGF06 = 0x01;// <20><><EFBFBD><EFBFBD><E7BDBB><EFBFBD><EFBFBD>
un_inf_can_kgf_output2.bit_data.KGF04 = 0x01;//KGF20<32>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
un_inf_can_kgf_output2.bit_data.KGF04 = 0x01;//KGF20<32>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD>
if(1 == flg_KGF)//<2F>ȴ<EFBFBD>KGF<47><46><EFBFBD>Ѻ<EFBFBD><D1BA>ٷ<EFBFBD><D9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
{
canSendTo(DF_SwTxKGF2,(ubyte *)&un_inf_can_kgf_output2.arr[0]);
// canSendTo(DF_SwTxKGF1,(ubyte *)&un_inf_can_kgf_output1.arr[0]);
}
}
}
else
{

7
user.H
View File

@@ -15,12 +15,13 @@
#define dfPwmH 10 //PWM<57>ĸߵ<C4B8>ƽʱ<C6BD>䣬10<31><30>10ms<6D><73><EFBFBD>ң<EFBFBD><D2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>20181227
#define WAKE_UP_PIN P1_4 //<2F><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define WAKE_UP_PIN P1_5 //<2F><>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> // <20>޸<EFBFBD>Ϊ<EFBFBD>ɰ汾Ӳ<E6B1BE><D3B2>
#define KGF_PIN P0_0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define CAN_PIN P1_6 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STOP_PIN P1_2 //<2F><>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define STOP_PIN P3_6 //<2F><>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
#define BATTERY_PIN P1_4 //<2F><><EFBFBD>ؿ<EFBFBD><D8BF>ƽ<EFBFBD>
#define BATTERY_PIN P3_6 //<2F><><EFBFBD>ؿ<EFBFBD><D8BF>ƽ<EFBFBD>
#define ON 0 //<2F><><EFBFBD><EFBFBD>