Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 26 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 251 to 260

Pages 251 to 260 of 414

The original document is the PDF (690 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Intermec J2020, Intermec J2010 and Intermec J2050

Page 251

Advanced Programming

4

Transmitting Serial Data With Intermec protocol handlers, you transmit serial data by calling the communications routines included with the PSK. These routines are im_transmit_buffer, im_transmit_buffer_no_wait, and im_transmit_buffer_noprot. These communications routines all use the INT 14H BIOS extensions. You can transmit a maximum of 254 bytes in one record. Make the buffer size somewhat larger (300 bytes is typically used) to allow adequate memory for protocol characters that might also be transmitted. If the buffer is too small, you will overwrite other memory locations.

Communications Port UART Modes If you turn off your JANUS reader while running a communications application that uses COM1 or COM2, the reader cannot save the UART FIFO control register. The reader uses the UART restore configuration setting to reset the FIFO control register when the reader is turned back on. You need to set a restore value if the default value, 0 hex, is not appropriate for your reader. You must set a restore value in these two cases: • Your application is using COM1 without using an Intermec protocol handler. • Your application is using COM2 and changes the reader’s COM2 UART FIFO control register to use UART 16x550 mode. See the communications application’s manual to determine if it uses UART 16x550 mode. You can also reset the FIFO control register using software interrupts. For more information, see INT 78H, function 06H, in Chapter 3, “Software Interrupts.” Most Basic languages require that the port be configured to 16x450 mode, which is the default reader configuration. For more information, see the “Communications Port, UART Restore” command in your JANUS user’s manual.

4-9

Page 252

JANUS PSK for C/C++ Reference Manual

Display “Color” You can set the reader display to various foreground and background shades. A SMARTMAP™ scheme compares and adjusts the foreground and background gray values on a character-by-character basis to produce adequate display contrast on monochrome LCD panels. With this scheme, commercially written color software packages can be used on a monochrome display with acceptable differentiation of colors using shades of gray. The default color setting on a PC is white on black. However, the best default setting on a monochrome display is black on white. For this reason, setting a color to black actually sets white on black, and setting a color to white actually sets black on white. To display colors other than just black and white, you should experiment with various color combinations to find an appropriate setting. The shade of a specific foreground color varies depending on the background color setting. Borland C/C++ changes the foreground color by using textcolor(int newcolor) where newcolor is an integer between 0 and 15. Adding 128 to newcolor sets the most significant byte and makes the character blink. The background color is set using textbackground(int newcolor) where newcolor is an integer between 0 and 7. These colors are only applicable when using functions that do direct video output (such as cprintf). Microsoft C/C++ changes the foreground color by using _settextcolor(short index) where index is an integer between 0 and 15. Adding 16 to index sets bit 4 and makes the character blink. The background color is set using _setbkcolor(long index) where index is an integer between 0 and 7. These colors are only applicable when using functions that do direct video output (such as _outtext).

4-10

Page 253

Advanced Programming

4

Advanced Power Management The reader power management subsystem provides Advanced Power Management (APM) compliant BIOS software functionality using the VLSI SCAMP II chip set. The specific components of power management are: • BIOS Power Management (PM) software with the APM software interface. • Intermec Power Management (IPM) software. • VLSI SCAMP chipset Power Management Unit (PMU) hardware (VL82C322). APM is a layered, cooperative environment that allows applications, operating systems, and the system BIOS to work together toward the goal of reducing power consumption. The standardized flow of information and control across the layers facilitates interface requirements. The primary purpose of an APM implementation is to provide increased productivity and greater system availability by extending the life of system batteries without degrading performance.

Power Management Software Layers Power management is provided by two software layers: • System BIOS interface • Application interface The system BIOS interface is analogous to the power management methods implemented on current generation laptop systems, where automatic system functions temporarily shut down hardware components in order to prolong battery life. The application interface improves power management by letting an application actively determine operational conditions and directly control hardware power consumption.

4-11

Page 254

JANUS PSK for C/C++ Reference Manual

System BIOS Interface The system BIOS is the lowest layer of power management software in the system. It is resident in the reader at all times. The system BIOS is capable of controlling power management functionality without any support from the operating system or application.

Application Interface APM provides a cooperative interface between the system BIOS and other system or application software that makes the other software a partner in the power management process. Once this cooperative interface is established, the system BIOS informs its partner of significant power-related events, and relies on its partner to actively participate in the power management process. The application layer assists the power management function by providing information that only the application can easily ascertain. Applications are not required to support the power management function, but they can greatly increase its effectiveness. Under DOS in particular, the application is often in the best position to know when the reader is idle and awaiting input. Some of the system BIOS functions can be called regardless of whether or not the cooperative power management interface has been established between the BIOS and the caller. However, some functions, particularly those related to notification of power events, do not operate until the cooperative interface is established. POWER.EXE provides a default cooperative connection to improve JANUS reader performance.

4-12

Page 255

Advanced Programming

4

Figure 4-1 Power States

USER PERSPECTIVE: Unit On

1 Input Device Activity Start Count Gathering

2 Standby (slow CPU clock) 2 APM/IPM: Set Standby State

3

CTRL+ALT+DEL Warm Boot

System "Activity" Detected

System "Activity" Timeout

1 Ready

Auto Shut-off Timeout

APM: Set Power State to Suspend

Off Key

Main Battery Low Low

Resume Override Boot

Resume

Power Loss (Interlock)

Suspend Override Kill Power

Set Storage Mode Kill Power

BIOS Startup

RTC Alarm

82C322 Auto On Boot

On Key

On Key Boot

3 Suspend

HDW Auto Power Off Kill Power

4 Off Backup Battery Dead or Removed

Special Super User Key Sequence

On Key With Main Batt Low Low

Main Battery Replaced "First Time" Power Up

On Key With Main Batt Low Low

USER PERSPECTIVE: Unit Off Notes: 1 (Turn ASIC clock on In < 1/2 clock period)

Key

JPSK.005

State

2 (Includes IRQs and NMI. The 82C322 PMU has 13 power management interrupt sources.) 3 (82c322 hardware Activity monitor timeout.)

Event Activity Transition

4-13

Page 256

JANUS PSK for C/C++ Reference Manual

The APM Power States APM supports four distinct power states: Ready, Standby, Suspend, and Off. Their relationships are depicted in Figure 4-1. Three of these states (Ready, Standby, and Off) apply both to individual system components and to the system as a whole. The Suspend state is a special low power condition that applies to the system as a whole, but not to the individual components. Usually, your application only distinguishes between two apparent conditions: On and Off, where the indicator is the display. In the On condition, the display is active and the power management is in either the Ready or the Standby state. In the Off condition, the display is inactive, and power management is in either the Suspend or the Off state. The system and devices change power states either by explicit command or automatically (based on APM parameters and system activity). The power capabilities of devices differ, and some devices may not be capable of achieving all states. Additionally, some devices may have unique, built-in power management that is invisible to the system, and therefore outside the scope of the APM specification.

Ready In the Ready state, the system or device is fully powered up and available. The APM definition of Ready does not differentiate between active and idle conditions; it only indicates that the system or device is fully powered up. The reader enters the Ready state when a device raises a hardware interrupt or accesses any controlled device.

Standby Standby is an intermediate system-dependent state that provides some power conservation. The reader enters the Standby state when the CPU is idle and there is no device activity (such as when an application is waiting for input). All data and operational parameters are preserved when the machine is in the Standby state. The CPU is powered but the clock runs very slowly (this does not affect the DOS time and date or any BIOS functions: it only conserves power).

4-14

Page 257

Advanced Programming

4

Suspend The Suspend state is the lowest level of power consumption available that preserves operational data and parameters. The reader enters the Suspend state by either the system BIOS or the software above the BIOS. The system BIOS might place the system into the Suspend state without notification if it detects a situation that requires an immediate response (such as the battery entering a critically low power state). When the system is in the Suspend state, computation is not performed until normal activity is resumed. Power is removed from the CPU. Resumption of activity does not occur until signaled by an external event such as pressing the 1/0 key.

Off In the Off state, the unit is powered down and inactive. Data and operational parameters are not preserved (except for PC card drives that contain their own backup mechanisms and are preserved as long as they are intact). The reader enters the Off state when the operator selects storage mode (from the boot loader screen) or when all of the batteries are dead.

Power State Transitions Figure 4-1 earlier in this chapter illustrates the methods and events used to transition between the indicated power states. States above the dotted line appear as On to the application, with the unit fully operational. States below the dotted line appear as Off to the application (the display is blank and a delay occurs when the unit is reactivated by pressing the 1/0 switch). When the unit appears to be on, it might be in either the Ready or Standby state. In the Ready state, it is indeed on and fully powered. In the Standby state, the hardware is fully powered but the CPU clock is slowed, maintaining only memory refresh capability. To applications, the CPU clock appears to be stopped. The Standby state reduces battery current dramatically. An exit from Standby occurs during any system activity that might require attention from the application. That is, not on BIOS clock ticks and not at the beginning of count gathering for bar code reading, although the end of the read generates an interrupt to direct the application to process the label).

4-15

Page 258

JANUS PSK for C/C++ Reference Manual

When the unit appears to be Off, it is usually in the Suspend state. It is in the Off state only when both the main and backup batteries are dead or removed, or when placed into Storage mode from the bootstrap screen. Figure 4-1 lists the events that control transitions between Ready and the Suspend or Off states. In normal operation, the unit transitions from Suspend to Ready when the 1/0 key is pressed and transitions back to Suspend on either an activity timeout or when the 1/0 key is again pressed. While the reader is in the Suspend state, you can use the resume override key sequence to exit from Suspend and activate the boot screen. From the boot screen, you can select the following actions: • Resume as long as the system state remains valid • Reboot the reader, which transitions to On • Select storage mode, which transitions to Off • Use the other boot screen functions Similar to an application, the CPU is in a Ready or Standby state while in the boot screen.

Power State Cooperation APM provides an industry standard interface for cooperation among calling applications. The composite PM, BIOS, APM, and IPM provides two modes of operation: • Transparent mode, where the BIOS, PMU, and PM cooperate to detect idle conditions and change power states by their set of rules. • Nontransparent mode, where the currently operating application (client subsystem) cooperates in controlling the system power state and uses its knowledge of when it is waiting for activity. In this mode, the currently operating application can wait in a lower power state. Basic power management capability is always present in the reader BIOS-PMU interaction. The reader reduces CPU power when it observes no system activity for a period of time, such as when the reader is sitting at the DOS prompt or waiting for operator input.

4-16

Page 259

Advanced Programming

4

Basic power management uses the Standby and Auto-shutoff states. System activity is detected by monitoring for key press functions, display change activity, and all interrupts except the BIOS clock tick. In addition, the PMU hardware activity timeouts are set to change automatically to lower power states when there is no interrupt activity. The Reader Wedge uses an IPM interface to control power management. For example, with IRL programs (which have no explicit PM interface), the Reader Wedge services know when the IRL program is waiting for input and that it can wait in a lower power mode. The Intermec configuration manager (IC.EXE) provides setup parameters for this level of power management. Your application can explicitly control the power states by connecting to the APM interface with the interface connect function. This method provides the best use of the reader power since the application knows when it is idle and therefore can wait in a Standby or Suspend state depending upon response time requirements. Applications that use the reader services interface have equally good power management without having to be explicitly concerned with power management functionality. The APM interface provides for polling by the application client to include power management information from the lower BIOS level software. Finally, POWER.EXE (a Microsoft product), is an APM client that monitors system usage parameters to determine when an application is idle. POWER.EXE is a TSR program that provides better power management for off-the-shelf programs that have no APM knowledge. POWER.EXE also takes care of correcting the system date and time when the unit has been suspended overnight or longer. When the reader is shipped, POWER.EXE is installed and enabled. The APM interface can only support one connected client at a time, so POWER.EXE must be disabled if an application wants to use the APM interface. You can disable POWER.EXE by placing the following command line in the AUTOEXEC.BAT file (or by executing the command at the DOS prompt, prior to loading an application): POWER OFF Programs that replace POWER.EXE must implement date correction algorithms when the reader is to be left suspended overnight or longer.

4-17

Page 260

JANUS PSK for C/C++ Reference Manual

IPM Interface Functionality The IPM interface is used by reader services and system functions to control power management state changes. It is transparent to application and operator controls. Both the IPM and APM interface cooperate to prevent the CPU from leaving the Ready state (except for critical Suspend transitions as discussed below). The IPM interface provides Suspend and Resume functions for both normal and critical conditions: • Normal Suspend • Normal Resume • Critical Suspend • Critical Resume

Normal Suspend The reader enters a normal Suspend transition when the front panel 1/0 key is pressed or the duration of the current activity exceeds the timeout parameter. A normal Suspend only occurs when PM is enabled. Functions in process are completely restored following a normal Suspend.

Normal Resume The reader enters a normal Resume transition when the front panel 1/0 key is pressed. A normal Resume transition follows a normal Suspend transition. A normal Resume is not possible unless there has been a prior valid normal Suspend to save the system state. If the system state is not valid, a normal Resume forces a reboot. The operator can use the boot screen function to dump the system memory state (through the communications port) to a host prior to rebooting.

4-18