
[Example]
Following is a sample program which, when a function key is pressed,
switches the screen to the corresponding CNC screen.(Execute as
auxiliary task)
#include <crt.h>
#include <oscall.h>
void main( void ) {
unsigned int idx, fkey, newscrn, curscrn, savescrn[8] ;
for ( idx = 0 ; idx < 8 ; idx++)
savescrn[idx] = idx ; /* initialize savescrn[8] */
for (;;) {
os_wait_tim( 5 ) ; /* run every 40msec */
curscrn = crt_getcurscrn() ; /* get current screen index */
/* number */
savescrn[curscrn % 0x100] = curscrn ;
/* save index including small classification */
if ( fkey = crt_readfkey() ) {
/* if function key is pressed */
/* restore previous small classification number */
newscrn = savescrn[fkey - MDIKEY_POS] ;
if ( newscrn != curscrn ) {
crt_cncscrn( newscrn ) ;
crt_setswt( CRT_SWT_MFKY ) ;
}
}
}
}