C Language Development Kit/Functions/Autopowerdown

From OptiWiki

Jump to: navigation, search
Description Terminals can switch themselves off after a certain, user programmable time. This feature is called automatic power down. Every time when the user presses a key, or when the communications port receives data, the count down for automatic power down is reset.

With the autopowerdown() function some parameters for this feature are controlled.

Syntax
void autopowerdown(int command, unsigned long time);
Arguments
int command
The action that autopowerdown() must perform. One of the following values:
OFF Disables the autopowerdown feature. The time parameter is ignored and the previously configured time is lost.
ON Enables the autopowerdown() feature, and sets the 'on' time, specified by time in steps of 20 milliseconds. The 'on' time is the specified value * 20 milliseconds. E.g. time = 3000, means 20*3000 = 60 seconds.
RESET Resets the count down for automatic power down. The time parameter is ignored. Note that the count down for automatic power down is also reset when a key is pressed, or when data is received via the serial port.
NOW Causes the scanner to switch itself off immediately.
SUSPEND (OPH100x only) Suspends the autopowerdown timer until this function is called again with RESUME. The time parameter is ignored.
RESUME (OPH100x only) Resumes the autopowerdown timer, if it was suspended earlier by this function with SUSPEND. The time parameter is ignored.
unsigned long time
The time before the terminal powers down automatically
Returns None
Remarks time is an unsigned long. The maximum value is 4294967295, approx. 2.5 years. The minimum value is theoretically zero, but the power down time is limited to 3 seconds. The default power down time is different for the various terminals, and is shown below:
PHL terminals 5 minutes
OPH100x 3 minutes
Others 30 seconds

On the OPH100x, the power down time can also be configured in the system menu (if the installed application doesn't overrule it).

Example
#include "lib.h"
#include <stdio.h>
 
const char string[] = "Hello world";
 
void main( void )
{
    char c,*s;
 
    autopowerdown(ON,50);
    cursor(ON);
    cursor(AUTOWRAP);
 
    s = (char*)string;
    while( (c = *s) != '\0' )
    {
        putchar(c);
        delay(50);
        s++;
    }
 
    while( 1 )
        idle();
}


Views
Personal tools