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

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 351 to 360

Pages 351 to 360 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 351

Appendix A: Status Codes

A

Subsystem 1A00 EX (DCM Support) Hex Code

Message

1A00

Execution success

1A01

ACK received

1A10

Data received

5A02

NAK received

5A07

No more log records

5A11

Received data truncated

5A12

Fields overflow

5A20

Record logged

5A21

Logged but upload error

9A03

Transmit fails

9A04

Receive timeout

9A05

Packet header error

9A06

Transaction ID is missing

9A08

Standby file is missing

9A09

Standby file I/O error

9A40

Buffer overflow

9A41

Buffer overflow and upload error

A-43

Page 352

This page is a scan with no text; see it in the PDF.

Page 353

B Appendix B: Sample Interrupt Programs

Page 354

This page is a scan with no text; see it in the PDF.

Page 355

Appendix B: Sample Interrupt Programs

B

This appendix lists C language programs that demonstrate how to use interrupts.

Using the Sample Programs The sample programs in this appendix demonstrate how to use software interrupts in place of the Intermec PSK functions. It is much easier to write programs that use the PSK functions than to write programs that directly call the software interrupts. For more information on using software interrupts, see Chapter 3, “Software Interrupts.” Note: Do not run programs that use PSK library functions on your PC, unless you have the JANUS Application Simulator installed. If you attempt to run these programs without the Simulator, you will receive an error message and the program will not run.

CAUTION

Caution Do not run programs that use Intermec-specific interrupt extensions on your PC, unless you have the JANUS Application Simulator installed. If you attempt to run these programs without the Simulator, they will cause your PC to lock up and possibly corrupt your system BIOS. Conseil N’exécutez pas de programmes utilisant des extensions d’interruption spécifiques à Intermec sur votre PC, à moins que JANUS Application Simulator soit installé. Si vous tentez de les exécuter sans le Simulator, ces programmes risquent de verrouiller votre PC et d’altérer le BIOS de votre système.

B-3

Page 356

apmif.c apmif.c /* apmif.c * * This program is an APM interface test module. It allows entry of the APM * interface registers from the MS-DOS command line, and then it makes an APM call. * The results displayed are the register contents returned from the call. * * Compiler: Borland C++ 3.11 */ typedef unsigned char uchar; typedef unsigned int uint; #include <stdio.h> #include <ctype.h> #include <string.h> uint tohex(char*); void get_data(char**); void call_APM(void); void print_IV(void); uint AX_REG,BX_REG,CX_REG,DX_REG,CARRY; void main(int argc,char **argv){ AX_REG = 0x5300; BX_REG = 0x0; CX_REG = 0x0; DX_REG = 0x0; call_APM();

//check for pm enabled if (BX_REG != 0x504D){ //504D = PM, means apm implemented printf("APM not supported.\n\n"); return; } if ((CX_REG & 0x0008) != 0) //check for pm disabled printf("PM is disabled.\n\n"); AX_REG = 0x5301; BX_REG = 0x0; CX_REG = 0x0; DX_REG = 0x0; call_APM();

// connect as apm client if (CARRY != 0){ printf("APM client already connected.\n\n"); } else{ printf("Successful connect.\n\n"); } if (argc == 1) // if no arguments, prompt for them printf("Enter AX BX CX...\n\n"); get_data(argv);

B-4

Page 357

apmif.c

B

//display register values entered printf("i AX=%0.4X BX=%0.4X\ni CX=%0.4X DX=%0.4X\n", AX_REG,BX_REG,CX_REG,DX_REG); call_APM();

//do the apm call

/* have to call standby twice to make it work (so it won't skip activity)*/ if ((AX_REG == 0x5307)&&(CX_REG == 0x0001)) call_APM(); //display the register values returned printf("o AX=%0.4X BX=%0.4X\no CX=%0.4X DX=%0.4X\n", AX_REG,BX_REG,CX_REG,DX_REG); printf("carry=%0.4X\n\n",CARRY); if (AX_REG == 0x530B){ //if get pm event and standby, do it if ((BX_REG & 0x01) != 0x0){ AX_REG = 0x5307; BX_REG = 0x0001; CX_REG = 0x0001; call_APM(); call_APM(); } } } void call_APM(){ /* the call apm interface routine */ asm{ push ax push bx push cx push dx mov ax,AX_REG mov bx,BX_REG mov cx,CX_REG mov dx,DX_REG int 15h mov AX_REG,ax mov BX_REG,bx mov CX_REG,cx mov DX_REG,dx pop dx pop cx pop bx pop ax } /* end asm */ asm mov CARRY,0 asm jnc a asm inc CARRY a: } void get_data (char **dos_arg){ char *regval; char charbuff[10];

/* get the register values from user entry */ regval = *dos_arg++; if (*dos_arg == 0) {

B-5

Page 358

apmif.c printf("Enter AX value in hex:");

B-6

Page 359

apmif.c

B fflush(stdin); regval=charbuff; gets (regval); } else regval = *dos_arg++; AX_REG = tohex(regval); if (*dos_arg == 0) { printf("Enter BX value in hex:"); fflush(stdin); regval=charbuff; gets (regval); } else regval = *dos_arg++; BX_REG = tohex(regval); if (*dos_arg == 0) { printf("Enter CX value in hex:"); fflush(stdin); regval=charbuff; gets (regval); } else regval = *dos_arg++; CX_REG = tohex(regval); if (*dos_arg == 0) { DX_REG = 0; } else { regval = *dos_arg++; DX_REG = tohex(regval); } } uint tohex(char *string){ uint ctr; uint num; uint value = 0; uint stop;

/* convert ascii characters to hex */ stop=strlen(string); for (ctr = 0; ctr < stop; ctr++){ value <<= 4; num = string[ctr]; num -= '0'; num = (num > 9) ? (num - ('A' - ':')) : num; num = (num > 15) ? (num - ('a' - 'A')) : num; value += num; } /* end for */ return value; }

B-7

Page 360

appbreak.cpp appbreak.cpp /* appbreak.cpp * * This program demonstrates application break control using interrupts. * * The operator presses application break to exit program. The application break sequence * is as follows: * * Start the Appbreak program: * 1/0 turn off Janus * F3+2+left arrow at the same time * 1 by itself * 1/0 turn Janus back on * * Written: Aug. 30, 1993 * Last Modified: Aug. 30, 1993 * Author: Ray Rogers * Compiler: Borland C++ 3.1 */ #include #include #include #include #include

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

#define #define #define #define #define #define

KEY_Int BREAK_REQ TRANS_OK VALID_SERVICE ESC FOREVER

0x7e 0xff 0x00 0x00 0x1b 1

// keyboard interrupt // break requested // sucessful KSCPU transaction // valid service call to 0x7e // escape key // endless loop control typedef struct { IM_UCHAR status; IM_UCHAR request; } RESP_BUFF;

// KSCPU comm status // request made or not?

RESP_BUFF

// KSCPU response buffer rbuff;

// Prototypes IM_UINT Chk_App_Break(RESP_BUFF *); void main() { clrscr(); printf("%s", "\n\rDo appl. break or\n\rpress ESC\n\r"); while(FOREVER) { if(VALID_SERVICE == Chk_App_Break(&rbuff)) { if(rbuff.status == TRANS_OK) { if(rbuff.request == BREAK_REQ) { printf("%s", "\n\rAppl. Break detected!\n\r"); exit(0); } }

B-8