C Language Development Kit/Functions/Contrast
From OptiWiki
| Description | Controls or reads the contrast of the display. | |||||||||
| Syntax | int contrast(int value); | |||||||||
| Arguments | 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.
int value
| |||||||||
| 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. | |||||||||
| Example | #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 ) value++; if( c == DOWN_KEY || c == F8_KEY ) value\-\-; contrast( value ); idle(); } } |
