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 3 of 15

FMT1000 Series Programmer's Guide: Chapter 2 I/O System Programming, pages 21 to 30

Pages 21 to 30 of 142, from FMT1000 Series Programmer's Guide

The original document is the PDF (965 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 Symbol FMT-1020

Page 21

Chapter 2 I/O System Programming I/O system programming consists mainly of selecting the configuration options for the many features of the I/O coprocessor. To understand the programming, it is first necessary to understand the basic characteristics and features of the I/O.

Features Much of the power of the FMT1000 Series computer, particularly for industrial and automation applications, lies in its extended I/O capability. This I/O is managed by the coprocessor, thus relieving the CPU of much of the work, and making the I/O much easier to work with from a DOS program. The I/O falls into four categories: • Peripheral – FMT1000 Series computers can accept input from one or two bar code devices or a magnetic stripe reader. They support all commonly used bar code symbologies. The magnetic stripe reader is compatible with ABA Track 2 encoding. • RS-232 Auxiliary Port – Connecting ordinary PC COM ports to real-world devices can require significant, difficult, real-time programming. The RS-232 auxiliary port automatically: - Handles flow control - Provides an interrupt-driven input buffer - Strips headers and trailers from a data stream (such as might come from a scale printer port) and forwards only the data to your application - Automatically adds headers and trailers to commands written to an attached device. An example of this is Hayes-compatible modem programming, in which every command must be preceded by an AT and terminated with a carriage return 2-1

Page 22

FMT1000 Series Programmer’s Guide

- Can transmit its data directly to the keyboard port of the CPU, eliminating the need for any special programming to receive the data. • Digital Input – Two digital inputs can be configured to:

- Sense whether they are “On” or “Off” - Detect a change in state and inform the CPU - Count transitions from “Off” to “On” for cycle-counting applications such as printing or machine monitoring. • Digital Output – Two relay outputs can be set “On” or “Off” or pulsed for a period from 0.1 to 99.8 seconds. In addition, several other FMT1000 Series computer internal housekeeping features are controlled by the coprocessor and can be manipulated using coprocessor commands. These include the internal beeper, display backlight and contrast angle adjustment, keyboard layout, and keyclick operation.

2-2

Page 23

I/O System Programming

Basics of Coprocessor Communications Communicating with the coprocessor has two parts: • sending commands to the processor • receiving replies.

As can be seen from Figure 1-1, the two processors can communicate using COM2 and the keyboard port.

Sending Commands to the Coprocessor All coprocessor commands are ASCII strings, consisting of a three-character mnemonic followed by any necessary parameters. They are always transmitted via COM2. It is essential to ensure that both processors use the same baud rate and character format. The coprocessor host comm port defaults to 9600 baud, 8 data bits, no parity. In most situations it is unnecessary to change this. Note: The FMT1000 Series computer BIOS sets the COM2 communication parameters to the coprocessor default at system startup.

Coprocessor Command Format All commands to the coprocessor have the following form: <mnemonic>[<param>]<cr><lf> where: <mnemonic> [<param>] <cr><lf> is the three-character mnemonic for the command is an optional parameter is a carriage return (hex 0D), line feed (hex 0A)

Note: No spaces are allowed between the command and the parameter.

2-3

Page 24

FMT1000 Series Programmer’s Guide

Many parameters accept string arguments. To embed nonprinting control characters in these strings, use the format ^<key>, which is a two-character sequence. (<key> refers to the key that would be used in concert with a keyboard control key to generate the code from a keyboard.) Some commonly used values are: Sequence Meaning ^I

Tab

^J

LF

^M

CR

^L

FF

^[

Escape

Note: These sequences consume two characters in the specified maximum string length for a command.

Flow Control on the Coprocessor Port The default flow control for the coprocessor is to use XON/XOFF handshaking. There is a 100-character input buffer, and the coprocessor will send XOFF when 88 characters have been received and XON when the buffer has been emptied. Remember, DOS provides no flow control on these ports. You can use ECHO commands in BAT files to configure the coprocessor. For example, echo SBL1 >COM2 turns the LCD display backlight on. However, sending too many commands this way can overflow the buffer, and there is no way to detect this condition. There are several solutions: • Install an XON/XOFF handler for COM2. Several are available on

CompuServe. • Use a programming environment or a communications library that supports flow control on COM ports to write a program that sends commands to the coprocessor. 2-4

Page 25

I/O System Programming

• Limit the total characters to fewer than 100. This is often adequate, as most coprocessor commands are short, and the default configuration is adequate for many applications. • Synchronize with the coprocessor by including a command for which you expect a reply, and wait for the reply.

Receiving Replies from the Coprocessor Replies can come from four sources: • Reply strings generated internally by commands that request data from the coprocessor, such as returning the current setting of the baud rate for the RS-232 auxiliary port. The internal input path is set by the SRI command (set internal response path). • Data coming from the auxiliary input. The auxiliary input path is set by the SRA (set auxiliary response path). • Data coming from the peripheral input (bar code or magnetic stripe). The peripheral input path is set by the SRP command (set peripheral path). • Strings from the digital inputs generated by the change-of-state or counter-match functions. The digital input path is set by the SRD command (set digital response path). The replies from any of these sources can either be directed to the keyboard port and received as though typed or directed to COM2. The response path for each source is set by command. For example, the set aux comm response path command (SRA) will direct the auxiliary port data.

2-5

Page 26

FMT1000 Series Programmer’s Guide

Coprocessor Reply Format All replies coming from the coprocessor have a common format: <tag><prefix><data><suffix><autoenter>

Where: tag prefix data suffix autoenter is a single programmable character is a programmable 16-character string is a 1- to 80-character string is a programmable-16 character string is a mode that determines how a reply is terminated.

Response tags, prefixes and suffixes can be used to make messages coming from the coprocessor to the CPU unique. For example, suppose your program were waiting for an input from either the auxiliary RS-232 port or a bar code wand. You could set the response prefix for peripheral input to BAR using the command: SPPBAR which stands for “Set Peripheral Prefix,” and set the response prefix to AUX for the RS-232 auxiliary port using the command: SAPAUX which stands for “Set Auxiliary Prefix.” Your program can then examine the first three characters of the data it receives to determine the source. The tag characters behave very much like another prefix. Autoenter mode determines how data is terminated when it is sent to the CPU. There are four choices: • none no terminator is sent

• CR a carriage return is sent

• CR/LF a carriage return/line feed is sent

• TAB a tab character is sent

Note: You may program other terminators by turning autoenter off and embedding the termination string in the response suffix. 2-6

Page 27

I/O System Programming

Prefixes and Suffixes in RS-232 Auxiliary Port Operations The coprocessor manipulates strings for many operations to make the job of programming the CPU easier. When programming the RS-232 auxiliary port, consider strings to consist of three parts: • prefix • data • suffix.

Auxiliary input prefixes and suffixes are used to find the actual data in a data stream and separate it for input to the CPU. For example, if the following data were coming from a scale printer port to the RS-232 auxiliary port WEIGHT

12.34

KG<CR>LF>

Prefix

Data

Suffix you could use the following commands to set the aux input prefix and suffix: SPIWEIGHT SSIKG^M^J

When you set the aux input prefix and suffix correctly for the RS-232 auxiliary port, the FMT1000 Series computer automatically captures just the numeric data from this string (12.34), and sends it to the CPU as though it had been typed at the keyboard. Aux output prefixes and suffixes refer to strings that are added to each of the messages sent in the RS-232 auxiliary port output. They are often used when a device requires commands to begin always with the same characters. For example, Hayes-compatible modem commands begin with AT and terminate with a carriage return. The following commands could be used to set the auxiliary output prefix and suffix: SPOAT SSO^M

2-7

Page 28

FMT1000 Series Programmer’s Guide

A dialing command could then be sent using: SOWDT5551212

Creative use of auxiliary prefixes and suffixes can greatly ease the job of interfacing to external devices. In many cases, correctly setting the prefixes and suffixes for such devices as the scale above can make it possible to interface these devices as keyboard inputs with no special programming.

Use of the I/O Processor A unique feature of all FMT1000 Series computers is an embedded I/O processor used to decode input from bar code wands, magstripe readers, and other I/O devices. Internally, this I/O processor is connected to both COM2: of the F8680 processor and the XT keyboard input. This design allows for bar code data to appear as “typed” input into application programs, yet permits configuration of decoder parameters without the need for specialized programs or drivers. For example, to set the I/O processor to append an apparent press of the ENTER key after reading a bar code, the following may be placed in the AUTOEXEC.BAT file: echo SEP1>COM2 where the command SEP1 is explained in the following sections. Similarly, programs such as QBASIC may open COM2: and write the configuration strings and thereby change the behavior of the I/O processor dynamically. Note: The default communication settings for the I/O processor are 9600 baud, no parity, 8 data bits, 1 stop bit (96,n,8,1). It may be necessary to preconfigure COM2: in the AUTOEXEC.BAT file prior to issuing configuration commands to the IO processor by including the command: lpmode COM2:96,n,8,1 where lpmode.exe is found in the \UTL\ directory of the drivers and utilities disk. Alternatively, the DOS external command MODE.EXE may be used.

2-8

Page 29

I/O System Programming

I/O Processor Commands The subsequent pages contain a list of I/O controller mnemonics. Each page describes one command. Certain conventions are used for arguments: • <Broken brackets> indicate the type of information to be passed; for example <string> indicates a string. • Ranges of numbers are indicated as numbers in broken brackets, for example <0-80>. • N/A indicates that no arguments are passed or returned.

The basic format of a command description page is:

SIO, RIO [mnemonic] Set and Return Aux Input Timeout [Title] Format SIO <0-255>

[Format and parameters for the send command]

Summary Set the length of time to wait for input, in seconds [One sentence description of the command] This setting is preserved in EEPROM.

Returns Timeout value, integer 0-255. [Type and value of returned data]

Description [Explanation of the command and parameters]

Example [Code fragment showing how the command can be used. Examples are offered when needed.] Note: Factory defaults are indicated by an asterisk (*). 2-9

Page 30

FMT1000 Series Programmer’s Guide

Command List Command

2-10

Type

Pg.# Command

Type

Pg.#

R1D

System

2-101 RDA

Auxiliary 2-27

R1M

Digital

2-65

Digital

2-67

R1U

System

2-101 RDH

Host

2-16

R25

Bar Code 2-77

RDP

Digital

2-55

R28

Bar Code 2-80

RDS

Digital

2-56

R2D

System

2-101 RDT

Digital

2-54

R2M

Digital

2-65

RE1

Digital

2-62

R2U

System

2-101 RE2

Digital

2-62

R39

Bar Code 2-76

R3D

System

2-101 RED

Digital

2-57

R3U

System

2-101 REI

System

2-90

R4D

System

2-101 REP

Bar Code 2-74

R4U

System

2-101 RER

System

2-106

RAD

System

2-94

RES

System

2-110

RAE

Auxiliary 2-50

RHA

Auxiliary 2-29

RAP

Auxiliary 2-22

RHH

Host

2-18

RAS

Auxiliary 2-23

RI1

Digital

2-59

RAT

Auxiliary 2-21

RI2

Digital

2-59

RBA

Auxiliary 2-26

RIB

Auxiliary 2-39

RBE

System

2-112 RIM

Auxiliary 2-37

RBH

Host

2-15

RIN

Auxiliary 2-41

RBL

System

2-92

RIO

Auxiliary 2-36

RBS

System

2-113 RIP

RCB

Bar Code 2-78

RCD

System

RDE

REA

RIR

2-100 RIS

Auxiliary 2-24

System

2-88

Auxiliary 2-40 System

2-89