Chapter 4
Power Management

This chapter covers information on how applications programs may make use of the Power Management software in order to maximize the useful battery life of the PQXT without greatly sacrificing program functionality or speed.

General Description

This document pertains to Poqet systems through BIOS version V1.31 and is intended to assist programmers in developing software that works smoothly with the power management software in the Poqet computer. This document explains the concept of power management and provides guidelines for developing code that maximizes useful battery life. It is not intended to explain the inner workings of Poqet power management software.

Power Management Overview

This section is a brief introduction to the concept of power management. In the following sections of this document, guidelines for developing applications that are easily power managed will be introduced.

Stated simply, the goal of Power Management is to derive as much computing time as possible from a set of batteries. In PQXT, this task can be difficult to perform due to the thousands of potential programs that may be run on the system. The PQXT power management software monitors activities performed by the target application and the hardware to try and determine how to transparently manage the system to prolong the battery life. Some of the techniques used to extend battery life are outlined in the following paragraphs.

Component Power

One of the techniques used to maximize battery life is to turn off the major components within the PQXT when they are not being used. For instance, if a program is not using the serial port, the UART and the RS-232-C drivers may be disabled.

Clock Speed

Another technique used to control the amount of power consumed is to control the speed at which the electronic circuitry is used. The components used in the PQXT are primarily HCMOS, and consume power in nearly direct proportion to their operational frequency. Poqet software monitors system activity and makes intelligent decisions in controlling the system voltage and CPU speed. In fact, the CPU may even be stopped between keystrokes if appropriate. In this way, computing performance is balanced against the ultimate goal of extending the battery life.

Programming Guidelines

This section outlines program activities that make programs good candidates for power management. This section does not detail all activities monitored by power management -- it only outlines those that are likely to be the most common. Some activities listed below may require your program to call Poqet specific functions to perform the indicated task. For those cases, please refer to Chapter 2, "Application Program Interface," for information on how to implement power management using the PQXT Extended BIOS functions and services.

Video Activity

Your programs should not manipulate the display or the video controller registers unless they have new data to put on the screen. Continually writing the same data to the screen wastes time and battery life.

If possible, use MS-DOS or the BIOS to manipulate the display. Poqet computers contain more than one video adapter, only one of which is available at a given time. If your program is not restricted to only one type of video adapter, calls to MS-DOS or the BIOS will take care of locating the correct video memory. If your program must have a specific type of video adapter, use the Extended BIOS functions and services to automatically change the video hardware to the correct type.

It is not necessary to attempt to remove "snow" by monitoring horizontal and vertical retrace bits. The hardware automatically arbitrates accesses to video memory.

Serial Port Activity

Your application should avoid complicated and unnecessary manipulation of data in either direction at the serial port. The CPU in PQXT operates at a limited speed and excessive communication overhead will cause your program to miss data or be restricted to very low baud rates.

In PQXT, the serial port can be disabled when it is not in use. Your application does not normally have to worry about enabling the serial port; however, it can make the Poqet-specific call for completeness -- see the Extended BIOS functions in Chapter 2. Once your application has finished using the serial port, it should call the BIOS to disable the UART and RS-232-C drivers, since they consume a great deal of power.

Communications programs usually need to remain active for the life of the connection. For this reason, it may be necessary for your application to disable or change the mode of the power management software to keep the system from stopping the CPU and missing incoming data. Your application can make this action automatic by using calls outlined in the Extended BIOS services.

Keyboard Activity

If your program is performing no activity other than waiting for keyboard input, it should call INT16H Function 0. This function waits until a key is depressed and then returns the keyboard scan code and the ASCII code of the keystroke. If a key has no defined ASCII code, a value of zero is returned for the ASCII code. This way, your program can relinquish control after calling INT16H until a keystroke occurs.

Programs that are actively performing an operation, but want to give the user the ability to interrupt via Ctrl-C or other key combination, should not monitor the keyboard more than once per IRQ0. The time that elapses between each IRQ0 provides the program with a large interval to continue to complete tasks while still allowing a user to interrupt instantly if desired. Monitoring the keyboard too aggressively can cause power management to consider your program to be idle and stop the system. See Chapter 2 for an explanation of how to use the "Wake Up" service of Extended BIOS (function 02H, service 07H) to reactivate the system.

NMIs

The PQXT makes extensive use of NMIS. Avoid using this vector if at all possible. Applications that need to use the NMI vector should not assume that their NMI has been generated every time their code gains control. In all cases, applications must chain the NMI vector to allow Poqet software to handle any other NMIs that may have been generated at the same time. As with all interrupt routines, your code should be as efficient as possible to avoid degrading system performance.

Extended BIOS Services

Poqet provides extended BIOS services to allow applications some control over power management. Many parts of this section refer to services documented in the Extended BIOS Services, found in Chapter 2.

Your application may turn power management on or off via program calls, if necessary. For most applications, power management should be left active to prolong battery life.

In some cases, programs may become idle, but are not detected as being idle by the power management software. In these cases, programs may use the "User Idle" extended BIOS call to declare themselves idle and relinquish control. An example of this situation could be a program that is waiting for a semaphore from an IRQ0 interrupt routine. In this example, the main program should invoke the "User Idle" extended BIOS call to declare itself idle. When the IRQ0 routine detects the correct situation, it sets or clears the semaphore and makes the "Wake Up" extended BIOS call to reactivate the system.

In other cases, programs may wish to remain active, but are continuing to do things that cause the power management software to detect an idle state and take control of the system. An example of this situation could be a program that is reformatting text in the background while scanning the keyboard for new text from the user. In this case, it may be necessary to have the program declare itself still active by using the "Wake Up" service of Extended BIOS (function 02H, service 07H) once every IRQ0 interrupt until the background task has completed.

Table 4-1 lists the power management modes currently supported by the BIOS. All of these modes are accessible through the extended BIOS interface as described in Chapter 2, while three of them are available through keyboard entry. The BIOS will automatically change from one mode to another in certain circumstances, as explained in the following paragraphs.

Table 4-2 Power Management Modes

        Mode        Function
        -------------------------------------------------------------------
        00H (1)     The power management software is disabled and the
                    system is left at the full voltage level of +5 volts.
                    Beginning with BIOS 1.30, the power management NMI is
                    still enabled.  Int 16H, which is the keyboard
                    interrupt, is no longer trapped by the PQXT.

        01H         If the BIOS detects that the system is idle, it causes
                    the PQXT to enter display mode. In this mode, the CPU
                    clock stops, then restarts to process timer ticks and
                    keystrokes.  The BIOS is free to adjust the system
                    voltage to balance power consumption and performance.

        02H (2)     This is the default power management mode on boot-up.
                    The BIOS functions as in mode 1, but after being in
                    display mode for approximately four minutes, the system
                    turns off.  The display is then turned off, the
                    RS-232-C drivers are disabled, the baud clock is turned
                    off and keyboard interrupts are disabled.  System RAM
                    and video RAM are preserved and the time of day counter
                    is maintained.  The system may be turned back on using
                    the I/O key or by means of a program interface.

        03H         This mode was added in BIOS 1.30. The power management
                    software is disabled, the system is placed at full
                    voltage and the power management NMI is removed.  This
                    mode is used to enhance operation of communications
                    programs.  It is automatically selected when the system
                    is in mode 00H and the RS-232-C drivers are enabled, or
                    when the system is in mode 83H and an access is made to
                    a RAM card.

        80H (3)     Same as mode 00H, except the system is held at a reduced
                    voltage of 3 volts to reduce power consumption.  The
                    system voltage changes to full voltage when accessing
                    memory cards, but returns to the reduced voltage state
                    afterwards.  This mode is known as the communications
                    mode.  The processor operates at reduced speed, so be
                    aware that when running the serial port at high speeds
                    the processor may not be able to keep up.  Mode 80H is
                    available beginning with BIOS 1.30.

        81H         Same as mode 01H, except the system is held at a reduced
                    voltage of 3 volts to reduce power consumption.  The
                    system voltage changes to full voltage when accessing
                    memory cards, but returns to the reduced voltage state
                    afterwards.  Mode 81H is available beginning with
                    BIOS 1.30.

        82H         Same as mode 02H, except the system is held at a reduced
                    voltage of 3 volts to reduce power consumption.  The
                    system voltage changes to full voltage when accessing
                    memory cards, but returns to the reduced voltage state
                    afterwards.  Mode 82H is selected automatically by the
                    BIOS if the system is operating in mode 02H and system
                    voltage is constantly at 5 volts for more than one
                    minute.  Mode 82H is available beginning with BIOS 1.30.

        83H         The power management software is disabled and the power
                    management NMI is removed. The system is initially
                    placed in a reduced voltage state.  Your application
                    must take care in using this mode, since an access to
                    a memory card will effectively turn this mode into
                    mode 03H.  Mode 03H results because the power management
                    NMI is disabled and there is no way to return the
                    system to the reduced voltage state of 3 volts auto-
                    matically.  Mode 83H is available beginning with
                    BIOS 1.30.

        Notes:  1. Same as the keyboard Power Management Off mode
                2. Same as the keyboard Power Management On mode
                3. Same as the keyboard Power Management Communications mode
Figure 4-1 at the end of the chapter gives additional reference information on power management modes.

Keyboard Entry Guidelines

In addition to using the extended BIOS calls to control Power Management, there are two methods available through keyboard entry: These two methods are briefly explained below. See the User's Guide for more details.

Key Combination Entry

Depressing the Poqet and F4 keys simultaneously toggles the PQXT Power Management software among three modes, as shown below: The status of the bar on the display above the * key indicates the current power mode. A solid bar indicates power management is active (on); a dashed bar indicates the communications mode is in use, and no bar above the star means the power management software is off. With power management on (Mode 02H), the indicator bar is constantly solid only when the BIOS has stopped the main task in the system. The bar will change from solid to empty as system activity occurs.

Command Line Entry

In addition to using the Poqet-F4 key combination to control the Power Management software, you can also use the PQMODE command. This command is available beginning with BIOS 1.30. PQMODE allows batch files to easily set up the power management mode.

PQXT can operate at three power levels which are controlled by typing the commands listed below.

To maximize battery life, keep the Power Management software active for most applications programs. Use the communications mode when using remote access programs. Turning the Power Management software off significantly reduces battery life.

Figure 4-1: Power Management Quick Reference Chart

Note:

  1. The BIOS changes the power management mode from Mode 00H to Mode 03H automatically when the RS232C drivers are turned on.
  2. The BIOS changes the power management mode from Mode 02H to Mode 82H automatically if the system power remains at 5 volts for greater than one minute.
  3. In BIOS versions 1.30 and 1.31, the Power Management NMI is enabled during Mode 02H.

Copyright (c) 1989, 1990, 1991, 1992 Poqet Computer Corporation. All rights reserved.
Filename: PoqetPC/docs/poqetpc/techref/chapter4.html
Date Created: 13 Feb 96, Last Modified: 13 Jun 2003
Created by Bryan Mason - E-Mail: poqetpc<at>bmason<dot>com