LPC824 has an M0 chip
Although there are some flaws
Good low power consumption
In power-down mode, it is easy to achieve a few uA
The trouble is that you need to carefully adjust the settings of each IO pin
The attached is a list of all configurable pins.
By setting each pin in pinEnergySavingTable
To debug the final power consumption
You need to download the LPC824 library files chip_8xx and chip_common from the NXP official website to support
The microcontroller source program is as follows:
#include "includes.h"
#include "energy.h"
enum {
INPUT = 0,
OUTPUT = 1,
};
enum {
LOW = 0,
HIGH = 1,
};
const struct struPinEnergySavingTable pinEnergySavingTable[] = {
{
.pin = 0,
.iocon = IOCON_PIO0,
.dir = 1,
.level = 0,
},
{
.pin = 1,
.iocon = IOCON_PIO1,
.dir = 1,
.level = 0,
},
{
.pin = 2,
.iocon = IOCON_PIO2,
.dir = 0,
}, // SWM_FIXED_SWDIO
{
.pin = 3,
.iocon = IOCON_PIO3,
.dir = 0,
}, // SWM_FIXED_SWCLK
{
.pin = 4,
.iocon = IOCON_PIO4,
.dir = 1,
.level = 0,
},
{
.pin = 5,
.iocon = IOCON_PIO5,
.dir = 0,
}, // RESET
{
.pin = 6,
.iocon = IOCON_PIO6,
.dir = 1,
.level = 0,
},
{
.pin = 7,
.iocon = IOCON_PIO7,
.dir = 0,
}, // SWM_FIXED_ADC0
{
.pin = 8,
.iocon = IOCON_PIO8,
.dir = 1,
.level = 0,
},
{
.pin = 9,
.iocon = IOCON_PIO9,
.dir = 1,
.level = 0,
},
{
.pin = 10,
.iocon = IOCON_PIO10,
.dir = 1,
.level = 0,
},
{
.pin = 11,
.iocon = IOCON_PIO11,
.dir = 1,
.level = 0,
},
{
.pin = 12,
.iocon = IOCON_PIO12,
.dir = 1,
.level = 0,
},
{
.pin = 13,
.iocon = IOCON_PIO13,
.dir = 1,
.level = 0,
},
{
.pin = 14,
.iocon = IOCON_PIO14,
.dir = 1,
.level = 0,
},
{
.pin = 15,
.iocon = IOCON_PIO15,
.dir = 0,
},
{
.pin = 16,
.iocon = IOCON_PIO16,
.dir = 1,
.level = 1,
},
{
.pin = 17,
.iocon = IOCON_PIO17,
.dir = 1,
.level = 0,
},
{
.pin = 18,
.iocon = IOCON_PIO18,
.dir = 1,
.level = 0,
},
{
.pin = 19,
.iocon = IOCON_PIO19,
.dir = 1,
.level = 0,
},
{
.pin = 20,
.iocon = IOCON_PIO20,
.dir = 1,
.level = 0,
},
{
.pin = 21,
.iocon = IOCON_PIO21,
.dir = 1,
.level = 0,
},
{
.pin = 22,
.iocon = IOCON_PIO22,
.dir = 1,
.level = 0,
},
{
.pin = 23,
.iocon = IOCON_PIO23,
.dir = 0,
},
{
.pin = 24,
.iocon = IOCON_PIO24,
.dir = 0,
},
{
.pin = 25,
.iocon = IOCON_PIO25,
.dir = 1,
.level = 0,
},
{
.pin = 26,
.iocon = IOCON_PIO26,
.dir = 1,
.level = 0,
},
{
.pin = 27,
.iocon = IOCON_PIO27,
.dir = 1,
.level = 1,
},
{
.pin = 28,
.iocon = IOCON_PIO28,
.dir = 1,
.level = 0,
},
};
#define PIN_ENERGY_SAVING_NUM (sizeof(pinEnergySavingTable) / sizeof(struct struPinEnergySavingTable))
static inline void PinEnergySaving(const struct struPinEnergySavingTable *saving)
{
Chip_IOCON_PinSetMode(LPC_IOCON, saving->iocon, PIN_MODE_INACTIVE);
if (saving->dir) {
Chip_GPIO_SetPinDIROutput(LPC_GPIO_PORT, 0, saving->pin);
if (saving->level) {
Chip_GPIO_SetPinOutHigh(LPC_GPIO_PORT, 0, saving->pin);
} else {
Chip_GPIO_SetPinOutLow(LPC_GPIO_PORT, 0, saving->pin);
}
} else {
Chip_GPIO_SetPinDIRInput(LPC_GPIO_PORT, 0, saving->pin);
}
}
void EnergyPeripheral(void)
{
int i;
for (i = 0; i < 9; i++) {
LPC_SWM->PINASSIGN[i] = 0xFFFFFFFF;
}
LPC_SWM->PINENABLE0 |= (1 << (SWM_FIXED_ADC11 + 1)) - 1;
for (i = 0; i < PIN_ENERGY_SAVING_NUM; i++) {
PinEnergySaving(&pinEnergySavingTable[i]);
}
}
void PowerDownMode(void)
{
// 6.7.6.2 Programming Power-down mode
// Select the power configuration in Power-down mode in the PDSLEEPCFG
Chip_SYSCTL_SetDeepSleepPD(SYSCTL_DEEPSLP_BOD_PD | SYSCTL_DEEPSLP_WDTOSC_PD);
// Select the power configuration after wake-up in the PDAWAKECFG
Chip_SYSCTL_SetWakeup(
SYSCTL_SLPWAKE_BOD_PD |
SYSCTL_SLPWAKE_ADC_PD |
SYSCTL_SLPWAKE_SYSOSC_PD |
SYSCTL_SLPWAKE_SYSPLL_PD |
SYSCTL_SLPWAKE_ACMP_PD);
LPC_SYSCTL->PDRUNCFG = LPC_SYSCTL->PDAWAKECFG;
// If any of the available wake-up interrupts are used for wake-up, enable the interrupts in the interrupt wake-up registers
Chip_SYSCTL_EnablePINTWakeup(0);
Chip_SYSCTL_EnablePINTWakeup(1);
……………………
Previous article:LPC1788 multi-channel data acquisition system lower computer + LabVIEW lower computer program
Next article:Cortex-M3 Learning LPC1768 - Button Experiment
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- ASML predicts that its revenue in 2030 will exceed 457 billion yuan! Gross profit margin 56-60%
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Correcting ICOM IC-725 frequency deviation without frequency meter
- Freshman asks for a simple wind tunnel control program
- Analysis of the working principles of seven triode collector DC circuits 1
- A very good introduction to the ble Bluetooth protocol stack
- A UART Circuit Design Based on FPGA
- [RVB2601 Creative Application Development] Flower Watering Indicator
- Understanding the alarm performance in arc fault detectors (fault arcs with 14 or more half cycles occurring within 1 second)
- November 19 live broadcast review: New requirements for connectors in 5G multi-scenario terminal applications and Molex's 5G connection solutions (including video)...
- DP83822I Industrial Ethernet PHY auto-negotiation function and its strap resistor configuration
- I would like to share with you the SDK for secret rooms developed based on STC microcontrollers.