C Language Development Kit/Functions/Contrast

From OptiWiki

Jump to: navigation, search
Description Controls or reads the contrast of the display.
int contrast(int value);
int value
value is the contrast level that will be set. When value is below zero, the routine will return the current contrast level without changing the contrast.
All except the PHL2700 PHL2700
Range 0..31 0..40
Default 16 16
Returns The contrast level after execution of contrast().
Remarks On the OPH100x, a value outside the valid range will cause the function to do nothing, other then to return the current value.

On the other terminals, any value outside the valid range will give unexpected contrast in the LCD screen. The default value for value will set a good contrast half way the range. On the OPH100x, OPL97xx, DCL153x and PHL terminals, the contrast can also be set in the system menu. This method is preferred over the use of this function, since the option in the system menu stores the value in non-volatile memory, so that in case of a complete power fail, the value is maintained.

#include "lib.h"
#include <stdio.h>
void main( void )
    int c, value;
    value = contrast( -1 );
    printf("Hello world");
    while( 1 )
        c = getchar();
        if( c == UP_KEY || c == F7_KEY )
        if( c == DOWN_KEY || c == F8_KEY )
        contrast( value );

Personal tools