The term " power down mode” refers to a condition in which a Microcontroller Unit (MCU) enters a low-power mode. The power down modes helps to reduce average power consumption of the MCU through effective management of CPU operations, clock signal to CPU and peripherals. The power down modes in PIC family of MCU’s typically comprises of Doze, Idle, Sleep and Deep sleep modes. The PIC18 Q10 family of MCU’s have three power down modes and they are Doze, Idle and Sleep mode. This example demonstrates configuration of Doze, Idle and Sleep power down modes in PIC18F47Q10 MCU, to achieve low power consumption.
This section briefly discusses each of the power down mode available in PIC18 Q10 family.
Doze mode: In Doze mode CPU and memory operations are affected, but the peripheral clocks continue to run. Doze mode allows power saving by reducing CPU clock instruction cycle compared to the active mode, while leaving the peripherals clock unchanged. In Doze mode CPU executes only one instruction cycle out of every N-cycles as defined by the DOZE [2:0] bits in CPUDOZE register. For example, if DOZE [2:0] = 001, the instruction cycle ratio is 1:4. The CPU and memory execute for one instruction cycle and then lay idle for three instruction cycles. During the unused cycles, the peripherals continue to operate at the system clock speed. Steps to enter the Doze mode:
Idle mode: In Idle mode CPU and Memory operations are halted, but the peripheral clocks continue to run. Device is put into the Idle mode by executing SLEEP instruction, when Idle enable bit (IDLEN=1) is set.
Sleep mode: Sleep mode turns OFF the system clock. The CPU and all peripherals requiring the system clock will cease operation. The contents of the memory and registers are maintained in the sleep mode. Device is put into the Sleep mode by executing SLEEP instruction, when Idle enable bit (IDEN=0) is clear.
This section discusses about System clock, CPU clock and Peripheral cock (Refer Table 1).
System Clock: System clock designated as FOSC is the main clock which can be supplied from external oscillators, quartz crystal resonators, ceramic resonators and Resistor-Capacitor (RC) circuits. In addition, the system clock source can be supplied from one of two internal oscillators. Oscillator module can be configured to select one of the clock sources.
CPU Clock: The instruction clock or CPU clock is derived from the system clock or FOSC through a divider to deliver an instruction clock of FOSC/4 (1/4 the oscillator speed). This is done to allow the fetch and execute pipeline in the architecture to execute one assembly instruction per instruction clock cycle (except for branches and goto's which execute in two). CPU clock is supplied to the CPU and memory to perform CPU and memory Operations in the application.
Peripheral Clock: Clock to different peripherals can be selected from various options such as FOSC i.e. the system clock, FOSC/4 (instruction clock or CPU clock), output of other peripherals, LFINTOSC, MFINTOSC, HFINTOSC or Timer overflow events etc.
Table 1 : Clock details in Power Down modes
The Peripheral Module Disable (PMD) provides the ability to disable a peripheral module by stopping all clock sources supplied to that module. A peripheral can be disabled by setting the corresponding peripheral disable bit in the PMDx register. All the peripherals are enabled by default. To reduce overall power consumption, the user can disable unused modules/Peripherals. Refer to the device data sheet for more details about the PMD register
Figure 1: Block diagram of application demo
In this demo,
With full program and debug capabilities, the PIC18F47Q10 Curiosity Nano evaluation kit offers complete support for the new design. With the award-winning MPLAB X integrated development platform and MPLAB Code Configurator (MCC), the kit provides access to the Intelligent analog and Core Independent Peripherals on the PIC18F47Q10. Figure 2 shows PIC18F47Q10 Curiosity Nano board.For more details refer to the PIC18F47Q10 Curiosity Nano Hardware user guide
Figure 2: PIC18F47Q10 Curiosity Nano board
Power debugger is a powerful development tool used for debugging and programming the AVR and SAM MCUs. The power debugger contains two channels for measuring power consumption, one channel is used for High-precision low-current measurement, while the second channel is used for Low-precision high-current measurement. In this example Power Debugger with Channel A (High precision low-current measurement) is used in order to measure current consumption of the PIC18F47Q10 MCU and to transmit the measured data to Power Analysis window of data visualizer tool. For more details refer to the Power Debugger user guide. Figure 3 shows the Power debugger.
Figure 3: Power Debugger
Note: In Curiosity Nano board, on-board level shifters will draw a current of 20 μA. To know the power consumption of PIC18F47Q10 MCU in each power down modes, minus 20 μA from actual power consumption.
Microchip’s free MPLAB X IDE, compiler and MPLAB Code Configurator (MCC) graphical code generator are used throughout the firmware development. Following are the tool versions used for this demo application:
Note: For running the demo, the installed tool versions should be same or later. This example is not tested with previous versions.
The Data Visualizer is a software tool used to process and visualize data. The Data Visualizer can receive data from various sources such as the Embedded Debugger Data Gateway Interface (DGI) and COM ports. Data Visualizer is made up of several modules such as Graph, Oscilloscope, Terminal, Power debugging, Custom dashboard etc. In this example Standalone data visualizer tool is used to receive power consumption data from the Curiosity Nano board, and display it on Power analysis window .The terminal window is used to display the operating modes of the PIC18F47Q10 MCU(i.e. Active mode/Doze mode/Idle mode/Sleep mode). For more details on Data Visualizer tool refer to the Data Visualizer user guide.
The system configuration window of MCC is used for MCU oscillator, PLL, Watchdog timer and low voltage programming configuration. Internal oscillator of 1MHz frequency with clock divider 1 is used as a system clock and the Watchdog timer is disabled in this example. Figure 4 shows the system configuration settings used in this example.
Figure 4: System Configuration
In this demo EUSART2 is used to transmit data on the terminal window to display the device mode of operation (i.e. active/doze/idle/sleep). Figure 5 shows the EUSART2 module configuration settings. Configurations to be done on EUSART2 peripheral:
Figure 5: EUSART2 Configuration
The I/O pin mapping of the PIC18F47Q10 MCU for EUSART2 interface and Curiosity Nano on board LED is shown in the figure 6. Configurations to be done:
Figure 6: Pin manager configuration
Figure 7: Pin module configuration
In the peripherals section of MCC, click on Memory. Flash memory read/write routines are automatically included. Check the Add DataEE Routines to include EEPROM memory write/read routines which are required for this example.
Figure 8:Memory module configuration
There are two methods for Hardware connection.
Figure 9:Cut VTG strap on Curiosity Nano Board
Figure 10: Current measurement using power debugger hardware connections
Figure 11: Hardware setup
Figure 12: Power Configuration window
Figure 13:Current measurement using power debugger hardware connections
Figure 14:Hardware setup
(Steps from 5 to 10 are same for the two methods of hardware connection)
Power the Curiosity nano board from PC machine, by connecting micro USB cable between PC USB port and micro USB port of the Curiosity nano board.
Similarly, power the Power debugger board from PC machine, by connecting micro USB cable between PC USB port and micro USB port (named as DEBUG) of the power debugger board.
The Curiosity Nano board should appear as a Mass Storage Device after connecting to the PC.
Program the MCU by clicking “Make and Program Device” icon on MPLAB XPRESS IDE as shown in figure 15.
Figure 15:Programming the device
Follow the steps listed below, to open Power Analysis and Terminal window in Data Visualizer.
Open the standalone Data Visualizer tool.
Figure 16:Start Data visualizer and open Power analysis window
Open the standalone Data Visualizer tool.
Figure 17:Open terminal window in Data visualizer
Instant and Window Average current consumption Explanation:
Figure 18:Power Analysis window for Instant and Window Average
Instant Current Consumption: Figure 18 shows the instant current consumption of MCU at time T1 is 545.3 μA.
Window Average: Window Average is the average current consumption of the samples over the period. Figure 14 shows the window average current consumption of MCU is 250.8 μA.
Following figures show the average current consumption of the Curiosity nano board in different power down modes of MCU.
The intend of demonstration is to showcase the configuration and functionality of MCU power down modes and the power consumption values discussed in this document are observed with mentioned Hardware setup as shown in figure 14.
Active mode:
Figure 19:Power Analysis and Terminal window in Active Mode
Active mode –EEPROM Operation
Figure 20:Open terminal window in Data visualizer
Figure 21:Power Analysis and Terminal window in Active Mode
Doze mode (Doze ratio=1:8)
Figure 22:Power Analysis and Terminal window in Doze mode with 1:8 doze ratio
Doze mode (Doze ratio=1:8) – EEPROM Operation
Figure 23:EEPROM Operation in Doze mode with 1:8 doze ratio
Figure 24:Power Analysis and Terminal window in Doze mode with 1:8 doze ratio
Doze mode (Doze ratio=1:32)
Figure 25:Power Analysis and Terminal window in Doze mode with Doze ratio 1:32
Doze mode (Doze ratio=1:32) –EEPROM Operation
Figure 26:EEPROM operation in Doze mode with Doze ratio 1:32
Figure 27:Power Analysis and Terminal window in Doze mode with Doze ratio 1:32
Idle Mode
Figure 28:Power Analysis and Terminal window in Idle mode
Figure 29:Power Analysis and Terminal window in Active mode after waking from the Idle mode
Sleep Mode
Figure 30:Power Analysis and Terminal window in Sleep mode
Figure 31:Power Analysis and Terminal window in Active mode after waking from the Sleep mode
This example demonstrates the configuration of various power down modes available in PIC18 Q10 MCUs. As demonstrated in the example, EEPROM Write and Read operations takes more current in Active mode as compared to Doze mode. In Doze mode current consumption depends upon the doze ratio selected. In PIC18 Q10 MCUs, Sleep mode is the lowest current mode where the MCU power consumption is minimum, as clock is disabled to CPU and all the other peripherals.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。