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 4 of 40

2D JANUS PSK for C/C++ Reference Manual, pages 31 to 40

Pages 31 to 40 of 400

The original document is the PDF (793 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 31

C Language Support

2

Debugging a Program With Turbo Debugger Turbo Debugger is the application debugging environment supplied with Borland C/C++. Since Turbo Debugger requires a lot of memory and is easier to use on a large display, you will probably want to debug your programs using the remote debugging feature. Turbo Debugger runs on your PC while the program you want debugged runs on the reader. To use remote debugging, you must connect the PC to your reader with a null modem cable and you must run TDREMOTE.EXE on the reader. To debug your program 1. Connect the PC to your reader with a null modem cable. 2. Copy the TDREMOTE.EXE program to a drive on the reader. 3. If your application uses reader services, make sure they are loaded on the reader. If you use the Intermec-supplied AUTOEXEC.BAT file, they are loaded automatically. Otherwise, start reader services on the reader by entering this command: RSERVICE 4. On the reader, change to the drive with TDREMOTE.EXE and enter the command: TDREMOTE -rpm -rsn where: rpm sets the reader’s communications port m is 1, 2, or 4 for COM1, COM2, or COM4 rsn sets the transmission baud rate as follows:

JANUS Reader

Port

2010 and 2050

COM1

2020

COM1

Switch

Baud

-rs2

19,200

-rs3

38,400

-rs4

115,000

-rs2

19,200

-rs3

38,400

-rs4

115,000

2-5

Page 32

2D JANUS PSK for C/C++ Reference Manual

5. On the PC where Turbo Debugger will run, go to the directory where your program file is located and enter: TD -rpm -rsn progname.exe where: rpm sets the PC communications port. Omit this for COM1.

rsn sets the transmission baud rate. This parameter must match the value you entered for -rsn on the reader.

progname is your executable program file. 6. Use Turbo Debugger as described in the user’s guide supplied with Borland C/C++ to debug your application. Note: Turbo Debugger uses the communications port of the reader for remote debugging. You need to avoid conflict with portions of your programs that use the reader’s communications functions. Skip over the portions that use communications functions.

Status Code Macros When using any of the C library functions, you can check for a specific return value or you can use one of the PSK macros to determine the severity of the returned status codes. For portability with future Intermec products, we recommend that you use the macros. The following macros are located in IMMSG.H: IM_ISERROR(status) This macro returns a nonzero number when status indicates an error (either fatal or nonfatal). Zero is returned if status indicates either success or warning. IM_ISSUCCESS(status) This macro returns a nonzero number when status indicates either success or warning. Zero is returned if status indicates an error (either fatal or nonfatal). IM_ISGOOD(status) indicates success.

This macro returns a nonzero number when status

IM_ISWARN(status) This macro returns a nonzero number when status indicates a warning.

2-6

Page 33

C Language Support

2

The following example uses IM_ISERROR to test for an error, and then prints the error message on the reader display. status = im_transmit_byte( com_port, outchar); if ( IM_ISERROR(status)) im_message(status);

Runtime Requirements For some library functions to work properly, you must install and run specific software components at program execution time. For example, if the reader is using a communications port, you must load a protocol handler. Because protocol handlers use a lot of memory, they are not automatically loaded for you. Other functions require the Reader Wedge TSR program. Note: Large C language programs can require more memory than is currently available in the reader. One possible solution is to use overlays. For more information, see your C language programmer’s guide.

Protocol Handlers You use the Intermec protocol handler (PHIMEC.EXE) when the reader is connected with other Intermec devices. PHIMEC.EXE works with UserDefined, Point-to-Point, Polling Mode D, and Multi-Drop protocols. You use the PC standard protocol handler (PHPCSTD.EXE) when the reader is connected to devices that use PC standard protocol. PHPCSTD.EXE provides low-level communication abilities and protocol services at the DOS level for non-communication software. It also provides byte-by-byte transfer. If your reader is a radio frequency (RF) unit, RFPH.EXE is automatically loaded. For more information on protocol handlers, refer to your JANUS user’s manual. To install a protocol handler on the reader • From the DOS prompt, enter the following command:

handler n where: handler is either PHIMEC or PHPCSTD. n is the number of the communications port.

2-7

Page 34

2D JANUS PSK for C/C++ Reference Manual

When your application is finished, the protocol handler TSR continues to run and can prevent other applications from running due to lack of memory. You can unload the protocol handler TSR by adding the unload command as the last line of the batch file that launches your application. To unload a protocol handler on the reader • From the DOS prompt, enter the following command: unload handler n where: handler is either PHIMEC or PHPCSTD. n is the number of the communications port.

Reader Wedge Some functions, such as im_receive_input, allow the reader to receive input from multiple sources and process the input depending on the source. You must load the Reader Wedge (RWTSR.EXE) TSR to use these functions. When your application is finished, the Reader Wedge TSR continues to run in the background and take up memory. The Reader Wedge TSR can prevent other applications from running due to lack of memory. Make sure that your application unloads the Reader Wedge TSR as part of the exit routine or as part of a batch file. Note: PSK version 2.1 and above automatically loads RWTSR.EXE for C language applications. However, you get optimal memory management by loading and unloading RWTSR.EXE at the command line. The autoload feature uses about 6K additional memory. To load the Reader Wedge TSR on the reader • From the DOS prompt, enter the following command: RWTSR To unload the Reader Wedge TSR on the reader • From the DOS prompt, enter the following command: RWTSR -D

2-8

Page 35

C Language Support

2

Specific Functions With Runtime Requirements The following table lists the PSK functions that have runtime requirements.

Specific Runtime Requirements This Function

Requires im_cancel_rx_buffer

Protocol Handler im_cancel_tx_buffer

Protocol Handler im_clear_abort_callback

Reader Wedge im_command

Reader Wedge im_get_input_mode

Reader Wedge im_get_label_symbology

Reader Wedge im_get_length

Reader Wedge im_input_status

Reader Wedge im_irl_a

Reader Wedge im_irl_k

Reader Wedge im_irl_n

Reader Wedge im_irl_v

Reader Wedge If the data is from a communications port, use a Protocol Handler and im_link_comm.

im_irl_y

Reader Wedge Protocol Handler Use im_link_comm.

im_link_comm

Reader Wedge Protocol Handler im_parse_host_response

Protocol Handler im_receive_buffer

Protocol Handler Do not use im_link_comm.

im_receive_buffer_no_wait

Protocol Handler Do not use im_link_comm.

im_receive_buffer_noprot

Protocol Handler Do not use im_link_comm.

im_receive_byte

PHPCSTD.EXE You must use PC standard protocol on the host. Do not use im_link_comm.

2-9

Page 36

2D JANUS PSK for C/C++ Reference Manual

Specific Runtime Requirements (continued)

2-10

This Function

Requires im_receive_input

Reader Wedge Protocol Handler Use im_link_comm if data is from a communications port.

im_rx_check_status

Protocol Handler im_serial_protocol_control

Use im_link_comm.

im_set_abort_callback

Reader Wedge im_set_display_mode

Reader Wedge im_set_input_mode

Reader Wedge im_setup_trx

Protocol Handler im_standard_trx

Protocol Handler im_standby_wait

Reader Wedge im_transmit_buffer

Protocol Handler im_transmit_buffer_no_wait

Protocol Handler im_transmit_buffer_noprot

Protocol Handler im_transmit_byte

Protocol Handler You must install PHPCSTD.

im_unlink_comm

Reader Wedge Protocol Handler

Page 37

C Language Support

2

Certified C Language Functions Because of the large number of functions in the C language, not all functions are known to work correctly when used with the JANUS family of readers. Many of these have been tested, however, and are known to operate on the reader the same as on a PC. These tested functions are listed below.

Tested C Functions atol

_dos_settime fseek bdos dostounix

_fstrlen

_bios_keybrd enable fwrite bioskey exit geninterrupt

_bios_serialcom farcoreleft getch

_chain_intr farfree getchar chdir farmalloc getche

_chdrive ffeof getcwd

_chmod fflush getdate

_clock fgets

_getdcwd chsize filelength getdfree close fileno getdisk clrscn findfirst

_getdrive corel findnext getenv cprintf fnmerge getpsp cputs fnsplit gets delay fopen gettext disable fprintf gettextinfo

_dos_findnext fputc gettime

_dos_getdate fputs getvect

_dos_getdiskfree

FP_OFF gotoxy

_dos_getfileattr

FP_SEG

_harderr

_dos_gettime fread

_hardresume

_dos_setdate free

_hardretn

2-11

Page 38

2D JANUS PSK for C/C++ Reference Manual

Tested C Functions (continued)

2-12 highvideo qsort va_start inport read vsprintf inportb realloc wherex inpw remove wherey int86 scanf window intdosx setcursortype write isalpha setdate isascii settime iscntrl setvect isdigit sleep isprint sprintf isspace sscanf itoa strcat kbhit strchr keep strcmp lseek strcmpi malloc strcpy memccpy strcspn memcmp strlen memcpy strncmp memmove strncmpi memset strncpy min strnset

MK_FP strpbrk open strrchr outp strstr outportb tell outpw textbackground printf textcolor putch time puts toupper puttext va_end

Page 39

C Language Support

2

Intermec C Library Functions The following pages list the C library functions available in the Programmer’s Software Kit (PSK), along with notes on syntax and examples of how the functions can be used. Each function is fully compatible with currently available Microsoft C/C++ and Borland C/C++ compilers. Note: Do not run programs that use PSK library functions on your PC. 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. If you attempt to run these programs, 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. 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.

2-13

Page 40

2D JANUS PSK for C/C++ Reference Manual

C Library Functions Listed by Category Communications im_cancel_rx_buffer, 2-21 im_cancel_tx_buffer, 2-22 im_get_reboot_flag, 2-48 im_link_comm, 2-83 im_protocol_extended_status, 2-94 im_ready_for_reboot, 2-97 im_receive_buffer, 2-98 im_receive_buffer_no_wait, 2-101 im_receive_buffer_noprot, 2-104 im_receive_byte, 2-107 im_receive_input, 2-109 im_rx_check_status, 2-114 im_serial_protocol_control, 2-115 im_transmit_buffer, 2-143 im_transmit_buffer_no_wait, 2-145 im_transmit_buffer_noprot, 2-148 im_transmit_byte, 2-151 im_unlink_comm, 2-153

DCM im_parse_host_response, 2-89 im_setup_trx, 2-134 im_standard_trx, 2-139

Display im_backlight_off, 2-18 im_backlight_on, 2-19 im_backlight_toggle, 2-20 im_decrease_contrast, 2-27 im_get_contrast, 2-31 im_get_display_mode, 2-34 im_get_display_type, 2-36 im_get_follow_cursor, 2-37 im_increase_contrast, 2-55 im_set_contrast, 2-122 im_set_display_mode, 2-125 im_set_follow_cursor, 2-128

2-14

Input im_get_input_mode, 2-39 im_get_label_symbology, 2-43 im_get_length, 2-45 im_input_status, 2-57 im_receive_byte, 2-107 im_receive_input, 2-109 im_set_input_mode, 2-129

IRL im_irl_a, 2-59 im_irl_k, 2-63 im_irl_n, 2-66 im_irl_v, 2-69 im_irl_y, 2-74

Keypad im_get_control_key, 2-32 im_get_keyclick, 2-41 im_get_warm_boot, 2-53 im_number_pad_off, 2-86 im_number_pad_on, 2-87 im_set_control_key, 2-124 im_set_keyclick, 2-131 im_set_warm_boot, 2-133

Macros IM_ISERROR, 2-79 IM_ISGOOD, 2-80 IM_ISSUCCESS, 2-81 IM_ISWARN, 2-82

Program Control im_appl_break_status, 2-16 im_clear_abort_callback, 2-23 im_set_abort_callback, 2-118