Psion Homepage Logo.

BAR CODE READER MANUAL

The Psion Organiser II and the plug-in Program Packs, Datapaks and peripherals form a sophisticated pocket computer systems. They have been designed for ease of use, but to ensure that you make the most of their capabilities, we suggest that you read this booklet in conjunction with your basic Organiser II manual.

To avoid any possible damage, Psion products should not be exposed to extremes of temperature or humidity. Do not subject them to hard knocks or excessive force, nor immerse in liquids or use volatile fluids when cleaning the case.

CHAPTER 1
INTRODUCTION

The Psion Organiser II Bar Code Reader turns the Organiser into a powerful and versatile data capture unit. It will read a wide variety of Bar Code types, quickly and efficiently.

The Bar Code Reader adds a new function to OPL, the Organiser programming language. When this function is called, a successful read will return a bar code string to OPL, for storing or displaying. There are two example OPL programs at the end of this manual which will enable you to begin reading bar codes straight away.

This version of the Bar Code Reader supports several new bar code types, and includes a "low current" mode to considerably increase battery life. Full information about these new features can be found in chapter 3.

This manual contains all the specific details you need to use your Bar Code Reader. If you have any more general problems, refer to your Organiser II operating manual.

The Bar Code Reader cannot be used with the Organiser Model CM.


CHAPTER 2
CONNECTION AND USE

FITTING THE BAR CODE READER

The Bar Code Reader consists of a medium resolution bar code reader at one end and a fitting to connect it to your Organiser at the other. This fitting also contains a socket for an Organiser Mains Adapter.

To use the Bar Code Reader, first switch off the Organiser and plug it into the peripheral port at the top. The plug will only go in one way, with the Product name facing upwards.

Turn the Organiser on and, when you see the main menu displayed, press ON/CLEAR again. This loads the Bar Code Reader software from inside the plug into the Organiser, and the Bar Code Reader is now ready for use. The software occupies around 3K of the Organiser's internal memory, so if the memory is already nearly full, an "OUT OF MEMORY" message may be displayed. If this happens, you must free some more of memory by deleting any non-vital files, records, programs or diary entries, before trying to load the Bar Code Reader software again.

When you load the Bar Code Reader software, a new function (BAR$:) is automatically added to OPL. This function is covered in detail in the next chapter.

READING A BAR CODE

To read a bar code, position the wand so that it can be drawn across the full length of the code (i.e. across all of the bars), and lightly touching the surface. The wand should be held at an angle between 10 and 30 degrees away from vertical. Draw the wand across the code in a straight line, as evenly as possible, in one movement. The wand will read the bar codes from left to right of from right to left. The speed at which you draw the Bar Code Reader across the bar code should be between 5 and 30 inches per second. A speed in the upper half of this range will usually give the best results.

The wand uses a red light, so you may have difficulty reading codes printed in red or on a red background.

After using the Bar Code Reader, switch off the machine and unplug the cable. The software will still be stored in memory however, so this must be removed by switching the machine back on and pressing the [ON/CLEAR] again. The BAR$ function will then be removed from the OPL Language and the 3K of memory freed again for other uses.

If the cable is unplugged during use, a DEVICE MISSING error will be reported. For obvious reasons, this should be avoided.

NOTE: The Bar Code Reader acts as an extra drain on the Organiser's battery, so allowance should be made for the slightly shorter expected battery life when the Bar Code Reader is in heavy use. To reduce the effects of this problem, remove any Datapaks which are not being used, as these also drain the Organiser's  power. This version of the Bar Code Reader also has a low current mode to considerably increase battery life, details of which may be found in the next chapter.

CHAPTER 3
THE BAR$: FUNCTION

When the Bar Code Reader software is loaded, the BAR$: function is added to OPL. Here is an example of how an OPL program might use the function:

B$=BAR$:(TYPE%,MODE%,OPTIONS%)

In this example, three integer parameters ( TYPE%, MODE%, and OPTIONS% ) are passed to the BAR$: function, and the string which it returns is stored in a string variable B$.

The third parameter is optional, to allow for compatibility with the previous version of the Bar Code Reader. All existing OPL programs written for the previous version should work exactly as before, without modification, on this version.

THE TYPE PARAMETER

The TYPE parameter is the first parameter to the BAR$: function, and is an integer which defines the types of bar codes to allow to be read. Just one type may be allowed, or any combination of types, so that certain types can be excluded if, say, different product categories have different types of bar code. If you specify more than one type of code, the software will automatically recognise the type and then decode it accordingly.
If the bar code encountered is not one of the types you have specified then it will be ignored, and it will not produce a successful read.

To find out which value to give the TYPE parameter, simply add together the values in the table below which correspond to the bar code type you wish to allow.

VALUE  ID CHAR BAR CODE TYPE
1 A EAN
2 B UPC
4 C CODE39
8 D ITF
16 E CODABAR
32 F TELEPEN
64 G MODIFIED PLESSEY
128 H PLESSEY
256 I CODE128

So for example, if you wish to allow EAN and ITF bar code types to be read, the value for the TYPE parameter should be 9, produced by adding 1 (for EAN) and 8 (for ITF). It is advisable to limit the set of valid bar code types to those needed by your application, to maximise reading security. If you use an illegal value (such as 0) for the TYPE parameter, a BAD DEVICE CALL error massage will be displayed.

The support for the last five types of bar code in the table is new to this version of the Bar Code Reader. However, the values needed to specify any or all of the first four types, and their ID chars, are the same as in the previous version. ID chars are dealt
with in a later section.

THE MODE PARAMETER

This is the second parameter to the BAR$: function. It specifies the condition under which BAR$: should return back to the OPL program. The possible values of this integer parameter are shown in the table below:

VALUE MODE
0 wait until a good read is made
-1 wait for a good read or a key press
>0 wait for a good read or for this number of twentieths of second
<-1 wait for a good read or a key press or for this (positive) number of twentieths of a second

So for example, if a MODE parameter of -200 is used, the BAR$: function will return a bar code string as soon as a good read occurs, provided that it takes place within ten seconds. If no good read does occur inside the ten seconds, or if a key is pressed before a read takes place, a null string is returned.

Note that if a key is pressed, the ASCII code for that key will be retained in the keyboard buffer. A subsequent use of the GET function will return that ASCII value.

THE OPTIONS PARAMETER

The third parameter to the BAR$: function, the OPTIONS parameter, may be used to specify any or all of the options in the table below:

VALUE OPTION
1 use low current mode
2 return TELEPEN codes in numeric format, not ASCII (checksum expected)
4 use 2 checksum digits for MODIFIED PLESSEY, not 1
8 use 1 checksum digit for CODE39 (modulo 43), not 0
16 use FULL-ASCII CODE39, not 43 character CODE39
32 UPC-E is zero-suppressed (6 digits), not expanded to UPC-A (10 digits)

If you wish to specify more than one option, simply add together the values in the table to produce the value for the OPTIONS parameter. If you do not wish to use any of these options, you can omit the OPTIONS parameter completely.

The low current mode can considerably increase battery life, although it may occasionally reduce the first read rate. For example, with one Datapak connected, the current consumption while using the Bar Code Reader in low current mode may be reduced to as little as on sixth of the normal current consumption. This reduction is achieved by switching packs on and off at various times, while using the Bar Code Reader. This can only cause problems if other hardware is connected to your Organiser. Future Psion hardware may disable the setting of this low current mode, but it is perfectly safe to use if you only attach Datapaks or Rampaks (or nothing at all) to your Organiser at the same time as the Bar Code Reader.

INFORMATION RETURNED

When a successful read is made, the first character of the string returned by BAR$: will be an ID char. The table in the section on the TYPE parameter lists the ID char returned for the different types of bar code. If you TYPE parameter allowed more than one type of bar code to be read, the ID char tells you which type was in fact encountered.

A successful read of, for example, an EAN type bar code might return a string like "A5012672905007". The first character, "A", signifies that the bar code encountered was an EAN type, and the last character is the EAN checksum digit. The rest of the digits make up the code itself. To split up the returned string, use the OPL string-slicing functions LEFT$, RIGHT$ and MID$. Note that some types of bar code, e.g. TELEPEN, may return non-printable ASCII characters, so displaying them directly to the screen may have unpredictable results.

Start and stop characters are only returned for CODABAR and CODE128 types. For CODABAR a capital letter A, B, C or D will be returned as the start character. This will be the second character in the string, immediately after the ID char. The stop character T, N, * or E will be returned as the last character in the string.
So for example, "EA1234T" is a valid CODABAR bar code. For CODE128 the start character will be either lower-case g, h or i, and no stop character will be returned.

Any checksum digits will always be at the end of the returned string. PLESSEY has 2 checksum digits while MODIFIED PLESSEY has either 1 or 2, depending on the value of the OPTIONS parameter.
Note that the TELEPEN checksum digit remains in ASCII even if you use the OPTIONS parameter to specify numeric TELEPEN mode.

The four functions codes in CODE128 are returned as characters with ASCII values 128, 129, 130 and 131, for functions 1 to 4 respectively.

This version of the Bar Code Reader has a direction flag at address $E0. After a successful read, this byte will contain 0 if the bar code was read forwards, or a non-zero value otherwise. Use the OPL PEEKB function to look at the contents of this location.
This byte should only be read after a call to the BAR$: function, and before any calls to other OPL language extensions.

ERROR MESSAGES

The following errors may occur while using the BAR$: function:

ERROR MESSAGE
193 DEVICE READ FAIL
230 DEVICE MISSING
194 BATTERY TOO LOW
205 ARG COUNT ERR
224 TYPE MISMATCH
231 BAD DEVICE CALL

APPENDIX A

EXAMPLE PROGRAMS

The first of these two programs will only read 13 digit ( not 8 digit ) EAN bar codes, and no other types. When each EAN-13 bar code is read it will be displayed on the screen and written to a data file named "BAR". To exit from the program, press ON/CLEAR.

DEMO1:
LOCAL A$ (65)
ESCAPE OFF
IF EXIST("A:BAR") :REM CHECK FOR FILE
    OPEN "A:BAR",A,BARNO$
ELSE
    CREATE "A:BAR",A,BARNO$
ENDIF
DO
    CLS :AT 6,1 :PRINT "READY"
    A$=BAR$:(1,-1) :REM EAN ONLY
    IF LEN (A$)=0
       KEY :STOP
    ENDIF
    A$=MID$(A$,2,255)
    IF LEN(A$)=13 :REM EAN-13, NOT EAN-8
       BEEP 200,80 :CLS :AT 1,2
       PRINT "WRITING TO FILE";
       AT 1,1 :PRINT A$ :A.BARNO$=A$
       APPEND :PAUSE 20
    ENDIF
UNTIL KEY=1

The next program will read any of the EAN, UPC, CODE39 and ITF bar code formats, displaying the type and the bar code on the screen. It will end if 30 seconds elapses without a successful read, or if a key is pressed. The program uses low current mode.

DEMO2:
LOCAL B$(65),T$(1)
ESCAPE OFF
PRINT " READY"
WHILE 1
   B$=BAR$:(15,-600,1)
   IF B$="" :REM TIMEOUT OR KEYPRESS
    KEY :STOP
   ELSE
     CLS
     T$=LEFT$(B$,1) :REM GET TYPE DECODED
     IF T$="A" :PRINT "EAN"
     ELSEIF T$="B" :PRINT "UPC"
     ELSEIF T$="C" :PRINT "CODE39"
     ELSEIF T$="D" :PRINT "ITF"
     ENDIF
     PRINT MID$(B$,2,255)
     BEEP 200,80
  ENDIF
ENDWH
 
Left arrow Manuals index ~ Homepage ~ Developer Manual Right arrow