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 37 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 361 to 370

Pages 361 to 370 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 361

appbreak.cpp

}

B

// end VALID_SERVICE

B-9

Page 362

appbreak.cpp if(kbhit()) if(getch() == ESC) // just in case { printf("%s", "\n\rEscape was pressed!\n\r"); exit(0); } } } // Check for application break request IM_UINT Chk_App_Break(RESP_BUFF *rbuff) { _ES = FP_SEG((RESP_BUFF *) rbuff); // far pointer to response buffer _BX = FP_OFF((RESP_BUFF *) rbuff); // far pointer to response buffer _AH = 0x01; geninterrupt(KEY_Int); return(_AH); }

B-10

// check app break function

Page 363

backlite.cpp

B backlite.cpp /* backlite.cpp * * This program demonstrates how to toggle the back light. * * Written: Aug. 12, 1993 * Last Modified: Aug. 19, 1993 * Author: Ray Rogers * Compiler: Borland C++ 3.1 */ #include

"dos.h"

#define

LCD_Int

0x79 void main() { _AH = 0x01; _AL = 0x02;

// LCD size mode manager interrupt

// back light function // toggle back light state geninterrupt(LCD_Int); }

B-11

Page 364

contrast.cpp contrast.cpp /* contrast.cpp * * This program demonstrates contrast control using interrupts. It increases the * contrast by one step each time the space bar is pressed. It accepts a parameter * in the range of 0 - 31 from the command line and sets the contrast to that level. * * Written: Aug. 24, 1993 * Last Modified: Aug. 24, 1993 * Author: Ray Rogers * Compiler: Borland C++ 3.1 */ #include #include #include #include #include #include

"stdio.h" "string.h" "dos.h" "conio.h" "stdlib.h" "im20lib.h"

// Defines #define FOREVER 1 #define LCD_Int 0x79 #define LCD_CONTRAST 0 #define ESC 0x1b #define ZERO '0' #define PERIOD '.'

// LCD interrupt // contrast function

// Prototypes IM_UCHAR Step_Contrast(IM_UCHAR); IM_UCHAR Set_Contrast(IM_UCHAR); IM_UCHA Get_Contrast(void); void main(int argc, char *argv[]) { IM_UCHAR ch, level; if(argc == 1) { clrscr(); // no command line parameters printf("%s", "\n\rPress 0 to decrease\n\rperiod to increase\n\rESC to quit"); } else { Set_Contrast(atoi(argv[1])); exit(0); } // main processing loop, exit loop on ESC key while(FOREVER) { if(kbhit()) { ch = getch(); switch(ch) { case ESC: clrscr(); exit(0);

B-12

Page 365

contrast.cpp case case

}

B

ZERO: Step_Contrast(--(level = Get_Contrast())); break; PERIOD: Step_Contrast(++(level = Get_Contrast())); break;

}; } // end main loop

} // Get the current contrast level IM_UCHAR Get_Contrast() { _AH = LCD_CONTRAST; _AL = 3;

// current contrast geninterrupt(LCD_Int); return(_AL); } // Step the contrast one level by call with 0 parameter or set by // supplying a value IM_UCHAR Step_Contrast(IM_UCHAR step) { static IM_UCHAR once, level; if(!once) { once = 1; level = Get_Contrast(); } if(step != 0) level = step; if(level >= 31) level = 0;

// allow Get_Contrast() only once

// use step value if provided // keep level within bounds (not below zero // unsigned)

if(step == 0) level++; return(Set_Contrast(level)); } // Set the contrast to the requested level IM_UCHAR Set_Contrast(IM_UCHAR level) { _AH = LCD_CONTRAST; _AL = 1; // set contrast to value function _BL = level; geninterrupt(LCD_Int); return(_AL); }

B-13

Page 366

ctlkey.cpp ctlkey.cpp /* ctlkey.cpp * * This program demonstrates Ctrl key control by using interrupts to enable/disable * the Ctrl key. * * Written: Sept. 1, 1993 * Last Modified: Sept. 1, 1993 * Author: Ray Rogers * Compiler: Borland C++ 3.1 */ #include "dos.h" #include "stdlib.h" #include "conio.h" #include "stdio.h" #include "im20lib.h" #define #define #define #define #define #define #define #define

KEYPAD_Int 0x7e KP_CTL 0x08 KP_OFF 0x00 KP_ON 0x01 KP_STATUS 0x02 KP_ENABLED 0xff VALID_SERVICE 0x00 TRANS_OK 0x00

// key pad interrupt // keypad ctl key function // function is off // function is on // get status // function is enabled // valid function call // func transaction executed ok typedef struct { IM_UCHAR status; IM_UCHAR kp_status; IM_UINT padding; } RESP_BUFF;

// KSCPU comm status // 0xff if function already enabled // work space

RESP_BUFF rbuff;

// Prototypes IM_UINT KP_Func(IM_UCHAR, IM_UCHAR, RESP_BUFF *); void main() { clrscr(); if(VALID_SERVICE == KP_Func(KP_CTL, KP_STATUS, &rbuff)) // get current status of click if(TRANS_OK == rbuff.status) if(rbuff.kp_status == KP_ENABLED) // if it is on... { KP_Func(KP_CTL, KP_OFF, &rbuff); // turn it off printf("%s", "\n\rControl Key DISABLED\n\r\n\rPress a key..."); } else { KP_Func(KP_CTL, KP_ON, &rbuff); // else, turn it on printf("%s", "\n\rControl key ENABLED\n\r\n\rPress a key..."); } while(!kbhit()); getch(); clrscr(); exit(0); }

B-14

// wait for a keypress

Page 367

ctlkey.cpp

B

B-15

Page 368

ctlkey.cpp

// Execute requested keypad function IM_UINT KP_Func(IM_UCHAR func, IM_UCHAR subfunc, RESP_BUFF *resp) { _ES = FP_SEG(resp); _BX = FP_OFF(resp); _AH = func; _AL = subfunc; geninterrupt(KEYPAD_Int); return(_AH); }

B-16

// keypad function // subfunction

Page 369

exstat.cpp

B exstat.cpp /* exstat.cpp * * This program demonstrates JANUS extended protocol status reporting using interrupts. * This program also demonstrates program control of the JANUS viewport using interrupts. * * NOTE: For units with Radio Frequency (RF), this program is known to function properly * only with Version 1.24 firmware. * Written: July 25, 1994 * * Last Modified: July 25, 1994 * Author: Ray Rogers * Compiler: Borland C++ 3.1 */ #include #include #include #include #include #include

"stdio.h" "string.h" "dos.h" "conio.h" "stdlib.h" "im20lib.h"

// Defines #define COM_Int 0x14 #define LCD_Int 0x79 #define ESC 0x1b #define SPACE ' ' #define ZERO '0' #define TRUE 1 #define FOREVER TRUE #define VP_ACROSS 5 #define VP_DOWN 4 #define VP_STEPSIZE 15 #define OK 0x600 #define ERR_NO_HANDLER 0x8611 #define ERR_BAD_VER 0x860e // Global Variables IM_UINT vm_mode; IM_UINT vm_params; IM_UINT vp = 0; IM_UINT vp_vert = 1; IM_COMM_STATUS_BUFFER_s sb0, sb3;

// Communications interrupt // LCD size mode manager interrupt // char 27, Escape // blank space // zero == set viewport to origin 0,0 // number of viewport steps across // number of viewport steps down // columns to move viewport right // ok status // no protocol handler loaded // old firmware - requires 1.24 or later // saves original video mode // saves original video parameters // viewport position // viewport vertical control // define buffers to hold status

// Prototypes IM_UINT Set_Video_Mode(void); IM_UINT Get_Ext_Status(IM_UINT, IM_COMM_STATUS_BUFFER_s *); IM_UINT VP_Move(IM_UINT, IM_UINT); void Display_Status(IM_UINT, IM_COMM_STATUS_BUFFER_s *, IM_UINT); void Move_Viewport(void); void err_msg(IM_UINT); void main() { IM_UCHAR ch; IM_UINT status0, status3; Set_Video_Mode(); sb0.status_structure_version = STATUS_STRUCT_VERSION;

B-17

Page 370

exstat.cpp sb3.status_structure_version = STATUS_STRUCT_VERSION;

B-18