No part of the contents of this manual may be reproduced or transmitted in any form or by any means
without the express written permission of Digi International.
Permission is granted to make one or more copies as long as the copyright page contained therein is
included. These copies of the manuals may not be let or sold for any reason without the express written
permission of Digi International.
Digi International reserves the right to make changes and
improvements to its products without providing n otice.
T r ade mark s
Rabbit and Dynamic C are registered trademarks of Digi International Inc.
Rabbit 2000, RabbitCore, and RabbitNet are trademarks of Digi International Inc.
The latest revision of this manual is available on the Rabbit Web sit e, www.rabbit.com,
for free, unregistered download.
1.4 CE Compliance.....................................................................................................................................6
3.3 Digital I/O...........................................................................................................................................20
3.3.1 Digital Inputs...............................................................................................................................20
3.3.2 Digital Outputs............................................................................................................................22
3.4 Analog Features (OP7200 only).........................................................................................................24
D.2.1 Control and Routing.................................................................................................................153
D.3 Function Calls..................................................................................................................................154
D.3.1 Status Byte ...............................................................................................................................160
Index161
Schematics165
User’s Manual
eDisplay (OP7200)
1. INTRODUCTION
The OP7200 intelligent operator interface is a small, highperformance, C-programmable data acquisi tion and dis play unit
that offers built-in I/O, Ethernet connectivity, and an optional
touchscreen. The OP7200 can be used in a control system with
RabbitNet™ expansion I/O cards. A Rabbit
operating at 22.1 MHz provides fast data processing.
The OP7200 is designed for panel mounting and is NEMA-4
compatible. The OP7200 incorporates the powerful Rabbit 2000
microprocessor, flash memory, static RAM, industrialized digital I/O ports, RS-232/RS-485 serial ports, a 10/100-compatible
Ethernet port, and eight optional A/D converter inputs and
touchscreen.
®
2000 microprocessor
1.1 Features
• Small size: 4.4" × 5.7" × 1.7" (112 mm × 144 mm × 43 mm).
• ¼ VGA LCM display (320 × 240 pixels) with white LED backlight.
• Software-controlled LCD contrast and backlight on/off.
• 9-key keypad.
• LCD controller and SRAM compatible with OP7100.
• 4 status LEDs.
• 24 digital I/O: 16 filtered digital inputs with an input range of ±36 V DC and a switch-
ing point of 2.4 V, and 8 sourcing/sinking/tristate high-current outputs (250/350/0 mA).
• Rabbit 2000 microprocessor operating at 22.1 MHz.
• Audible alarm buzzer.
• 128K static RAM and 256K flash memory standard.
• One RJ-45 10/100-compatible Ethernet port with a 10Base-T Ethernet interface.
User’s Manual1
• Four serial ports (2 RS-232 or 1 RS-232 with RTS/CTS, 1 RS-485 or RabbitNet™
expansion port, and 1 CMOS-compatible programming port).
• Onboard backup battery for real-time clock and SRAM, connection point for external
battery included.
• Watchdog.
• External reset input.
• Meets NEMA 4 watertightness specifications when front-panel mounted.
• Optional 8-channel 12-bit A/D converter.
• Optional 4096 × 4096 analog touchscreen.
Two OP7200 models are available. Their standard features are summarized in Table 1.
Table 1. OP7200 Models
FeatureOP7200OP7210
MicroprocessorRabbit 2000 running at 22.1 MHz
Stati c RAM128K
Flash Memory256K
RJ-45 Ethernet Connector and
Additional 512K flash/512K SRAM memory options are available for custom orders
involving nominal lead times. Contact your Rabbit sales representative or authorized
distributor for more information.
Throughout this manual, the term OP7200 refers to the complete series of OP7200 operator interfaces unless other production models are referred to specifically.
Appendix A provides detailed specifications.
Visit our Web site for up-to-date information about additional add-ons and features as
they become available. The Web site also has the latest revision of this user’s manual.
2eDisplay (OP7200)
1.2 Development and Evaluation Tools
1.2.1 Tool Kit
A Tool Kit contains the hardware essentials you will need to use your OP7200. The items
in the Tool Kit and their use are as follows.
• OP7200 Getting Started instructions.
• Dynamic C CD-ROM, with complete product documentation on disk.
• Programming cable, used to connect your PC serial port to the OP7200.
• Universal AC adapter, 12 V DC, 1 A (includes Canada/Japan/U.S., Australia/N.Z.,
U.K., and European style plugs).
• Demonstration Board with pushbutton switches and LEDs. The Demonstration Board
can be hooked up to the OP7200 to demonstrate the I/O.
• Wire assembly to connect Demonstration Board to OP7200.
• Screwdriver.
• Rabbit 2000 Processor Easy Reference poster.
• Registration card.
Programming
DIAG
PROG
eDisplay (OP7200)
The OP7200 intelligent operator interface is a small, high-performance, C-programmable data acquisition
and display unit that offers built-in I/O, Ethernet connectivity, and an optional touchscreen. These Getting
Started instructions included with the Tool Kit will help you get your OP7200 up and running so that you
can run the sample programs to explore its capabilities and develop your own applications.
Tool Kit Contents
The OP7200 Tool Kit contains the following items:
• Dynamic C CD-ROM, with complete product documentation on disk.
• Demonstration Board with pushbutton switches and LEDs.
• Wire assembly to connect Demonstration Board to OP7200.
Programming cable, used to connect your PC serial port to the OP7200.
•
• Universal AC adapter, 12 V DC, 1 A (includes Canada/Japan/U.S., Australia/N.Z., U.K., and European
style plugs).
• Screwdriver.
• Getting Started instructions.
• Rabbit 2000 Processor Easy Reference poster.
• Registration card.
Visit our online Rabbit store at www.rabbit.com/store/ for the latest information on peripherals and accessories that are available for the OP7200 operator interface.
Step 1 — Install Dynamic C
Before doing any development, you must install Dynamic C. Insert the CD from the Tool Kit in your PC’s
CD-ROM drive. If the installation does not auto-start, run the setup.exe program in the root directory
of the Dynamic C CD. Install any Dynamic C modules after you install Dynamic C
Rabbit and Dynamic C are registered trademarks of Digi International Inc.
Cable
®
Getting Started
Instructions
Universal
AC Adapter
with Plugs
Screwdriver
Demo Board
Wire
·
S
S
G
W
W
N
D
3
2
1
H2
.
· ·
SW1 SW2 SW3 SW4
··
··
3-4
5-6
LED1 LED2 LED3 LED4
1-2
DEMO BOARD
-1
L
K
+
S
S
E
E
5
W
W
V
D
D
4
2
1
·
·
·
·
H
·
·
·
·
1
2
8
6
4
-3
-7
-5
L
E
D
3
BUZZER
1
B
L
L
E
U
D
Z
4
Z
E
R
J
·
·
·
·
·
·
·
·
·
·
·
Demo Board
Figure 1. OP7200 Tool Kit
User’s Manual3
1.2.2 Software
The OP7200 is programmed using version 7.30 or later of Rabbit’s Dynamic C. A compat-
ible version is included on the Tool Kit CD-ROM.
Dynamic C v. 9.60 includes the popular
µC/OS-II real-time operating system, point-to-point protocol (PPP), FA T file system, R abbitWeb, and other select libraries t hat were pr eviousl y sol d as indi vidual Dynamic C modu les.
Rabbit also offers for purchase the Rabbit Embedded Security Pack featuring the Secure
Sockets Layer (SSL) and a specific Advanced Encryption Standard (AES) library. In addition to the Web-based technical support included at no extra charge, a one-year telephonebased technical support subscription is also available for purchase. Visit our Web site at
www.rabbit.com for further information and complete documentation, or contact your
Rabbit sales representative or authorized distributor.
4eDisplay (OP7200)
1.3 RabbitNet Peripheral Cards
RabbitNet™ is an SPI serial protocol that uses a robust RS-422 differential signalling interface (twisted-pair differential signaling) to run at a fast 1 Megabit per second serial rate. The
OP7200 has one RabbitNet port, which can support one peripheral card. Distances between a
master processor unit and peripheral cards can be up to 10 m or 33 ft.
The following low-cost peripheral cards are currently available.
• Digital I/O
• A/D converter
• D/A converter
• Display/Keypad interface
• Relay card
Appendix D provides additional information on RabbitNet peripheral cards and the RabbitNet protocol. Visit our Web site for up-to-date information about additional add-ons and fea-
tures as they become availa ble.
User’s Manual5
1.4 CE Compliance
Equipment is generally divided into two classes.
CLASS ACLASS B
Digital equipment meant for light industrial useDigital equipment meant for home use
Less restrictive emissions requirement:
less than 40 dB µV/m at 10 m
(40 dB relative to 1 µV/m) or 300 µV/m
More restrictive emissions requirement:
30 dB µV/m at 10 m o r 100 µV/m
These limits apply over the range of 30–230 MHz. The limits are 7 dB higher for frequencies
above 230 MHz. Although the test range goes to 1 GHz, the emissions from Rabbit-based
systems at frequencies above 300 MHz are generally well below background noise levels.
The OP7200 has been tested and was found to be in conformity with
the following applicable immunity and emission standards. The OP7210
is also CE qualified as it is a sub-version of the OP7200. Boards that
are CE-compliant have the CE mark.
NOTE: Earlier versions of the OP7200 sold before 2003 that do not
have the CE mark are not CE-compliant.
Immunity
The OP7200 operator control panels meet the following EN55024/1998 immunity standards.
• EN61000-4-2 (ESD)
• EN61000-4-3 (Radiated Immunity)
• EN61000-4-4 (EFT)
• EN61000-4-6 (Conducted Immunity)
Additional shielding or filtering may be required for a heavy industrial environment.
Emissions
The OP7200 operator control panels meet the following emission standards emission standards with the Rabbit 2000 spectrum spreader turned on and set to the normal mode. The
spectrum spreader is only available with Rev. C or higher of the Rabbit 2000 microprocessor. This microprocessor is used on the OP7200 operator control panels that carry the CE
mark.
• EN55022:1998 Class B
• FCC Part 15 Class B
Your results may vary, depending on your application, so additional shielding or filtering
may be needed to maintain the Class B emission qualification.
6eDisplay (OP7200)
1.4.1 Design Guidelines
Note the following requirements for incorporating the OP7200 operator control panels
into your application to comply with CE requirements.
General
• The power supply provided with the T ool Kit is for development purposes only. It is the
customer’s responsibility to provide a CE-compliant power supply for the end-product
application.
• When connecting the OP7200 to outdoor cables, the customer is responsible for providing CE-approved surge/lightning protection.
• Rabbit recommends placing digital I/O or analog cables that are 3 m or longer in a
metal conduit to assist in maintaining CE compliance and to conform to good cable
design practices. Rabbit also recommends using properly shielded I/O cables in noisy
electromagnetic environments.
• While the OP7200 meets the EN61000-4-2 (ESD) requirements in that it can withstand
contact discharges of ± 4 kV and air discharges of ± 8 kV, it is the responsibility of the
end-user to use proper ESD precautions to prevent ESD damage when installing or servicing the OP7200.
• To meet electromagnetic compatibility requirements, and in particular to prevent misoperation or damage from electrostatic discharges, connect the bezel to a protective
ground via a low-impedance path as explained in Section 6.1.
Safety
• For personal safety, all inputs and outputs to and from the OP7200 must not be connected to voltages exceeding SELV levels (42.4 V AC peak, or 60 V DC). Damage to
the Rabbit 2000 microprocessor may result if voltages outside the design range of 0 V
to 5.5 V DC are applied directly to any of its digital inputs.
• The lithium backup battery circuit on the OP7200 has been designed to protect the battery from hazardous conditions such as reverse charging and excessive current flows.
Do not disable the safety features of the design.
1.4.2 Interfacing the OP 7200 to Other Devices
Since the OP7200 operator control panels are designed to be connected to other devices,
good EMC practices should be followed to ensure compliance. CE compliance is ultimately the responsibility of the integrator. Additional information, tips, and technical
assistance are available from your authorized Rabbit distributor, and are also available on
our Web site at www.rabbit.com.
User’s Manual7
8eDisplay (OP7200)
2. GETTING S TARTED
Chapter 2 explains how to connect the programming cable and
power supply to the OP7200.
User’s Manual9
2.1 Power Supply Connections
1. First prepare the AC adapter for the country where it will be used by selecting the plug.
The OP7200 T ool Kit presently includes Canada/Japan/U.S., Australia/N.Z., U.K., and
European style plugs. Snap in the top of the plug assembly into the slot at the top of the
AC adapter as shown in Figure 2, then press down on the spring-loaded clip below the
plug assembly to allow the plug assembly to click into place.
Connect the bare ends of the power supply to the +PWR and -PWR positions on pins 1
and 2 of screw terminal header J3 as shown in Figure 2. The polarity of your connections is not important because the power-supply circuit has a full-wave bridge rectifier.
2. Apply power.
Plug in the AC adapter. If you are using your own power supply, it must provide 9 V to
40 V DC or 24 V AC—voltages outside this range could damage the OP7200.
NOTE: A hardware RESET is done by unplugging the AC adapt er, then plugging it back in.
Y ou may al so reset the OP7200 by groundi ng the reset input l ocated on pin 5 of screw-t erminal
header J10.
CAUTION: Unplug the power supply while you make or otherwis e work wit h the co nnection s
to the screw-terminal headers. This will prote ct your OP7 200 from inadver tent short s or power
spikes.
10eDisplay (OP7200)
2.2 Demonstration Program on Power-Up
A repeating sequence of graphics and menus will be displ ayed o n the LCD whe n power is
first applied to the OP7200. Press any of the five keypad buttons immediately below the
LCD to select the corresponding demonstration. When you are in a menu demo screen,
press the diamond-shaped keypad button in the middle row to enter the menu choice that
is highlighted, or press the up and down keys above and below the diamond-shaped keypad button to move around the menu.
Note that the programming cable should not be connected for this demonstration.
This demonstration will be replaced by a new program when the programming cable is
attached and the new program is compiled and run. The demonstration is available for
future reference in the Dynamic C SAMPLES\OP7200 directory as FUN.C.
User’s Manual11
2.3 Programming Cable Connections
Connect the programming cable to download programs from your PC and to program and
debug the OP7200.
NOTE: Use only the programming cable that has a red shrink wrap around the RS-232
level converter ( Part No. 1 01-0513), wh ich is s upplied wi th the OP7200 Tool Kit. Other
Rabbit programming cables might not be voltage-compatible or their connector sizes
may be different.
Connect the 10-pin PROG connector of the programming cable to header J1 on the
OP7200’s RabbitCore module. Ensure that the colored edge lines up with pin 1 as shown.
(Do not use the DIAG connector , which is used for monitoring only.) Connect the other end
of the programming cable to a COM port on your PC. Make a note of the port to which
you connect the cable, as Dynamic C will need to have this parameter configured. Note
that COM1 on the PC is the default COM port used by Dynamic C.
J1
PROG
USR PWR
CAUTION: Disconnect power
before making or removing
1
terminal connections.
D
Q5
1
J10
U2
60
R38
Q7
1
R
3
J14
MSTR
7
132
Q6
JP10
R
4
39
SLAVE
Q11
LS1
R55
Q10
9
R56
R
R
6
6
6
5
2
4
C13
C49
1S
C
V
8
T
2
J8
R
R
C
C
1
1
8
8
5
5
5
4
2
1
R
D24
14
9
X
R
C
X
T
R71
T
S
R72
R/
R59
R60
5
1
R66
IN
41
IN
3
1NI
21
IN
J10
D13
D14D15
D12
R
2
J13
J
C
P
1
1
C4
C
C
2
3
3JP
4
R61
J
C
R159
P
6
8
5
R1
J7
47
R81
D11
R
C2
3
U3
Y2
9
R7
9
EP
Flas
RO
h
M
JP
R165
3
R164
R162
JP1
DS2
L
D
N
S
K
1
ACT
C5
C6
1
C60
Y1
C5
7
Q13
C39
L9
C1
U8
U7
C7
J16
JP9
Q31
1
R36
R169C30
C40
JP2
C29
GND
JP5
GND
JP6
R-Net
EGND
J15
D
S
S
1
2
R91
J3
R14
D1
J3
Q2
R
2
4
Q4
3
R23
D
Q3
2
R22
D
Q8
5
C18
D
C17
4
D
6
C16
D
C30
8
D
C29
R
C8
6
D23
D20
D
N
G
5
8
4
+
5
8
4
D
X
R
D
X
T
C
D
C7
N
G
7
T
D
U
O
6
C8
T
U
C6
O
5
T
U
O
4
T
U
O
3
T
U
O
2
T
U
O
1
T
U
O
0
T
U
O
K
+
R
W
P
R
W
P
+
To
PC COM port
Programming
Cable
Colored edge
Red
shrink wrap
DIAG
R1
IN
J2
1
6I
N
R
R
1
1
1
7
8
5
IN
R
R
1
1
1
8
7
6
R20
AIN
R1
0
9R2
A
6
IN
R
PROG
3
IN
4
IN
5
IN6
IN
7
IN
8
IN9
IN
10
Q3
I
N11
1
1
R25
0
A
8
R28
I
R
N
J
2
2
P
7
5
R
3
A
C
0
I
6
N
J
P
7
R2
JP2
3
Y1
6
R1
R82
3
R41R44
1
3
R46
R4
5
L2
PROG
C
R
C4
7
7
4
5
C17
J9
R
R
8
8
4
R18
C14
R16
Y3
R29R31
42
R4
C32
C31
R
R8
C28
C2
5
E-Net
50
R40R
Battery
R36
R85
U2
C
6JP
6
Q12
CAUTION
1
R80
D10
C
D2
3
C
R7
27
U6
R
R
R
7
7
3
7
6
8
8
R37
RT1
D3
R
R
8
8
8
7
R8
9
J2
R86
C51
D1
71
RR4
JP4
LNK ACT
3A
IN
4
A
IN5A
IN6
A
IN7
A
GND
J2
J6
IN0
J1
IN
1
IN2
IN
C8
R9
J6
R1
R
3
1
1
C43
BT1
U1
C44
R15
C12
R17
J
P
Q2
R21
C13
R22
3
R20
R90
R19
C48Q4
Q5
J12
Figure 3. Programming Cable Connections
NOTE: Some PCs now come equipped only with a USB port. It may be possible to use an
RS-232/USB converter (Part No. 20-151-0178) with the programming cable supplied
with the OP7200 Tool Kit. Note that not all RS-232/USB converters work with
Dynamic C.
12eDisplay (OP7200)
2.4 Installing Dynamic C
If you have not yet installed Dynamic C version 7.30 (or a later version), do so now by
inserting the Dynamic C CD from the OP7200 Tool Kit in your PC’s CD-ROM drive. The
CD will auto-install unless you have disabled auto-install on your PC.
If the CD does not auto-install, click Start > Run from the Windows St art button and
browse for the Dynamic C setup.exe file on your CD drive. Click OK to begin the
installation once you have selected the setup.exe file.
The online documentation is installed along with Dynamic C, and an icon for the documentation menu is placed on the workstation’s desktop. Double-click this icon to reach the
menu. If the icon is missing, create a new desktop icon that points to default.htm in the
docs folder, found in the Dynamic C installation folder.
The latest versions of all documents are always available for free, unregistered download
from our web sites as well.
The Dynamic C User’s Manual provides detailed instructions for the installation of
Dynamic C and any future upgrades.
NOTE: If you have an earlier version of Dynamic C already installed, the default instal-
lation of the la te r ver sion wi ll b e in a dif f erent fold er, and a separate icon will appear on
your desktop.
2.5 Starting Dynamic C
Once the OP7200 is connected to your PC and to a power source, start Dynamic C by
double-clicking the Dynamic C icon on your desktop or in your Start menu. Dynamic C
uses the serial port specified during installation
If you are using a USB port to connect your PC to the OP7200, choose Options > Pro ject
Options
cations
Dynamic C assumes, by default, that you are using serial port COM1 on your PC when
you are running a program. If you
OP7200 and go through a sequence
BIOS. If the error message “Rabbit Processor Not Detected” appears, you have probably
connected to a different PC serial port such as COM2, COM3, or COM4. You can change
the serial port used by Dynamic C with the OPTIONS menu, then try to get Dynamic C to
recognize the OP7200 by selecting Reset T arget/Compile BIOS on the Compile menu or
by pressing <Ctrl-Y>. Try the different COM ports in the OPTIONS menu until you find
the one you are connected to. If you still can’t get Dynamic C to recognize the target on
any port, then the hookup may be wrong or the COM port might not working on your PC.
If you receive the “BIOS successfully compiled …” message after pressing <Ctrl-Y> or
starting Dynamic C, and this message is followed by a communications error message, it
is possible that your PC cannot handle the 115,200 bps baud rate. Try changing the baud
rate to 57,600 bps as follows.
and check “Use USB to Serial Converter” in “Serial Options” on the Communi-
tab. Click OK to save the settings.
are
using COM1, then Dynamic C should detect the
of steps to cold-boot the OP7200 and to compile the
• Locate the Serial Options dialog in the Dynamic C Options > Communications
menu. Change the baud rate to 57,600 bps.
User’s Manual13
2.6 PONG.C
You are now ready to test your set-up by running a sample program.
Find the file PONG.C, which is in the Dynamic C SAMPLES folder. To run the program,
open it with the File menu (if it is not still open), then compile and run it by pressing F9 or
by selecting Run in the Run menu. The STDIO window will open on the PC and will display a small square bouncing around in a box.
This program shows that the CPU is working. The sample program described in
Section 5.2.3, “Run the PINGME.C Demo,” tests the TCP/IP portion of the board.
2.7 Where Do I Go From Here?
NOTE: If you purchased your OP7200 through a distributor or Rabbit partner, contact
the distributor or partner first for technical support.
If there are any problems at this point:
• Use the Dynamic C Help menu to get further assistance with Dynamic C.
• Check the Rabbit Technical Bulletin Board and forums at www.rabbit.com/support/bb/
and at www.rabbit.com/forums/.
• Use the Technical Support e-mail form at www.rabbit.com/support/.
If the sample program ran fine, you are now ready to go on to explore other OP7200 fea-
tures and develop your own applications.
The following sample programs illustrate the features and operation of the OP7200.
These sample programs can be used as templates for applications you may wish to
develop.
Chapter 3, “Subsystems,” provides a description of the OP7200’s features, Chapter 4,
“Software,” describes the Dynamic C software libraries and introduces some sample programs. Chapter 5, “Using the TCP/IP Features,” explains the TCP/IP features.
14eDisplay (OP7200)
2.8 Remove Battery Tab
The backup battery on the OP7200 has a plastic tab to protect the battery against discharging before the OP7200 is placed into service. Although the battery is located inside the
OP7200’s protective casing, it is possible to reach the plastic tab using pliers or tweezers
from the opening on the side of the OP7200 shown in Figure 4.
USR PWR
Pull
Plastic
Tab
R
R
1
2
IN16IN
17
IN
1
8AIN
0 A
IN
1 A
IN2A
IN
3
A
R31
IN4
A
IN5
A
R41
IN
R44
R
6
A
4
1
3
R46
IN
R4
7
5
A
GND
J2
JP
7
L2
C31
J6
IN0 IN
1IN
2
IN3IN
J6
4 IN
R13
5IN
BT1
6
U1
IN
7 IN
R15
8
C12
IN
R17
9
Q2
IN
R20
R19
10
IN
C48
Q3
Q4
11
Q5
J12
PROG
J1
R2
JP2
C
R
R
C4
36
Y1
7
7
R8
4
5
R1
C17
C8
R9
R11
C43
J9
R
R
R
8
8
8
2
3
4
C44
R18
2
JP
C13
3
5
R21
R22
C14
R16
R90
Y3
J2
R
R
18
1
4
5
R
R
C
1
16
2
7
JP
R20
4
R
19R
26
R
1
R25
0
R159
8
R28
R
J
2
P
7
5
R
3
C
0
6
6
JP
R29
6
R40R
42
Q12
Battery
C32
1
R80
R
3
D10
9
C
D2
3
C
R7
2
7
U6
D1
R77R
R
R
76
7
3
8
R
8
4
R36
1
R37
RT1
JP4
JP3
D3
R
R
8
8
8
7
LNK ACT
R
R
8
8
5
9
J2
R86
U2
C28
C
E-Net
C
C
5
5
1
0
JP
C
1
1
C
C
33
R61
C65
R
147
R81
D11
R79
R165
R164
R162
S
1
1
D13
J
P8
J7
C2
Y2
EPROM
Flash
LN
D
K
D14D15
D12
J13
U3
R36
R169
C30
JP2
JP5
JP1
JP6
DS2
EGND
ACT
CAUTION: Disconnect power
before making or removing
terminal connections.
C
5
C61
C60
Y1
C57
Q13
C39
L9
C1
U8
U7
C7
J16
J
P9
1
Q31
C40
C29
GND
GND
R-Net
J15
J14
J10
R60
R66
D
Q5
1
U2
J3
60
R23
R2
2
Q8
R38
Q7
1
R37
MSTR
132
Q6
JP10
R
4
39
SLAVE
Q11
LS1
D24
R71
R72R59
J10
8
R55
D
Q10
9
R56
R
R
R
6
62
6
5
8
4
6
C13
C49
1S
C
V
8
T
2
J8
R
R
C
C
1
1
85
8
5
5
4
2
1
R149
R
D
X
T
C
X
R
C
X
T
T
S
/R
15
IN
4
1
3 IN
1
IN2
1
IN
Q2
R
24
Q4
Q3
D
4
D
6D
C29
C
D23
48
+
85
4
D
X
D
S
S
1
2
R91
J3
R14
D1
D3
D
2
D
5
C18
C17
C16C30
+PW
D20
D
N
G
5
D
C7
N
7 G
T
U
O
C8
T6
U
C6
O
5
T
OU
T4
OU
3
T
U
O
T2
U
O
UT1
O
0
T
U
O
+K
R
W
P
R
Figure 4. Remove Battery Tab
NOTE: Rabbit recommends that the battery tab not be removed until you are ready to
place the OP7200 in normal service with regular power connected to header J3.
The backup battery protects the contents of the SRAM and keeps the real-time clock
running when regular power to the OP7200 is interrupted. If you plan to use the real-time
clock functionality in your application, you will need to set the real-time clock once you
remove the plastic tab. Set the real-time clock using the onscreen prompts in the demonstration program. Alternatively, you may set the real-time clock using the
SETRTCKB.C
sample program from the Dynamic C SAMPLES\RTCLOCK folder. The RTC_TEST.C
sample program in the Dynamic C SAMPLES\RTCLOCK folder provides additional exam-
ples of how to read and set the real-time clock.
User’s Manual15
16eDisplay (OP7200)
3. SUBSYSTEMS
Chapter 3 describes the principal subsystems for the OP7200.
•Digital I/O
• Analog Features (OP7200 only)
• Serial Communication
• Memory
• Liquid Crystal Display Controller
• Keypad
• OP7200 CPLD
Figure 5 shows these Rabbit-based subsystems designed into the OP7200.
SRAM
Flash
32 kHz
osc
RABBIT
2000
11 MHz
osc
RS-232
RS-485
CPLD
Digital
Input
Digital
Output
A/D
Converter
Ethernet
Touch-
RabbitCore Module
Figure 5. OP7200 Subsystems
screen
Controller
Interface to
LCD/Keypad
The memory and microprocessor are located on the RabbitCore module. The RCM2200
module is used on the OP7200. If you have more than one OP7200 or other Rabbit products
built around RabbitCore modules, take care not to swap the RabbitCore modules since they
contain system ID block i nfo rmation and calibration constants that are unique to the board
they were originally installed on. It is a good idea to save the calibration constants should
you need to replace a RabbitCore module in the future. See Section 4.3.8, “Using System
Information from the RabbitCore Module,” for more information.
User’s Manual17
3.1 OP7200 Pinouts
The OP7200 pinouts are shown in Figure 6.
Digital
Inputs
Analog
Inputs
Digital
Inputs
IN16
IN17
IN18
AIN0
AIN1
AIN2
AIN3
AIN4
AIN5
AIN6
AIN7
AGND
IN10
IN11
J2
J3
Battery
IN0
IN1
IN2
IN3
IN4
IN5
IN6
IN7
IN8
IN9
J6
R9
BT1
J10
J1
R2
C4
Y1
R1
C17
C8
R13
R11
U1
R15
C12
R17
Q2
Q3
R21
C13
R20
R19
Q4
Q5
R39
C2
C3
D2
R7
U6
R8
R36
R22
Y2
C27
D1
R38
R41
R37
RT1
JP4
JP3
D3
J2
U2
C28
C25
R18
C14
R16
Y3
Flash
U3
EPROM
C1
U8
U7
C7
C30
JP2
C29
GND
JP5
JP1
GND
JP6
DS2
EGND
LNK
DS1
ACT
GND
OUT7
OUT6
OUT5
OUT4
OUT3
OUT2
OUT1
OUT0
+K
-PWR
+PWR
GND
+485
485
RXD/CTS
TXD/RTS
RXC
TXC
/RST
IN15
IN14
IN13
IN12
Digital
Outputs
K
Power
Supply
RS-485
RS-232
Reset
Digital
Inputs
Ethernet
RabbitNet
Figure 6. OP7200 Pinouts
NOTE: Screw-terminal header J2 and the associated analog and digital I/O are not avail-
able on the OP7210.
3.1.1 Headers and Screw Terminals
Standard OP7200 models are equipped with four 1 × 12 screw terminal strips (J2, J3, J6,
and J10), and a 2 × 5 programming header and an RJ-45 Ethernet jack on the RCM2200
RabbitCore module.
The RJ-45 jack labeled RabbitNet is a serial I/O expansion port for use with RabbitNet
I/O cards. The RabbitNet jack does not support Ethernet connections. Be c areful to connect
your Ethernet cable to the jack labeled Ethernet.
18eDisplay (OP7200)
3.2 Indicators
3.2.1 LEDs
The OP7200 has two LEDs, Power Good and Microprocessor Bad.
The green Power Good LED at DS2 indicates when power is applied to the OP7200 and
that Vcc is within the proper operating range of 4.5 to 5.5 V. The LED turns off when the
OP7200 is being reset.
The red Microprocessor Bad LED at DS1 indicates the status of the OP7200. Following
reset, DS1 will be ON and will remain ON until turned OFF by Dynamic C. Once the
microprocessor comes out of reset and finishes all its internal checks and initializes the
system, it should turn DS1 OFF.
The operation of DS1 may be redefined in any manner desired with the caveat that DS1
comes ON after reset. The USR label on the dust cover refers to the LED at DS1 and
reflects its secondary purpose as a user-defined indicator.
3.2.2 Buzzer
An audible buzzer is turned on and off through the use of a programmed I/O bit defined in
software.
User’s Manual19
3.3 Digital I/O
3.3.1 Digital Inputs
The OP7200 has 19 digital inputs, IN0–IN18, each of which is protected over a range of
–36 V to +36 V. The inputs are factory-configured to be pulled up to +5 V, but they can
also be pulled down to 0 V in banks of eight by changing a surface-mounted 0 Ω resistor.
Figure 7 shows a sample digital input circuit. All 19 inputs are protected against noise
spikes by a low-pass filter composed of a 22 kΩ series resistor and a 10 nF capacitor.
JP3
0 W
27 kW
22 kW
GND
Figure 7. OP7200 Digital Inputs [Pulled Up—Factory Default]
Vcc
10 nF
Factory
Default
Rabbit 2000
Microprocessor
®
OP7200 series boards can be made to order in volume with the banks of digital inputs
pulled down to 0 V. Contact your authorized Rabbit distributor or your Rabbit sales
representative for more information.
For IN0–IN7 the actual switching point between a zero and a one is 1.5 V max and 3.5 V
min respectively . The range between 1.5 and 3.5 V is undefined. For IN8–IN15 the actual
switching point between a zero and a one is 0.8 V max and 2.0 V min respectively. The
range between 0.8 and 2.0 V is undefined. For IN16–IN17, which are available only on
the OP7200 model, the actual switching point between a zero and a one is 0.8 V max and
3.5 V min respectively. The range between 0.8 V and 3.5 V is undefined.
Therefore, the input voltage must be less than 0.8 V for all the digital inputs as a group to
ensure that a zero is being read, and the input voltage must be must be greater than 3.5 V
for a one.
IN16–IN18 interface to the A/D converter chip serially with an access time of 100 µs,
which is different from the access time of 5 µs for IN0–IN15, which interface in parallel
with the Rabbit 2000 microprocessor.
20eDisplay (OP7200)
The digital inputs are each fully protected over a range of -36 V to +36 V, and can handle
short spikes of ±40 V.
Normal Switching
Levels
+40 V
+36 V
+3.3 V
Spikes
Spikes
Digital Input Voltage
40 V
Spikes
Figure 8. OP7200 Digital Input Protected Range
User’s Manual21
3.3.2 Digital Outputs
The OP7200 has eight digital outputs, OUT0–OUT7, which are individually configurable
with the digoutConfig or digoutTriStateConfig software function calls as sinking
(up to 350 mA per channel) or as sourcing (up to 250 mA per channel). Figure 9 shows a
wiring diagram for using the digital outputs in a sinking or a souring configuration.
SINKING OUTPUTS
+K
Current
Flow
CPLD
SINK
CONTROL
SIGNAL
SOURCING OUTPUTS
+K
CPLD
SOURCE
CONTROL
SIGNAL
Figure 9. OP7200 Digital Outputs
Current
Flow
All the digital outputs are in the high-impedance tristate when the OP7200 is initially
powered on or reset. The CPLD (U4) then enables either the sink control or the source
control to operate the digital outputs as sinking or sourcing, and thereby serves as a hardware block to prevent both sinking and sourcing drivers from being activated at the same
time in a given channel.
Although the components are not installed, there is provision on the circuit board for the digital outputs to be pulled as a group to Vcc, +K, or to GND through 27 kΩ resistors. In special circumstances, you may need to pull sinking outputs high to either Vcc or +K, or you
may need to pull sourcing outputs to GND, for example, when driving low-level logic signals. Pulling the digital outputs up to +K allows the current-sinking outputs to be used as
voltage outputs where their upper level is controlled by the voltage of +K. OP7200 series
22eDisplay (OP7200)
boards can be made to order in volume with the digital outputs pulled up to Vcc or +K, or
pulled down to GND. Contact your authorized Rabbit distributor or your Rabbit sales representative for more information.
+K is an externally supplied voltage of 9–40 V DC used primarily in combination with
current sourcing outputs, and should be capable of delivering up to 2 A. Although a connection to a +K supply is not absolutely required with sinking outputs, it is highly rec om-mended to protect against current spikes when driving inductive loads.
Connect the positive +K supply to pin 3 of s crew-terminal header J3 and the negative s ide
of the supply to pin 12 of screw-terminal header J3. Exercise care to connect this supply
correctly because the +K inputs are not protected against reverse polarity, and serious
damage to the OP7200 may result if you connect this supply backwards.
When you are using the same DC power supply as the main power supply for the OP7200
and as the +K power supply, Rabbit recommends that you tie the -PWR connection to
ground. Since this step will bypass the reverse-polarity protection afforded by the fullwave bridge rectifier, ensure that the positive leads from the power supply are connected
correctly to prevent damage to the OP7200.
Figure 10. +K, Power Supply, and Sample Load Connections
User’s Manual23
3.4 Analog Features (OP7200 only)
The single A/D converter used in the OP7200 (the OP7210 does not have analog or touchscreen capabilities) has a resolution of 11 bits (single-ended mode) or 12 bits (differential
mode). There are eight channels of A/D conversion, and the OP7200 also has provision
for up to four digital inputs. Three of the four digital inputs are available on screw terminal
header J2. The fourth digital input serves as a board status bit, and is controlled by a 0 Ω
surface-mount resistor R159. The factory default is for R159 to not be installed, which
leaves this fourth input pulled up to Vcc.
3.4.1 A/D Converter Inputs
Figure 11 shows a pair of A/D converter input circuits. Each A/D converter input consists
of resistors and a capacitor. The resistors form a10:1 attenuator, and the capacitor protects
the A/D converter input against electrostatic discharges.
+ V
180 kW
AIN0
AIN1
180 kW
1 nF
1 nF
20 kW
20 kW
ADC
ADC
0 W
AGND
Factory
Default
Figure 11. A/D Converter Inputs
2.048 V
24eDisplay (OP7200)
The A/D converter chip can make either single-ended or differential measurements
depending on the value of the opmode parameter in the software function call. Adjacent
A/D converter inputs are paired to make differential measurements. The default setup for
the OP7200 is to measure only positive voltages for the ranges listed in Table 2.
Table 2. Positive A/D Converter Input Voltage Ranges
Min. Voltage
(V)
0.0+20.0110
0.0+10.025
0.0+5.042.5
0.0+4.052.0
0.0+2.581.25
0.0+2.0101.0
0.0+1.25160.625
0.0+1.0200.500
Max. Voltage
(V)
Amplifier
Gain
mV per Tick
Many other possible ranges are possible by physically changing the resistor values that
make up the attenuator circuit.
It is also possible to read a negative voltage by moving the 0 Ω jumper (see Figure 11) on
header JP4, JP5, JP6, or JP7 associated with the A/D converter input from analog ground
to the 2.048 V reference voltage generated and buffered by the A/D converter. Adjacent
input channels are paired so that moving a particular jumper changes both of the paired
channels. At the present time Rabbit does not offer the software drivers to work with single-ended negative voltages, but the differential mode described below may be used to
measure negative voltages.
Differential measurements require two channels. As the name differential implies, the dif-
ference in voltage between the two adjacent channels is measured rather than the difference between the input and analog ground. Voltage measurements taken in differential
mode have a resolution of 12 bits, with the 12th bit indicating whether the difference is
positive or negative.
User’s Manual25
The A/D converter chip can only accept positive voltages. When the 0 Ω resistor shown in
Figure 11 ties the A/D attenuator circuit to analog ground, both differential inputs must be referenced to analog ground, and both inputs must be positive with respect to analog ground.
If a device such as a battery is connected across two channels for a
differential measurement, and it is
not referenced to analog ground,
then the current from the device
will flow through both sets of
attenuator resistors as shown in
Figure 12. This will generate a
Device
AIN0
+
-
AIN1
I
180 kW
1 nF
1 nF
180 kW
20 kW
+
20 kW
ADC
0
1
negative voltage at one of the
inputs, AIN1, which will almost
certainly lead to inaccurate A/D
Figure 12. Current Flow from Ungrounded
or Floating Source
conversions.
To make such differential measurements, move the 0 Ω resistor jumper (see Figure 11)
associated with the A/D converter inputs (JP4, JP5, JP6, or JP7) from analog ground to the
2.048 V reference voltage. This allows input voltages that are negative with respect to
analog ground. Table 3 provides the differential voltage ranges for this setup.
The input circuit of the OP7200 was designed to use the differential mode in a unique way
to support measuring voltages in an equal range above and below ground. This method
also requires you to move the 0 Ω jumper (see Figure 11) on the header associated with the
A/D converter inputs (JP4, JP5, JP6, or JP7) from analog ground to the 2.048 V reference
voltage. The input is connected to the even-numbered channel, and the odd-numbered
channel is tied to analog ground. T able 4 provides the bipolar voltage ranges for this setup.
Table 4. Bipolar Voltages
Min. Voltage
(V)
-20.0+20.0110
-10.0+10.025
-5.0+5.042.5
-4.0+4.052.0
-2.5+2.581.25
-2.0+2.0101.00
-1.25+1.25160.625
-1.0+1.0200.500
Max. Voltage
(V)
Amplifier
Gain
3.4.2 Analog Curr ent Measurements
The A/D converter inputs can also be used with 4–20 mA
current sources by measuring the resulting analog voltage drop across a 100 Ω 1% precision resistor placed
between the analog input and analog ground as shown in
Figure 13.
The single-ended scale of 0–2.56 V with a gain of 8 is
used to get an A/D current conversion of 12.5 µA/tick.
mV per Tick
AIN0AIN7
100 W
1%
AGND
Figure 13. Resistor for 4–20 mA
Current Sources
User’s Manual27
3.4.3 Calibrating the A/D Converter Chip
Manufacturing tolerances for resistors, bias currents, offset voltages, gain, and the like
introduce errors into the A/D conversions. Ideally there would be a one-to-one straightline relationship between the input voltage and the output of the A/D converter, and a
graph of such a line would have a slope of 1 and would pass through the (0,0) coordinate.
However, the errors arising from manufacturing tolerances introduce a deviation between
the applied input voltage and the voltage that is output by the A/D converter. The actual
plot of voltage in vs. the voltage out from A/D converter is not actually a straight line.
However, a straight line is a very good first-order approximation, and the calibration routines provided for the OP7200 are based on a straight line with a slope of 1 and an offset
from (0,0). The calibration routines use two known measurement points on the voltage-in
vs. voltage-out line as the basis to calculate calibration constants that will be used to adjust
for the slope of the line and the offset from (0,0). The calibration routines typically use
input voltage points that are 10% less then the maximum and 10% more than the minimum readings possible for the A/D converter on any given range.
Quality calibration procedures are extremely important in obtaining good A/D converter
results. No matter how high a resolution the A/D converter has, it cannot compensate for
improper calibration. A/D converter results will never be more accurate than the meter
used in the calibration process. Therefore, use the best digital volt and milli-amp meter
available that meets or exceeds the accuracy of the A/D converter chip.
3.4.3.1 Modes
The OP7200 A/D converter operates in three different modes:
• the single-ended mode,
• the differential mode, and
• the milli-amp mode
The calibration and read routines provided correspond to these three modes.
3.4.3.2 Calibration Constants
The A/D converter has eight individual input channels, and each channel has eight programmable gains. Additionally, the A/D converter has the capability for adjacent inputs
to be paired to make differential measurements with eight different gains, and provision is
also made to convert 4–20 mA analog current measurements.
28eDisplay (OP7200)
To get the best results form the A/D converter, it is necessary to calibrate each mode for
each of its gains. The following table provides a grid for each possible set of calibration
constants.
Mode
Single-EndedmADifferential
Gain
Code
Input
12458101620412458101620
0
1
2
3
4
5
6
7
For the single-ended mode there are calibration constants for each channel and for each of
its gains, for a total of 64 sets of calibration constants. The milli-amp mode covers 4–20 mA
(actually 0–25 mA) currents. Separate calibration and read-back routines are provided for
this. Since only one range of current measurement is provided, these routines use only one
gain (4). One set of calibration constants is provided for each of the eight input channels.
The differential-mode routines use a pair of input channels to make measurements. In this
case, calibration constants are stored for each pair of channels and for each of the eight
gains, for a total of 32 sets of calibration constants.
When a calibration is performed, it fills in one of the squares in the table with a set of calibration constants representing the corresponding mode, channel, and gain. These constants are stored in flash memory, and are thus maintained even when power is been
removed from the OP7200. Note that calibration constants are stored for each of the
modes. Since A/D converter read routines select the appropriate calibration constants based
on the mode, it is possible for software calls to move from one mode to another without
recalibration.
3.4.3.3 Calibration Recommendations
It is imperative that you calibrate each of the A/D converter inputs in the same manner as
they are to be used in the application. For example, if you will be performing floating differential measurements or differential measurements using a common analog ground, then
calibrate the A/D converter in the corresponding manner. The calibration must be done
with the attenuator reference selection jumper in the desired position (see Figure 11). If a
User’s Manual29
calibration is performed and the jumper is subsequently moved, the corresponding input(s)
must be recalibrated. The calibration table only holds calibration constants based on
mode, channel, and gain. Other factors affecting the calibration must be taken into
account by calibrating using the same mode and gain setup as in the intended use.
It is not necessary to fill out the entire calibration table. Only the entries associated with
the modes, channels, and gains that you will be using are necessary. This fact can be used
to simplify and speed up the calibration process.
Each calibration is normally done at 10% less than the maximum and 10% more than the
minimum within a given voltage range defined by the mode, channel, and gain. However,
if an application is known to use only portion of a particular range, it is possible to obtain
improved accuracy by using calibration points that are 10% less than the expected maximum and 10% greater than the expected minimum.
3.4.3.4 Factory Calibration
Because of the large number of possible calibrations, the factory performs only a rudimentary calibration on the unit. By default, all four of the attenuator reference selection jumpers are in the analog ground position. The factory performs a single-ended calibration on
each of the eight channels with a gain of 1 (0–20 V range). The remaining single-ended
calibration constants for the other seven gains are approximated and are filled in based on
the initial calibration. The milli-amp and differential portions of the table are filled in
using typical expected values. All read routines will work properly with these factory-initialized calibration constants, but only the single-ended mode should be expected to return
accurate results over a range of 0–20 V until you recalibrate the OP7200 for your use.
Sample programs are provided to illustrate how to read and calibrate the various A/D
inputs for the three operating modes.
ModeReadCalibrate
Single-Ended, one channel
Single-Ended, all channels
Milli-Amp
Differential, analog ground
Differential, 2 V reference
ADRD_SE_CH.CADCAL_SE_CH.C
ADRD_SE_ALL.CADCAL_SE_ALL.C
ADRD_MA_CH.CADCAL_MA_CH.C
ADRD_DIFF_GND.CADCAL_DIFF_GND.C
ADRD_DIFF_2V.CADCAL_DIFF_2V.C
These sample programs are found in the ADC subdirectory in SAMPLES\OP7200. See
Section 4.3, “Sample Programs,” for more information on these sample programs and how
to use them.
30eDisplay (OP7200)
3.4.4 Touchscreen
The OP7200 analog touchscreen provides a high-resolution matrix of 4096 × 4096
elements. The touchscreen is mounted to the front of and is the same size as the LC D module. A four-conductor flex cable connects the touchscreen to the OP7200 at connector J13.
The inputs from the touchscreen are protected from ESD by ferrite beads, capacitors, and
shunt diodes. The ferrite beads and capacitors also serve to eliminate EMI radiating from
the cable. Ferrite beads rather than resistors are used in series with the inputs to maintain
the most accurate measurement of the touchscreen x,y position.
A reference voltage is applied across the touchscreen. When the touchscreen is touched,
resistances that represent the x,y position are presented at the input circuit. The touchscreen
controller chip U9 converts these resistances into digital form for use by the software.
NOTE: Should you to uch two or more di ffere nt point s on the touchs creen simul taneousl y,
the resistance presented to the input circuit will represent some difference between the
resistances corresponding to the points. This can lead to a different or an unknown
key’s value being processed. To prevent this from happening, exercise care to “touch”
only one point or position on the touchscreen at a time.
3.4.5 Analog Supply Voltage
The analog section is isolated from digital noise generated by other components by way of a
low-pass filter composed of L2, C31, and C32 as shown in the left side of Figure 14. The +V
analog power supply powers the A/D converter chip.
+V
Vcc
L2
C31
100 nF
+V
C32
100 nF
ADC Chip
Internal
Reference
Voltage
JP8
3
2
1
To
A/D Converter
R148
100 W
R150
453 W
Figure 14. Analog Supply and Voltage Reference Circuits
U12
C91
100 nF
User’s Manual31
3.4.6 A/D Converter Reference Voltage (+V)
A reference voltage of 2.048 V is generated by the A/D converter chip. The reference voltage is used by the touchscreen controller chip, and may also be used to bias the input
attenuator circuits when bipolar inputs are to be measured. As shown in Figure 14, the
factory default is for a surface-mounted 0 Ω resistor to connect pins 1–2 on header JP8.
This enables the internal reference voltage of 2.04 8 V g enerated by the A/D converter ch ip.
By connecting pins 2–3 on header JP8 instead, a ratiometric reference can be provided by
the divider consisting of R148 and R150. A fixed reference can be configured by removing R150 and installing a zener diode at U12. The zener diode will then set the reference
voltage. C91 would be always installed, and provides filtering. None of these components
(R148, R150, C91, or U12) is factory-installed.
32eDisplay (OP7200)
3.5 Serial Communication
The OP7200 has two RS-232 serial ports, which can be configured as one RS-232 serial
channel (with R TS/C TS) or as two RS-232 (3-wire) channels using the serMode software
function call. Table 5 summarizes the options.
The OP7200 also has one RS-485 serial channel and a CMOS serial channel that serves as
the programming port. When you are using the OP7200 in a RabbitNet network, Serial
Port B is configured as a clocked serial port and the RS-485 chip drives the RabbitNet
port—the OP7200 then cannot be used for RS-485 serial communication.
All four serial ports operate in an asynchronous mode up to the baud rate of the system
clock divided by 32. An asynchronous port can handle 7 or 8 data bits. A 9th bit address
scheme, where an additional bit is sent to mark the first byte of a message, is also supported. Serial Port A, the programming port, and Serial Port B can be operated alternately
in the clocked serial mode. In this mode, a clock line synchronously clocks the data in or
out. Either of the two communicating devices can supply the clock. When the Rabbit provides the clock, the baud rate can be up to ¼ of the system clock frequency, or more than
5.525 Mbps for a 22.1 MHz clock speed.
The OP7200 boards use all four serial ports. Serial Port A is used in the clocked serial
mode to provide cold-boot, download, and emulation functions. Serial Port B is used
either for RS-485 or for RabbitNet communication, and Serial Ports C and D are used for
RS-232 communication. The OP7200 uses an 11.0592 MHz crystal, which is doubled to
22.1184 MHz. At this frequency, the OP7200 supports standard asynchronous baud rates
up to a maximum of 230,400 bps.
User’s Manual33
3.5.1 RS-232
The OP7200 RS-232 serial communication is supported by an RS-232 transceiver. This
transceiver provides the voltage output, slew rate, and input voltage immunity required to
meet the RS-232 serial communication protocol. Basically, the chip translates the Rabbit
2000’ s CMOS/TTL signals to RS-232 signal levels. Note that the polarity is reversed in an
RS-232 circuit so that a +5 V output becomes approximately -10 V and 0 V is output as
+10 V. The RS-232 transceiver also provides the proper line loading for reliable communication.
RS-232 can be used effectively at the OP7200’s maximum baud rate for distances of up to
15 m.
If you are planning to use any of the RS-232 serial ports and the RabbitNet port on the
OP7200, initialize the serial port(s) before you initialize the RabbitNet port. Section 4.5.4
provides some sample code to illustrates the sequence.
3.5.2 RS-485
The OP7200 has one RS-485 serial channel, which is connected to the Rabbit 2000 Serial
Port B through an RS-485 transceiver. The half-duplex communication uses an output
from the CPLD (U4) to control the transmit ena ble on the communic ation line. Using this
scheme a strict master/slave relationship must exist between devices to insure that no two
devices attempt to drive the bus simultaneously.
The OP7200 can be used in an RS-485 multidrop network spanning up to 1200 m (4000 ft),
and there can be as many as 32 attached devices. Connect the 485+ to 485+ and 485– to
485– using single twisted-pair wires as shown in Figure 15. Note that a common ground is
recommended.
RS485+
RS-485
GND
RS-485
Figure 15. OP7200 Multidrop Network
GND
RS485+
RS485+
RS-485
GND
34eDisplay (OP7200)
The OP7200 comes with a 220 Ω termination resistor and two 681 Ω bias resistors
installed and enabled with jumpers across pins 1–2 and 4–6 on header J8, as shown in
Figure 16.
For best performance, the termination resistors in a multidrop network should be enabled
only on the end nodes of the network, but not on the intervening nodes. Jumpers on boards
whose termination resistors are not enabled may be stored across pins 1–3 and 5–6 of
header J8.
NOTE: Remove the back cover from the OP7200 to access the bias and termination
resistor jumpers on header J8.
User’s Manual35
3.5.3 RabbitNet Port
The RJ-45 jack labeled RabbitNet is a serial I/O expansion port for use with RabbitNet
I/O cards. The RabbitNet jack does not support Ethernet connections. There is also no
provision for the OP7200 to supply power to any RabbitNet peripheral cards.
When you are using the OP7200 in a RabbitNet network, Serial Port B is configured as a
clocked serial port and the RS-485 chip drives the RabbitNet port—the OP7200 then
cannot be used for RS-485 serial communication.
If you are planning to use any of the RS-232 serial ports and the RabbitNet port on the
OP7200, initialize the serial port(s) before you initialize the RabbitNet port. Section 4.5.4
provides some sample code to illustrates the sequence.
In principle, the OP7200 can operate either as a master controller with RabbitNet expansion I/O, or it can operate as a slave operator interface in a RabbitNet network. Jumper
settings on header JP10 are used to configure the OP7200 for master or slave operation as
shown in Appendix A.3, “Jumper Configurations.” The factory default is for the OP7200
to be configured as a RabbitNet master.
At the present time, Dynamic C does not support the operation of the OP7200 as a slave,
and so the OP7200 is restricted to being used as a master.
Appendix D provides additional information about the RabbitNet system.
36eDisplay (OP7200)
3.5.4 Ethernet Port
Figure 17 shows the pinout for the Ethernet port (J2 on the OP7200’s RabbitCore module).
Note that there are two standards for numbering the pins on this connector—the convention
used here, and numbering in reverse to that shown. Regardless of the numbering convention followed, the pin positions relative to the spring tab posi tion (located at t he bottom of
the RJ-45 jack in Figure 17) are always absolute, and the RJ-45 connector will work properly with off-the-shelf Ethernet cables.
ETHERNET
RJ-45 Plug
1
RJ-45 Jack
1. E_Tx+
2. E_Tx
3. E_Rx+
6. E_Rx
8
Figure 17. RJ-45 Ethernet Port Pinout
RJ-45 pinouts are sometimes numbered opposite to the way shown in Figure 17.
Two LEDs are placed next to the RJ-45 Ethernet jack, one to indicate a live Ethernet link
(LNK) and one to indicate Ethernet activity (ACT).
The transformer/connector assembly ground is connected to the OP7200’s RabbitCore
module printed circuit board digital ground via a 0 Ω resistor “jumper,” R29, as shown in
Figure 18.
RJ-45 Ethernet Plug
R29
Board
Ground
Chassis
Ground
Figure 18. Isolation Resistor R29
The factory default is for the 0 Ω resistor “jumper” at R29 to be installed. In high-noise
environments, remove R29 and ground the transformer/connector assembly directly
through the chassis ground by using the EGND terminal on the RabbitCore module. This
will be especially helpful to minimize ESD and/or EMI problems.
User’s Manual37
3.5.5 Programming Port
The RabbitCore module on the OP7200 has a 10-pin programming header. The programming port uses the Rabbit 2000’s Serial Port A for communication. Dynamic C uses the
programming port to download and debug programs.
The programming port is also used for the following operations.
• Cold-boot the Rabbit 2000 on the RabbitCore module after a reset.
• Remotely download and debug a program over an Ethernet connection using the
RabbitLink EG2110.
• Fast copy designated portions of flash memory from one Rabbit-based board (the
master) to another (the slave) using the Rabbit Cloning Board.
Alternate Uses of the Serial Programming Port
All three clocked Serial Port A signals are available as
• a synchronous serial port
• an asynchronous serial port, with the clock line usable as a general CMOS input
The serial programming port may also be used as a serial port via the DIAG connector on
the serial programming cable.
In addition to Serial Port A, the Rabbit 2000 startup-mode (SMODE0, SMODE1), status,
and reset pins are available on the serial programming port.
The two startup mode pins determine what happens after a reset—the Rabbit 2000 is
either cold-booted or the program begins executing at address 0x0000.
The status pin is used by Dynamic C to determine whether a Rabbit microprocessor is
present. The status output has three different programmable functions:
1. It can be driven low on the first op code fetch cycle.
2. It can be driven low during an interrupt acknowledge cycle.
3. It can also serve as a general-purpose CMOS output.
The /RESET_IN pin is an external input that is used to reset the Rabbit 2000 and the
onboard peripheral circuits on the RabbitCore module. The serial programming port can be
used to force a hard reset on the RabbitCore module by asserting the /RESET_IN signal.
The green Power Good LED goes off momentarily during a reset.
Refer to the Rabbit 2000 Microprocessor User’s Manual for more information.
38eDisplay (OP7200)
3.6 Memory
3.6.1 SRAM
The OP7200’s RabbitCore module is designed to accept 128K to 512K of SRAM packaged in an SOIC case. The standard OP7200’s RabbitCore modules come with 128K of
SRAM.
3.6.2 Flash M emory
The OP7200 is also designed to accept 128K to 512K of flash memory. The standard
OP7200’s RabbitCore modules comes with one 256K flash memory.
NOTE: Rabbit recommends that any c ustomer applications sh oul d not be co nst ra ine d by
the sector size of the flash memory since it may be necessary to change the sector size
in the future.
A Flash Memory Bank Select jumper configuration option based on 0 Ω surface-mounted
resistors exists at header JP2 on the RabbitCore module. This option, used in conjunction
with some configuration macros, allows Dynamic C to compile two different co-resident
programs for the upper and lower halves of the 256K program flash in such a way that
both programs start at logical address 0000. This is useful for applications that require a
resident download manager and a separate downloaded program. See Technical Note 218,
Implementing a Serial Download Manager for a 256K Flash, for details.
User’s Manual39
3.7 Liquid Crystal Display Controller
The LCD module controller chip provides support for the LCD module. The controller
chip is attached to the data bus on the OP7200’s RabbitCore module, and is mapped to the
I/O address space. This interface is composed of eight data bits, one address line, and three
control lines (/IORD, /IOWR, and /LCDM-CS).
The interface from the LCD controller to the LCD module is u nidirectional. Data flow from
the controller chip to the LCD module. A number of control lines are provided for this function, but not all of them are used for a particular LCD module. The controller continually
reads the SRAM (which is included on the LCD controller chip used after January,2006)
for data placed there by the microprocessor and refreshes the display periodically.
Other functions support the LCD module to adjust its contrast and to turn the white LED
backlight on and off. A variable resistor between two of the LCD module’s terminals sets
the contrast. U5 is a digitally controlled potentiometer that is controlled by software. Once
the value is set, the value will be maintained. A single programmed I/O bit is used to turn
the LED backlight on or off. Since this bit does not have enough drive current to light the
LED directly, it is buffered by the FET Q1.
The controller chip used in OP7200’s sold before 2006 supported either 32K or 64K of
SRAM. These OP7200s were designed using a dual-footprint SRAM to accept either one
32K or one 128K SRAM. The 128K part was standard. The full 64K supported by the
controller is available with the 128K SRAM, plus an additional 64K can be swapped in
and out by using the programmed I/O bit VA16. Pins 1–2 on header JP9 are normally connected by a 0 Ω surface-mounted resistor, but pins 2–3 should be connected instead for
video SRAM paging with I/O bit VA16.
OP7200 units sold after January , 2006, have a new LCD controller chip because the previously used LCD controller chip is no longer available. The new LCD controller chip has
32K of internal SRAM. Figure 19 shows the area of the OP7200 that changed to accommodate the new LCD controller chip. The new LCD controller is not 100% code-compatible
with the old chip—Section 4.1.2.1 explains how to handle programs developed using
versions of Dynamic C before v. 9.40.
The OP7200 is equipped with a nine-position keypad. The keypad is attached to the front
bezel with an adhesive backing and is connected through J16 to the OP7200 printedcircuit board with a flex cable. Only 7 of the 10 conductors in the cable are used at the
present time. Th e extr a lin es ar e reser v ed f o r an expanded keypad or LED indicators. The
interface to the keypad is through programmed I/O bits composed of four scan rows of
three keys each. Driving a partic ular scan line (/KB–S 0:3) low will read bac k a zero on the
keypad data lines (/PB0:2–K0:2) associated with the three keys on the selected row.
Diodes D16–D19 prevent feedback, allowing the software to read the keypad even when
multiple keys are pressed simultaneously. Resistors R138–R141 and capacitors C79–C81
and C83 form a low-pass filter to prote ct against ESD da mage. These sa me circuits help to
eliminate EMI from being radiated from the keypad or its flex cable. R149, R151–R152,
and C82–C84 perform a similar function for the keypad data lines. The tri-state receiver
chip U13 connects the key data to the microprocessor data bus at the appropriate time
when directed by the control signals /IORD and /PE5-IO-CS1. Note that only the loworder three bits of the data bus are connected. The software must mask off the high 5 bits
since they are undefined.
Figure 20 shows how the keypad is encoded with respect the scan and data lines. For
example, if /KB–S2 is asserted low, then keys D, H, and E are read back on data lines K0,
K1, and K2 respectively . A zero read on the data lines indicates that the key is pressed and
a one indicates that it is not. Ones are always read back on data lines that are not assigned
to any particular key. Once the values read from the keypad remain constant for a length of
time, the read can be assumed to be valid.
ABC
D
E
/KBS0
FG
H
/KBS1
/KBS2
J
Figure 20. OP7200 Keypad Encoding
User’s Manual41
/KBS3
/PB0K0
B
C
D
A
/PB1K1
F
G
H
/PB2K2
J
E
3.9 OP7200 CPLD
All the random logic used to control the OP7200 is contained within a single ComPlex
Logic Device (CPLD). The AMD ATF1500A contains 32 macrocells and is packaged in a
44-pin TQFP. This device contains decoding and a number of I/O bits that can be set to
high or low to control various functions of the OP7200.
The CPLD interfaces to the address and data bus on the RabbitCore module, and is writeonly. Two chip select lines, /PE4 and /PE5, are used to enable the device. /PE4 and /PE5
are configured in software as I/O strobes, and set the base address used by the CPLD. /PE4
is used when selecting one of the sixteen I/O control bits associated with the eight driver
circuits. /PE5 is used with the re mainder of the controls. The control bi ts within the C PLD
normally can be set and reset independently of one another. The SINK and SOURCE outputs are different in that both the SINK and SOURCE outputs for a particular driver cannot be asserted simultaneously. If either the SINK or SOURCE output is asserted, and the
software tries to set the other, the operation is ignored and the bit will not be set. The purpose of this interlock is to prevent damage to the driver circuit by not allowing both current sourcing and sinking to be enabled simultaneously.
1010111SOURCE3 Enable Source Output 3
1010110SOURCE3 Disable Source Output 3
1011001SOURCE4 Enable Source Output 4
1011000SOURCE4 Disable Source Output 4
1011011SOURCE5 Enable Source Output 5
1010010SOURCE5 Disable Source Output 5
1011101SOURCE6 Enable Source Output 6
1011100SOURCE6 Disable Source Output 6
1011111SOURCE7 Enable Source Output 7
1011110SOURCE7 Disable Source Output 7
0100001/KB-S0Assert Keypad Scan Line S0
0100000/KB-S0Deassert Keypad Scan Line S0
0100011/KB-S1Assert Keypad Scan Line S1
0100010/KB-S1Deassert Keypad Scan Line S1
0100101/KB-S2Assert Keypad Scan Line S2
0100100/KB-S2Deassert Keypad Scan Line S2
0100111/KB-S3Assert Keypad Scan Line S3
0100110/KB-S3Deassert Keypad Scan Line S3
0101001BKLT-ON Turn On the LCDM Backlight
0101000BKLT-ON Turn Off the LCDM Backlight
0101011RS485-EN Enable the 485 Transmitter
0101010RS485-EN Disable the 485 Transmitter
0101101ALARMTurn On the Buzzer
0101100ALARMTurn Off the Buzzer
0101111VA1 6Assert the VA16 Address Line/RabbitNet CS
0101110VA1 6Deassert the VA16 Address Line/RabbitNet CS
0110001/CSAssert X9015 Chip Select
0110000/CSDeassert X9015 Chip Select
0110011U_DSet X9015 to Count Up
0110010U_DSet X9015 to Count Down
011010*INCIncrement the X9015 Counter
011011*NAReserved
011100*NAReserved
011101*NAReserved
011110*NAReserved
011111*NAReserved
User’s Manual43
3.10 Programming Cable
The programming cable is used to connect the programming port of the RabbitCore module
to a PC serial COM port. The programming cable converts the RS-232 voltage levels used
by the PC serial port to the TTL voltage levels used by the Rabbit 2000.
When the PROG connector on the programming cable is connected to the RabbitCore
module’ s programming header, programs can be downloaded and debugged over the serial
interface.
The DIAG connector of the programming cable may be used on the programming header of
the RabbitCore module with the module operating in the Run Mode. This allows the programming port to be used as a regular serial port.
3.10.1 Changing Between Program Mode and Run Mode
The OP7200 is automatically in Program Mode when the PROG connector on the programming cable is attached to the RabbitCore module, and is automatically in Run Mode
when no programming cable is attached. When the Rabbit 2000 is reset, the operating
mode is determined by the status of the SMODE pins. When the programming cable’s
PROG connector is attached, the SMODE pins are pulled high, placing the Rabbit 2000 in
the Program Mode. When the programming cable’s PROG connector is not attached, the
SMODE pins are pulled low, causing the Rabbit 2000 to operate in the Run Mode.
Figure 21. OP7200 Program Mode and Run Mode Set-Up
A program can be run in either mode, but can only be downloaded and debugged when the
OP7200 is in the Program Mode.
Refer to the Rabbit 2000 Microprocessor User’s Manual for more information on the pro-
gramming port and the programming cable.
44eDisplay (OP7200)
3.11 Other Hardware
3.11.1 Spectrum Spreader
OP7200 operator control panels that carry the CE mark on their RabbitCore module have
a Rabbit 2000 microprocessor that features a spectrum spreader, which helps to mitigate
EMI problems. By default, the spectrum spreader is on automatically for OP7200 operator
control panels that carry the CE mark when used with Dynamic C 7.30 or later versions,
but the spectrum spreader may also be turned off or set to a stronger setting. The means for
doing so is through a simple global macro as shown below.
1. Select the “Defines” tab from the Dynamic C Options > Project Options menu.
2. Normal spreading is the default, and usually no entry is needed. If you need to specify
normal spreading, add the line
ENABLE_SPREADER=1
For strong spreading, add the line
ENABLE_SPREADER=2
To disable the spectrum spreader, add the line
ENABLE_SPREADER=0
NOTE: The strong spectrum-spreading setting is not needed for the OP7200.
3. Click OK to save the macro. The spectrum spreader will now remain of f whenever you
are in the project file where you defined the macro.
There is no spectrum spreader functionality for OP7200 operator control panels that do
not carry the CE mark on their RabbitCore module or when using any OP7200 with a version of Dynamic C prior to 7.30.
User’s Manual45
46eDisplay (OP7200)
4. SOFTWARE
Dynamic C is an integrated development system for writing
embedded software. It runs on an IBM-compatible PC and is
designed for use with sing le-board computers and other devices
based on the Rabbit microprocessor.
Chapter 4 provides the libraries, function calls, and sample programs related to the OP7200.
4.1 Running Dynamic C
You have a choice of doing your software development in the flash memory or in the static
RAM included on the OP7200. The flash memory and SRAM options are selected with
the Options > Compiler menu.
The advantage of working in RAM is to save wear on the flash memory, which is limited
to about 100,000 write cycles. The disadvantage is that the code and data might not both
fit in RAM.
NOTE: An application can be developed in RAM, but can not run sta nda lone from RAM
after the programming ca ble is disconn ected. S tandalone ap plications can on ly run from
flash memory.
NOTE: Do not depend on the flash memory sector size or type. Due to the volatility of
the flash memory market, the OP7200 and Dynamic C were designed to accommodate
flash devices with various sector sizes.
OP7200s that are special-ordered with 512K flash/512K SRAM memory options have two
256K flash memories. By default, Dynamic C will use onl y the first flash memory for program code in these OP7200s. Uncomment the USE_2NDFLASH_CODE macro within the
RABBITBIOS.C file in the Dynamic C BIOS folder to allow the second flash memory to
hold any program code that is in excess of the available memory in the first flash.
User’s Manual47
Developing software with Dynamic C is simple. Users can write, compile, and test C and
assembly code without leaving the Dynamic C development environment. Debugging
occurs while the application runs on the target. Alternatively, users can compile a program
to an image file for later loading. Dynamic C runs on PCs under W indows 98 or later. Programs can be downloaded at baud rates of up to 460,800 bps after the program compiles.
Dynamic C has a number of standard features.
• Full-feature source and/or assembly-level debugger, no in-circuit emulator required.
• Royalty-free TCP/IP stack with source code and most common protocols.
• Hundreds of functions in source-code libraries and sample programs:
X Exceptionally fast support for floating-point arithmetic and transcendental functions.
X RS-232 and RS-485 serial communication.
X Analog and digital I/O drivers.
X I2C, SPI, GPS, file system.
X LCD display and keypad drivers.
• Powerful language extensions for cooperative or preemptive multitasking
• Loader utility program to load binary images into Rabbit targets in the absence of
Dynamic C.
• Provision for customers to create their own source code libraries and augment on-line
help by creating “function description” block comments using a special format for
library functions.
• Standard debugging features:
X Breakpoints—Set breakpoints that can disable interrupts.
X Single-stepping—Step into or over functions at a source or machine code level, µC/OS-II aware.
X Code disassembly—The disassembly window displays addresses, opcodes, mnemonics, and
machine cycle times. Switch between debugging at machine-code level and source-code level by
simply opening or closing the disassembly window.
X Watch expressions—Watch expressions are compiled when defined, so complex expressions
including function calls may be placed into watch expressions. Watch expressions can be updated
with or without stopping program execution.
X Register window—Al l processor regi sters and fla gs are disp layed. The conten ts of general r egisters
may be modified in the window by the user.
X Stack window—shows the contents of the top of the stack.
X Hex memory dump—displays the contents of memory at any address.
X STDIO window—printf outputs to this window and keyboard input on the host PC can be
detected for debugging purposes.
printf output may also be sent to a serial port or file.
48eDisplay (OP7200)
4.1.1 Upgrading Dynamic C
4.1.1.1 Patches and Bug Fixes
Dynamic C patches that focus on bug fixes are available from time to time. C heck the Web
site www.rabbit.com/support/for the latest patches, workarounds, and bug fixes.
The default installation of a patch or bug fix is to install the file in a directory (folder) different from that of the original Dynamic C installation. Rabbit recommends using a different directory so that you can verify the operation of the patch without overwriting the
existing Dynamic C installation. If you have made any changes to the BIOS or to libraries,
or if you have programs in the old directory (folder), make these same changes to the
BIOS or libraries in the new directory containing the patch. Do not simply copy over an
entire file since you may overwrite a bug fix; of course, you may copy over any programs
you have written. Once you are sure the new patch works entirely to your satisfaction, you
may retire the existing installation, but keep it available to handle legacy applications.
4.1.1.2 Upgrades
Dynamic C installations are designed for use with the board they are included with, and
are included at no charge as part of our low-cost kits. Dynamic C is a complete software
development system, but does not include all the Dynamic C features. Rabbit also offers
add-on Dynamic C modules containing the popular µC/OS-II real-time operating system,
as well as PPP, Advanced Encryption Standard (AES), and other select libraries. In addition to the Web-based technical support included at no extra charge, a one-year telephonebased technical support module is also available for purchase.
NOTE: Dynamic C RabbitSys cannot be used with the OP7200.
User’s Manual49
4.1.2 Accessing and Downloading Dynamic C Libraries
The libraries needed to run the OP7200 are available on the CD included with the Development Kit. Upgrades may be downloaded from www.rabbit.com/support/downloads/ on
our Web site. You may need to download upgraded or additional libraries to run selected
RabbitNet peripheral boards or to use an OP7200 purchased after January, 2006, with a
Dynamic C release prior to v. 9.40.
When downloading the libraries from the Web site, click on the product-specific links
until you reach the links for the OP7200 download you require. You will be able to either
run the download directly from the Web site, or you may choose to save it to run later.
Once you run the download, InstallShield will install the additional or upgraded software.
A readme file associated with the installation will then guide you to add to, replace, or edit
Dynamic C libraries or sample programs.
You will be able to use the revamped Dynamic C installation with the OP7200 and you
will continue to be able to use this upgraded installation with all the other Rabbit products
you were able to use before.
4.1.2.1 New LCD Controller Chip
OP7200 units sold after January, 2006, have a new LCD controller chip because the previously used LCD controller chip is no longer available. The new LCD controller is not
100% code-compatible with the old chip, and therefore changes were made to the LCD
drivers. The updated drivers for the OP7200 are included in Dynamic C v. 9.40 and later,
and are backward-compatible for use with the old LCD controller chip.
If you are using a program developed with an earlier version of Dynamic C, you will need
to replace the existing Dynamic C SED1335F.LIB library in your Dynamic C installation in the LIB\DISPLAYS\GRAPHIC\320x240 folder. Once you have the new
SED1335F.LIB library, you will have to recompile your program.
The new SED1335F.LIB library is available for download from our Web site at
www.rabbit.com/support/downloads/downloads_prod.shtml, and has been tested for
compatibility with Dynamic C versions 7.33 and later.
The changes to the SED1335F.LIB library will improve the OP7200 screen update time
by a factor of four. Otherwise, the form, fit, and function of the OP7200 are not affected
by the changes.
50eDisplay (OP7200)
4.2 Font and Bitmap Converter
The Font and Bitmap Converter is a utility included with Dynamic C to convert Windows
fonts and monochrome bitmaps to a library file format compatible with Dynamic C applications and Rabbit’s graphic displays. These library files may be added to applications
with the statement #use LIBRARYFILENAME.LIB or by cutting and pasting from the
library file directly into the application. Remember to enter LIBRARYFILENAME.LIB into
LIB.DIR, which is located in the Dynamic C directory if you #use LIBRARYFILE-
NAME.LIB
To start the Font and Bitmap Converter, use the Windows Start > Run menu or Windows
Explorer to launch fbmcnvtr.exe from the root folder where Dynamic C is installed.
Click on Help in the Font and Bitmap Converter utility to get complete use information
about the utility.
.
User’s Manual51
4.3 Sample Programs
Sample programs are provided in the Dynamic C SAMPLES folder. The sample program
PONG.C demonstrates the output to the STDIO window. The various directories in the
SAMPLES folder contain specific sample programs that illustrate the use of the correspond-
ing Dynamic C libraries.
The SAMPLES\OP7200 folder provides sample programs specific to the OP7200. Each
sample program has comments that describe the purpose and function of the program. Follow the instructions at the beginning of the sample program.
To run a sample program, open it wit h the File menu (if it is not still open), then compile
and run it by pressing F9 or by selectin g Run in the Run menu. The OP7200 must be in Program mode (see Section 3.10) and must be connected to a PC using the programming
cable as described in Section 2.3.
More complete information on Dynamic C is provided in the Dynamic C User’s Manual.
4.3.1 General OP7200 Sample Programs
The following sample programs are found in the SAMPLES\OP7200 directory.
• BOARD_ID.C—Detects the model of the board you are using and displays the information in the
STDIO window.
• FUN.C—Demonstrates the features of the OP7200. A variable customer-supplied 0–10 V
DC power supply is recommended to demonstrate the analog input section.
4.3.2 Digital I/O
The following sample programs are found in the IO subdirectory in SAMPLES\OP7200.
• BUZZER.C—Demonstrates the use of the OP7200 buzzer.
• DIGIN.C—Demonstrates the use of the digital inputs. Using the Demonstration Board,
you can see an input channel toggle from HIGH to LOW when pressing a pushbutton
on the Demonstration Board.
• DIGOUT.C—Demonstrates the use of the high-current outputs configured as either
sinking or sourcing outputs. Using the Demonstration Board, you can see an LED
toggle on/off via a high-current output.
• LED.C—Toggles the LEDs on the OP7200.
• PWM.C—Demonstrates the use of Timer B to generate a 42 Hz PWM signal on digital
output OUT0. The PWM duty cycle may be adjusted from 1 to 99%. Connect +K to
+PWR (pins 1 and 3 on screw-terminal header J3) to run this sample program.
• TRISTATE.C—Demonstrates the use of the high-current outputs configured as sinking, sourcing, or tristate outputs. Using the Demonstration Board, you can see a bank of
channels toggle the corresponding LEDs on/off via the high-current outputs.
52eDisplay (OP7200)
4.3.3 Serial Communication
The following sample programs are found in the RS232 subdirectory in SAMPLES\OP7200.
• PUTS.C—This program transmits and then
receives an ASCII string on Serial Ports C and
D. The serial data received are displayed in the
STDIO window.
J10
IN12
IN13
IN14
IN15
/RST
TXC
RXC
TXD/RTS
485
RXD/CTS
+485
GND
To set up the OP7200, you will need to tie
TxC and RxD together on the screw-terminal
header at J10, and you will also tie TxD and
RxC together as shown in the diagram.
• RELAYCHR.C—This program echoes characters to or from a serial utility such as HyperTerminal or Tera Term.
J10
IN12
IN13
IN14
IN15
/RST
TXC
RXC
TXD/RTS
485
RXD/CTS
+485
GND
To set up the OP7200, you will need to tie
TxC and RxD together on the screw-terminal
header at J10.
Then connect your PC COM port to screw-terminal
header J10 as follows.
GND
DTR
Tx (out)
Rx (in)
76
CTS
DCD
RTS
DSR
X PC Tx to RxC on J10
X PC Rx to TxD on J10
X PC GND to GND on J10
COM
54321
9
8
RING
Set up HyperTerminal or Tera Term as follows: 19200 bps, 8 data bits, no parity , 1 stop
bit, and no flow control. Here are a few additional settings if you are using Tera Term.
X Disable Local Echo in th e Terminal setup
X Enable the receive and line feed options (CR + LF) under New line in th e Terminal setup
Now when you type characters in the HyperTerminal or Tera Term window, they will
appear in the window because they are being echoed back by the sample program.
Two sample programs, MASTER.C and SLAVE.C, are available in the RS485 subdirectory
in SAMPLES\OP7200 to illustrate RS-485 master/slave communication. To run these
sample programs, you will need a second Rabbit-based system with RS-485—another
Rabbit single-board computer or OP7200 may be used as long as you use the master or
slave sample program associated with that board.
The RS-485 connections between the slave and master devices are as follows.
• RS485+ to RS485+
•RS485– to RS 485–
•GND to GND
User’s Manual53
• MASTER.C—This program demonstrates a simple RS-485 transmission of lower case
letters to a slave. The slave will send back converted upper case letters back to the
master OP7200 and display them in the STDIO window. Use SLAVE.C to program the
slave.
• SLAVE.C—This program demonstrates a simple RS-485 transmission of lower case
letters to a master OP7200. The slave will send back converted upper case letters back
to the master OP7200 and display them in the STDIO window. Use MASTER.C to program the master OP7200.
4.3.4 A/D Converter Inputs
The following sample programs are found in the ADC subdirectory in SAMPLES\OP7200.
• ADCAL_DIFF_2V.C—Demonstrates how to recalibrate an A/D input channel being
used for a differential input with the input attenuator tied to the 2 V reference voltage.
• ADCAL_DIFF_GND.C—Demonstrates how to recalibrate an A/D input channel being
used for a differential input with the input attenuator tied to analog ground.
• ADCAL_MA_CH.C—Demonstrates how to recalibrate an A/D input channel being used to
convert analog current measurements to generate the calibr ation constants for that channel.
• ADCAL_SE_ALL.C—Demonstrates how to recalibrate all single-ended A/D input channels for a given gain.
• ADCAL_SE_CH.C—Demonstrates how to recalibrate one single-ended A/D input channels to generate the calibration constants for that channel.
NOTE: The above sample programs will overwrite the calib ration constants set at the factory.
• ADRD_DIFF_2V.C—Demonstrates how to read an A/D input channel being used for a
differential input with the input attenuator tied to the 2 V reference voltage.
• ADRD_DIFF_GND.C—Demonstrates how to read an A/D input channel being used for
a differential input with the input attenuator tied to analog ground.
• ADRD_MA_CH.C—Demonstrates how to read an A/D input channel being used to convert analog current measurements using previously defined calibration constants for
that channel.
• ADRD_SE_ALL.C—Demonstrates how to read all single-ended A/D input channels
using previously defined calibration constants.
• ADRD_SE_CH.C—Demonstrates how to read one single-ended A/D input channels
using previously defined calibration constants.
54eDisplay (OP7200)
4.3.5 Graphic Display
The following sample program is found in the LCD_BASIC subdirectory in
SAMPLES\OP7200.
• BUFFLOCK.C—Demonstrates how to improve LCD performance by using the
glBuffLock and glBuffUnlock functions.
• CONTRAST.C—Demonstrates how to adjust the contrast on the LCD.
• PRIMITIVES.C—Demonstrates the primitive graphic functions to draw lines, circles,
polygons, and bitmaps.
• SCROLLING.C—Demonstrates the scrolling features of the GRAPHIC.LIB library.
• TEXT.C—Demonstrates the text features of the GRAPHIC.LIB library.
4.3.6 Keypad
The following sample programs are found in the LCD_KEYPAD subdirectory in
SAMPLES\OP7200.
• KP_16KEY.C—Demonstrates using 9-key keypad instead of touchscreen to control vir-
tual keypad.
• KP_ANALOG.C—Demonstrates using 9-key keypad instead of touchscreen to control
virtual keypad.
• KP_BASIC.C—Demonstrates the keypad functions.
• KP_MENU.C—Demonstrates how to implement a menu system using the GLMENU.LIB
library.
4.3.7 Touchscreen (OP7200 only)
The following sample program is found in the LCD_TOUCHSCREEN subdirectory in
SAMPLES\OP7200.
• BTN_16KEY.C—Demonstrates the use of a virtual keypad for data entry.
• BTN_BASICS.C—Demonstrates the basic functionality of the touchscreen buttons.
• BTN_KEYBOARD.C—Demonstrates the use of a virtual keypad for data entry.
• CAL_TOUCHSCREEN.C—Demonstrates how to recalibrate the touchscreen coordinates.
• RD_TOUCHSCREEN.C—Demonstrates how to read the touchscreen in debounced or
real-time modes.
• TSCUST16KEY.LIB—Sample library demonstrating how to make custom keysets
using GLTOUCHSCREEN.LIB.
• TSCUSTKEYBOARD.LIB—Sample library demonstrating how to make custom keysets
using GLTOUCHSCREEN.LIB functions.
User’s Manual55
4.3.8 Using System Information from the RabbitCore Module
Calibration constants for the A/D converter are stored in the simulated EEPROM area of
the flash memory. You may find it useful to retrieve the calibration constants and save
them for future use, for example, if you should need to replace the RabbitCore module on
the OP7200.
The following sample programs, found in the Calib_Save_Retrieve subdirectory in
SAMPLES\OP7200, illustrate how to save or retrieve the calibration constants. Note that
both sample programs prompt you to use a serial number for the OP7200. This serial number can be any 5-digit number of your choice, and will be unique to a particular OP7200.
Do not use the MAC address on the bar code label of the RabbitCore module attached to
the OP7200 since you may at some later time use that particular RabbitCore module on
another OP7200, and the previously saved calibration data would no longer apply.
• SAVECALIB.C—This program demonstrates how to save your analog calibration coefficients using a serial port and a PC serial utility such as Tera Term.
NOTE: Use the sample program GETCALIB.C to retrieve the data and rewrite it to the
single-board computer.
• GETCALIB.C—This program demonstrates how to retrieve your analog calibration
data to rewrite it back to the simulated EEPROM in flash with using a serial ut ility such
as Tera Term.
NOTE: Calibration data must be saved previously in a file by the sample program
SAVECALIB.C.
NOTE: In addition to loading the calibration constants on the replacement RabbitCore
module, you will also have to add the product information for the OP7200 to the ID
block associated with the RabbitCore module. The sample program WRITE_IDBLOCK.C, available on the our Web site at www.rabbit.com/support/feature_
downloads.shtml, provides specific instructions and an example.
T wo sample programs are available to show how to get information on ID and user blocks,
and how to clear the contents in the user block. These sample programs are in the
Dynamic C SAMPLES\USERBLOCK folder.
• USERBLOCK_INFO.C—This program repor ts on the size and capabilities of the ID a nd
user blocks. It will report the version of the ID block, the size of the ID and user blocks,
the size of the user blocks reserved for calibration constants, whether the ID or user
blocks are mirrored, and the total amount of flash memory used by the ID and user
blocks.
• USERBLOCK_CLEAR.C—This program clears the contents of the user block. Note that
it does not clear the calibration constants or the system ID block.
When you run this sample program in the Program Mode, there is a 300 ms timer delay
after each writeUserBlock() call to allow Dynamic C and the OP7200 to exchange
a debug packet in order to inform the debug kernel that the OP7200 is still “alive.” The
timer delay is not necessary in the Run Mode with nodebug or when single-stepping.
56eDisplay (OP7200)
4.4 OP7200 Libraries
The following library folders contain the libraries whose function calls are used to develop
applications for the OP7200.
• OP7200—libraries associated with features specific to the OP7200. The functions in
the OP72xx.LIB library are described in Section 4.5, “OP7200 Function APIs.”.
• DISPLAYS—libraries associated with the LCD display. The GLMENU.LIB library pro-
vides function calls to display menus on the OP7200 LCD display.
• KEYPADS—libraries associated with the keypad. The KEYPAD9.LIB library provides
function calls to keypad menus for the OP7200 keypad.
• TOUCHSCREENS—libraries associated with the touchscreen. The GLTOUCHSCREEN.LIB
library allows you to link adjacent pixel locations on the LCD to create a button. The
button can then be translated by the touchscreen when pressed. The TS_R4096.LIB
library in the TouchScreens directory provides low-level touchscreen function calls.
• RABBITNET—libraries associated with the RabbitNet network. The RN_CFG_
OP72.LIB
peripheral cards. The function calls in the
bitNet network, and are described in Appendix D. Each RabbitNet I/O ca rd also has its
own library in this folder, and these function calls are described in the user’ s manual for
each I/O card.
library is used to configure the OP7200 for use as a master with RabbitNet
RNET.LIB library are used to set up the Rab-
Call the libraries you intend to use in the following order.
#use "OP72xx.LIB"
#use "GLMENU.LIB"
#use "KEYPAD9.LIB"
#use "RN_CFG_OP72.LIB"
#use "NET.LIB"
Finally, call the library or libraries associated with the RabbitNet I/O card(s) in your
RabbitNet system, for example, #use "RNET_DIO.LIB" for the RabbitNet digital I/O
card
Other generic functions applicable to all devices based on the Rabbit 2000 microprocessor
are described in the Dynamic C Function Reference Manual.
User’s Manual57
4.5 OP7200 Function APIs
4.5.1 Board Initialization
void brdInit (void);
Call this function at the beginning of your program. This function initializes the system I/O ports and
loads all the A/D converter calibration constants from flash memory into SRAM for use by your program. This function will turn off LED DS1 (Microprocessor Bad) to indicate that the initialization was
successful.
The ports are initialized according to Table A-3.
58eDisplay (OP7200)
4.5.2 Digital I/O
void digOutConfig(char outputMode);
This functions is used to config ure the hi g h-cu rrent ou tput s as either a si nk i ng or a sour cing t ype ou tput .
Note that
PARAMETERS
outputMode is an 8-bit parameter where each bit corresponds to a high-current output:
To set the outputs, set the corresponding bit to one of the following states:
EXAMPLE
brdInit must be executed before calling this function.
Bit 7 = OUT7
Bit 6 = OUT6
Bit 5 = OUT5
Bit 4 = OUT4
Bit 3 = OUT3
Bit 2 = OUT2
Bit 1 = OUT1
Bit 0 = OUT0
0 = Sinking ty pe circuit
1 = Sourcing t ype circuit
digOutConfig(0x81);
// OUT0 and OUT7 are sourcing, OUT1–OUNT6 are sinking
Sets the state of a digital output (OUT0–OUT7).
The output channel is set to the state that is specified. If the output is configured as sinking, set to 0 for
the driver to be sinking, or set to 1 for the driver to be OFF (high-impedance state). If the output is configured as sourcing, set to 0 for the driver to be OFF (high-impedance state), or set to 1 for the driver to
be sourcing .
Remember to call brdInit and digOutConfig before executing this function.
A runtime error will occur for the following conditions:
1. channel or state out of rang e.
2. brdInit or digOutConfig was not executed before executing digOut.
3. Your tried to use a channel configured as a tri-state output.
PARAMETERS
channel is the output channel number (0–7).
state is the output value (0 or 1).
Reads the state of an input channel (IN0–IN18 for OP7200, IN0–IN15 for OP7210).
A run-time error will occur for the following conditions:
1. channel out of range.
2. brdInit was not executed before executing digIn.
PARAMETER
channel is the input channel number (0–18 or 0–15)
RETURN VALUE
The logic state of the input (0 or 1).
SEE ALSO
brdInit, digOut
User’s Manual61
4.5.3 LEDs
void ledOut(int led, int value)
Turns LED DS1 (Microprocessor Bad) on or off.
NOTE: Once the brdInit function executes, then the Microprocessor Bad indicator is
available for other use in the application.
PARAMETERS
led is the LED to control
0 = LED DS1 (Microproce ssor Bad indicator)
value is used to control whether the LED is on or off
0 = OFF
1 = ON
SEE ALSO
brdInit
62eDisplay (OP7200)
4.5.4 Serial Communication
Library files included with Dynamic C provide a full range of serial communication support. The RS232.LIB library provides a set of circular-buffer-based serial functions. The
PACKET.LIB library provides packet-based serial functions where packets can be delim-
ited by the 9th bit, by transmission gaps, or with user-defined special characters. Both
libraries provide blocking functions, which do not return until they are finished transmitting or receiving, and nonblocking functions, which must be called repeatedly until they
are finished. For more information, see the Dynamic C Function Reference Manual and
Technical Note 213, Rabbit 2000 Serial Port Software.
If you are planning to use any of the RS-232 serial ports and the RabbitNet port on the
OP7200, initialize the serial port(s) before you initialize the RabbitNet port. The following sample code illustrates this sequence.
// Initialize Serial Port C, set baud rate to 19200
serCopen(19200);
serCwrFlush();
serCrdFlush();
// Initialize Serial Port D, set baud rate to 19200
serDopen(19200);
serDwrFlush();
serDrdFlush();
// Set serial mode...must be done after serXopen function(s)
and before Rabbitnet initialization
serMode(0);
// Initialize RabbitNet port
rn_init(RN_PORTS, 1);
Use the following function calls with the OP7200. Note that Serial Port B is used for both
RS-485 and the RabbitNet port, so that RS-485 is no longer available once you have configured Serial Port B as a RabbitNet port.
User’s Manual63
int serMode(int mode);
User interface to set up OP7200 serial communication lines. Call this function after serXOpen().
Whether you are opening one or multiple serial po rts, this function must be executed after execut ing the last
serXOpen function AND before you start using any of the serial ports. This funct ion is non -reentrant.
If Mode 1 or Mode 3 is selected, CTS/RTS flow control is exercised using the serCflowcontrolOn
serCflowcontrolOff functions from the RS232.LIB library.
*Use modes 2 and 3 when Serial Port B is going to used by ot her libr aries
RETURN VALUE
0 if valid mode, 1 if not.
SEE ALSO
ser485Tx, ser485Rx
2
3
such as PACKET.LIB.
not initialized
not initialized
void ser485Tx(void);
Enables the RS-485 transmitter. Transmitted data get echo'ed back into the receive data buffer. These
echo'ed data could be used to know when to disable the transmitter by using one of the following
methods:
Byte mode—disable the transmitter after the same byte that is transmitted is detected in the receive
data buffer.
Block data mode—disable the transmitter after the same number of bytes transmitted is detected in the
receive data buffer.
serMode() must be executed before running this function.
SEE ALSO
serMode, ser485Rx
void ser485Rx(void);
Disables the RS-485 transmitter. This puts the OP7200 in listen mode, which allows it to receive data
from the RS-485 interface.
SEE ALSO
serMode, ser485Tx
64eDisplay (OP7200)
serMode() must be exec uted before running this function.
4.5.5 A/D Converter Inputs (OP7200 only)
unsigned int anaIn(int channel, int opmode,
int gaincode);
Reads the state of an analog input channel.
PARAMETERS
channel is the analog input channel number (0 to 7) corresponding to AIN0–AIN7:
int gaincode, int value1, float volts1,
int value2, float volts2);
Calibrates the response of the A/D converter channel as a linear function using the two conversi on poi nts
provided. Four values are calculated and placed into global table
using the function
a linear constant,
a voltage offs et,
a calculation gain code used to calculate calibrations, and
a user gain code to set voltage range (defaults to the calculation gain code).
PARAMETERS
anaInEEWr(). Each channel will have the following information:
channel is the analog input channel number (0 to 7) corresponding to AIN0–AIN7:
0 = SE_MODE—single-ended input line
1 = DIFF_MODE—dif fe r e ntial inpu t li ne
2 = mAMP_MODE—4–20 mA input line
gaincode is the gain code of 0 to 7 for both single-ended and differential measurements:
Gain CodeMacroGain
0
1
2
3
4
5
6
7
GAIN_X1
GAIN_X2
GAIN_X4
GAIN_X5
GAIN_X8
GAIN_X10
GAIN_X16
GAIN_X20
×1
×2
×4
×5
×8
×10
×16
×20
66eDisplay (OP7200)
value1 is the first A/D converter channel value (0–2047).
volts1 is the voltage or current corresponding to the first A/D converter channel value.
value2 is the second A/D converter channel value (0–2047).
volts2 is the voltage or current corresponding to the first A/D converter channel value.
Reads the state of an analog input channel and uses the previously set calibration constants to convert it
to current.
PARAMETER
channel is 0–7:
Channel
0AIN0
1AIN1
2AIN2
3AIN3
4AIN4
5AIN5
6AIN6
7AIN7
RETURN VALUE
A current value between 4–20 mA (0.004 and 0.020 A) corresponding to the current on the analog input
channel.
SEE ALSO
brdInit, anaInCalib, anaIn, anaInVolts, anaInDiff
4–20 mA
Input Lines
70eDisplay (OP7200)
int anaInEERd(unsigned int channel, int opmode,
unsigned int gaincode);
Reads the calibration constants, gain, and offset for an input based on its designated channel code
position into global table
block memory area. Use the sam ple prog ram
the addresses reserved for the calibration data constants and the addresses available for use by you r
program.
NOTE: This function cannot be run in RAM.
PARAMETERS
channel is the analog input channel number (0 to 7) corresponding to AIN0–AIN7:
_adcCalib. The constants are stored in the top 1K of the reserved user
0 = SE_MODE—single-ended input line
1 = DIFF_MODE—differential input line
2 = mAMP_MODE—4–20 mA input line
gaincode is the gain code of 0 to 7 for both single-ended and differential measurements:
Gain CodeMacroGain
0
1
2
3
4
5
6
7
GAIN_X1
GAIN_X2
GAIN_X4
GAIN_X5
GAIN_X8
GAIN_X10
GAIN_X16
GAIN_X20
×1
×2
×4
×5
×8
×10
×16
×20
User’s Manual71
RETURN VALUE
0 if successful.
-1 if address is invalid or out of range.
SEE ALSO
anaInEEWr, anaInCalib, brdInit
72eDisplay (OP7200)
int anaInEEWr(unsigned int channel, int opmode,
unsigned int gaincode);
Writes the calibration constants, gain, and offset for an input based on its designated channel code
position fr om global tab le
block memory area. Use the sam ple prog ram
the addresses reserved for the calibration data constants and the addresses available for use by you r
program.
NOTE: This function cannot be run in RAM.
channel is the analog input channel number (0 to 7) corresponding to AIN0–AIN7:
_adcCalib. The constants are stored in the top 1K of the reserved user
0 = SE_MODE—single-ended input line
1 = DIFF_MODE—differential input line
2 = mAMP_MODE—4–20 mA input line
gaincode is the gain code of 0 to 7 for both single-ended and differential measurements:
Gain CodeMacroGain
0
1
2
3
4
5
6
7
GAIN_X1
GAIN_X2
GAIN_X4
GAIN_X5
GAIN_X8
GAIN_X10
GAIN_X16
GAIN_X20
×1
×2
×4
×5
×8
×10
×16
×20
User’s Manual73
RETURN VALUE
0 if successful.
-1 if address is invalid or out of range.
SEE ALSO
anaInEERd, brdInit
74eDisplay (OP7200)
4.5.6 Graphic Display Functions
4.5.6.1 On-Screen Menus
The GLMENU.LIB library in the LIB\DISPLAYS\GRAPHIC directory provides function
calls to display menus on the OP7200 LCD display. When x and y coordinates on the
display screen are specified, x can range from 0 to 319, and y can range from 0 to 239.
These numbers represent pixels counted from the top left corner of the display.
int glMenuInit(windowMenu *menu, fontInfo *pFont,
int border, int shadow, char **menu_options,
char* title, maxOptDisplayed);
Initializes a menu structure with the required parameters to automatically build and display a text menu
when the
PARAMETERS
menu is a pointer to the windowMenu descriptor
pFont is a pointer to the fontInfo descriptor
border describes the menu border options:
glMenu function is executed.
0 = NO_BORDER, no border drawn
1 = SINGLE_LINE, draw a single-line border around the text menu
2 = DOUBLE_LINE, draw a double-line border around the text menu
shadow describes the menu shadow options:
0 = NO_SHADOW, no shadowing provided
1 = SHADOWING, shadow ing is p rovided on the menu
menu_options is a pointer to the list of menu options—here is an example of a list of options for the
menu system:
// Menu options........set as needed for your application
const char *main_menu [] =
{
"1.Increase Menu size",
"2.Decrease Menu size",
"3.Backlight menu",
""
};
It is possible to insert or delete menu options. The highlight bar is set up to start with the first menu
option and stop at the last menu option in the menu.
When adding or deleting menu options you mus t match up the case st at ements to the menu opt ion number.
title is the menu title
ASCII string = title
null string = no title
maxOptDisplayed indicates the maximum number of options to be displayed by the menu:
-1 = forces all options to be displayed
>0 = menu box will only display the number of options indicated, which will require the user to use
the scroll keys to bring an option into the menu box view area for the selection
User’s Manual75
RETURN VALUE
0 = success
-1 = border parameter value is invalid
SEE ALSO
glMenu, glMenuClear, glRefreshMenu
int glMenu(windowMenu *mPtr, int *state, int x,
int y);
Displays a menu on the LCD display and get the menu options from the user.
NOTE: This function will display an error message on the LCD if the menu width or
height exceeds the LCD display boundaries.
PARAMETERS
mPtr is a pointer to structure that contains the information for the menu
state is a pointer to the menu control parameter. The state parameters are as follows:
0 = MENU_INIT, initialize and display menu
1 = MENU_NO_CHANGE, return to selected option, no changes to menu or highlight bar.
2 = MENU_REFRESH, display the last image of the menu, including the location of the highlight
bar.
x is the x coordinate of where the text menu is to start
y is the y coordinate of where the text menu is to start
RETURN VALUE
0 = no option is selected
>0 = option the user has selected
-1 = menu has exceeded LCD screen width
-2 = menu has exceeded LCD screen height
SEE ALSO
glMenuInit, glMenuClear, glRefreshMenu
void glRefreshMenu(windowMenu *mPtr);
Refreshes the menu indicated by the WindowMenu pointer.
PARAMETER
mPtr is a windowMenu descri pt or pointer
RETURN VALUE
None.
SEE ALSO
glMenuInit, glMenu, glMenuClear
76eDisplay (OP7200)
glMenuClear(windowMenu *mPtr);
Clears the menu indicated by the WindowMenu descriptor pointer.
PARAMETER
mPtr is a windowMenu descriptor pointer
RETURN VALUE
None.
SEE ALSO
glRefreshMenu, glMenu, glMenuInit
User’s Manual77
4.5.6.2 Graphic Drawing Routines
The GRAPHIC.LIB library in the DISPLAYS\GRAPHIC directory provides function calls
for primitive graphic drawing routines such as lines, circles, and polygons.
void glInit(void);
Initializes the display devices, clears the screen. This function call must be made prior to any other
graphic function calls.
Increments LCD screen-locking counter. Graphics calls are recor ded in th e LCD memory buffer , an d ar e
not transferred to the LCD if the counter is non-zero.
NOTE: Functions glBuffLock() and glBuffUnlock() can be nes ted up to a level
of 255, but be sure to balance the calls. It is not a requirement to use these procedures,
but a set of glBuffLock() and glBuffUnlock() bracketing a set of related
graphics calls significantly speeds up the rendering.
SEE ALSO
glBuffUnlock, glSwap
void glBuffUnlock(void);
Decrements LCD screen-locking counter. The contents of the LCD buffer are transferred to the LCD if
the counter goes to zero.
SEE ALSO
glBuffLock, glSwap
void glSwap(void);
Checks the LCD screen-locking counter. The contents of the LCD buffer are transferred to the LCD if the
counter is zero.
Sets the drawing method (or color) of pixels drawn by subsequent graphics calls.
PARAMETER
type is the value can be one of the following macros:
PIXBLACK draws black pixels
PIXWHITE draws white pixels
PIXXOR draws old pixel XOR'ed with the new pixel
SEE ALSO
glGetBrushType
User’s Manual79
void glGetBrushType(void);
Gets the current method (or color) of pixels drawn by subsequent graphics calls.
RETURN VALUE
The current brush type.
SEE ALSO
glSetBrushType
void glPlotDot(int x, int y);
Draws a single pixel in the LCD buffer, and on the LCD if the buffer is unlocked.
If the coordinates are outside the LCD display area, the dot will not be plotted.
PARAMETERS
x is the x coordinate of the dot
y is the y coordinate of the dot
SEE ALSO
glPlotline, glPlotPolygon, glPlotCircle
void glPlotLine(int x0, int y0, int x1, int y1);
Draws a line in the LCD buffer, and on the LCD if the buffer is unlocked.
Any portion of the line that is beyond the LCD display area will be clipped.
PARAMETERS
x0 is the x coordinate of one endpoint of the line
y0 is the y coordinate of one endpoint of the line
x1 is the x coordinate of the other endpoint of the line
y1 is the y coordinate of the other endpoint of the line
SEE ALSO
glPlotDot, glPlotPolygon, glPlotCircle
80eDisplay (OP7200)
void glBlock(int x, int y, int bmWidth, int
bmHeight);
Draws a rectangular block in the page buffer, and on the LCD if the buffer is unlocked.
Any portion of the block that is outside the LCD display area will be clipped.
PARAMETER
x is the x coordinate of the upper left corner of the block
y is the y coordinate of the left top corner of the block
bmWidth is the width of the block
bmHeight is the height of the block
Plots the outline of a polygon in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the polygon that is outside the LCD display area will be clipped. The function will also
return, doing nothing, if there are less than 3 vertices.
PARAMETERS
n is the number of vertices
x1 is the x coordinate of the first vertex
y1 is the y coordinate of the first vertex
x2 is the x coordinate of the second vertex
y2 is the y coordinate of the second vertex
... coordinates of additional vertices
SEE ALSO
glPlotVPolygon, glFillPolygon, glFillVPolygon
User’s Manual81
void glFillPolygon(int n, int x1, int y1, int x2,
int y2, ...);
Draws a filled polygon in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the polygon that is outside the LCD display area will be clipped. The function will also
return, doing nothing, if there are less than 3 vertices.
PARAMETERS
n is the number of vertices
x1 is the x coordinate of the first vertex
y1 is the y coordinate of the first vertex
x2 is the x coordinate of the second vertex
y2 is the y coordinate of the second vertex
... coordinates of additional vertices
SEE ALSO
glFillVPolygon, glPlotPolygon, glPlotVPolygon
void glPlotVPolygon(int n, int *pFirstCoord);
Plots the outline of a polygon in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the polygon that is outside the LCD display area will be clipped. The function will also
return, doing nothing, if there are less than 3 vertices.
PARAMETERS
n is the number of vertices
pFirstCoord is a pointer to an array of vertex coordinates x1,y1, x2,y2, x3,y3, ...
SEE ALSO
glPlotPolygon, glFillPolygon, glFillVPolygon
void glFillVPolygon(int n, int *pFirstCoord);
Draws a filled polygon in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the polygon that is outside the LCD display area will be clipped. The function will also
return, doing nothing, if there are less than 3 vertices.
PARAMETERS
n is the number of vertices
pFirstCoord is a pointer to an array of vertex coordinates x1,y1, x2,y2, x3,y3, ...
SEE ALSO
glFillPolygon, glPlotPolygon, glPlotVPolygon
82eDisplay (OP7200)
void glPlotCircle(int xc, int yc, int rad);
Draws a circle in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the circle that is outside the LCD display area will be clipped.
PARAMETERS
xc is the x coordinate of the center of the circle
yc is the y coordinate of the center of the circle
rad is the radius of the circle (in pixels)
SEE ALSO
glFillCircle, glPlotPolygon, glFillPolygon
void glFillCircle(int xc, int yc, int rad);
Draws a filled circle in the LCD page buffer, and on the LCD if the buffer is unlocked.
Any portion of the circle that is outside the LCD display area will be clipped.
PARAMETERS
xc is the x coordinate of the center of the circle
yc is the y coordinate of the center of the circle
rad is the radius of the circle (in pixels)
SEE ALSO
glPlotCircle, glPlotPolygon, glFillPolygon
void glXFontInit(fontInfo *pInfo, char pixWidth,
char pixHeight, unsigned startChar, unsigned
endChar, unsigned long xmemBuffer);
Initializes the font descriptor structure, where the font is stored in xmem. Each font character's bitmap is
column-major and byte-aligned.
PARAMETERS
pInfo is a pointer to the font descriptor to be initialized
pixWidth is the width of each font item (in pixels)
pixHeight is the height of each font item (in pixels)
startChar is the value of the first printable character in the font character set
endChar is the value of the last printable character in the font character set
xmemBuffer is an xmem address of the pointer to a linear array of font bitmaps
SEE ALSO
glPrinf
User’s Manual83
void glPrintf(int x, int y, fontInfo *pInfo,
char *fmt, ...);
Prints a formatted string (much like printf) on the LCD screen. Only the character codes that exist in
the font set are printed, all others are skipped over. For example,
(ASCII backspace, tab, new line, and carriage return, respectively) will be printed if they exist in the font
set, but will not have any effect as control characters.
Any portion of the bitmap character that is outside the LCD display area will be clipped.
PARAMETERS
x is the x coordinate (column) of the upper left corner of the text
y is the y coordinate (row) of the left top corner of the text
pInfo is a pointer to the window frame descriptor
fmt is a formatted string
... is a formatted string of conversion paramet er(s)
EXAMPLE
glprintf(0,0, &fi12x16, "Test %d\n", count);
SEE ALSO
glXFontInit
'\b', '\t', '\n', and '\r'
void glSetPfStep(int stepX, int stepY);
Sets the glPrintf() printing step direction. The x and y step directions are independent signed values. The actual step increments depend on the height and width of the font being displayed, which are
multiplied by the step values.
Use glGetPfStep() to examine the current x and y printing step direction.
PARAMETERS
stepX is the glPrintf x step value
stepY is the glPrintf y step value
SEE ALSO
glGetPfStep
void glGetPfStep(void);
Gets the current glPrintf() printing step direction. Each step direction is independent of the other,
and is treated as an 8-bit signed value. The actual step increments depend s on th e height and width of the
font being displayed, which are multiplied by the step values.
Use glSetPfStep() to control the x and y printing step direction.
RETURN VALUE
The x step is returned in the MSB, and the y step is returned in the LSB of the integer result.
SEE ALSO
glSetPfStep
84eDisplay (OP7200)
unsigned long glFontCharAddr(fontInfo *pInfo,
char letter);
Returns the xmem address of a character from the specified font set.
PARAMETERS
pInfo is the xmem address of the bitmap font set
latter is an ASCII character
RETURN VALUE
The xmem address of the bitmap character font, column-maj or and byte-a l igned.
SEE ALSO
glPutFont, glPrintf
void glPutFont(int x, int y, fontInfo *pInfo,
char code);
Puts an entry from the font table to the page buffer, and on the LCD if the buffer is unlocked. Each font
character's bitmap is column-major and byte-aligned.
Any portion of the bitmap character that is outside the LCD display area will be clipped.
PARAMETERS
x is the x coordinate (column) of the upper left corner of the text
y is the y coordinate (row) of the left top corner of the text
pInfo is a pointer to the window frame descriptor
code is the ASCII character to display
SEE ALSO
glFontCharAddr, glPrintf
void glPutChar(char ch, char *ptr, int *cnt,
glPutCharInst *pInst)
Provides an interface between the STDIO string handling functions and the graphic library. The
STDIO string formatting function will call this function, one character at a time, until the entire format-
ted string has been parsed.
Any portion of the bitmap character that is outside the LCD display area will be clipped.
PARAMETERS
ch is the character to be displayed on the LCD
ptr is not used, and is a place holder due to the STDIO string functions
cnt is not used, and is a place holder due to the STDIO string functions
pInfo is a pointer to the window frame descriptor
SEE ALSO
glPrintf, glPutFont
User’s Manual85
int TextWindowFrame(windowFrame *window,
fontInfo *pFont, int x, int y, int winWidth,
int winHeight)
Defines a text-only display window. This function provides a way to display characters within the text
window only using character row and column coordinates.
The text window feature provides end-of-line wrapping and clipping after the character in the last column and row is displayed.
NOTE: Be sure to execute the TextWindowFrame function before using any of the
window is a pointer to the window frame
pFont is a pointer to the window frame descriptor
x is the x coordinate of where the text window frame is to start
y is the y coordinate where the text window frame is to start
winWidth is the width of the text window frame
winHeight is the height of the text window frame
RETURN VALUE
0 = window frame was successfully created
-1 = x coordinate + width has exceeded the display boundary
-2 = y coordinate + height has exceeded the display boundary
Sets the cursor location on the display of where to display the next character. The display location is
based on the height and width of the character to be displayed.
NOTE: Be sure to execute the TextWindowFrame function before using any of the
Displays a character on the display where the cursor is currently pointing. If any portion of the bitmap
character is outside the LCD display area, the character will not to be displayed.
NOTE: Be sure to execute the TextWindowFrame function before using any of the
This function prints a formatted string (much like printf) on the LCD screen. Only printable characters in the font set are printed; escape sequences
sequences will be skipped over. For example, nothing will be displayed for
The text window feature provides end-of-line wrapping and clipping after the character in the last column and row is displayed.
NOTE: Be sure to execute the TextWindowFrame function before using any of the
'\r' and '\n' are also recognized. All other escape
'\b' and 't'.
void glLeft1(int left, int top, int cols, int rows);
Scrolls byte-aligned window left one pixel, right column filled by current pixel type (color).
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
SEE ALSO
glHScroll, glRight1
void glRight1(int left, int top, int cols,
int rows);
Scrolls byte-aligned window right one pixel, left column filled by current pixel type (color).
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
SEE ALSO
glHScroll, glLeft1
88eDisplay (OP7200)
void glHScroll(int left, int top, int cols,
int rows, int nPix);
Scrolls right or left within the defined window by nPix number of pixels. The opposite edge of the
scrolled window will be filled in with white pixels. The window must be byte-aligned.
Parameters will be verified for the following:
1. The left and column parameters will be verified that they are evenly divisible by 8. If not,
they will be changed to be a value that is a multiple of 8.
2. Parameters will be checked to verify that the scrolling area is valid. The minimum scrolling area is
a width of 8 pixels and a height of one row.
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
nPix is the number of pixels to scroll within the defined window (negative value to scroll left)
SEE ALSO
glVScroll
void glUp1(int left, int top, int cols, int rows);
Scrolls byte-aligned window up one pixel, bottom row filled by current pixel type (color).
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
SEE ALSO
glVScroll, glDown1
void glDown1(int left, int top, int cols, int rows);
Scrolls byte-aligned window down one pixel, top row filled by current pixel type (color).
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
SEE ALSO
glVScroll, glUp1
User’s Manual89
void glVScroll(int left, int top, int cols,
int rows, int nPix);
Scrolls up or down within the defined window by nPix number of pixels. The opposite edge of the
scrolled window will be filled in with white pixels. The window must be byte-aligned.
Parameters will be verified for the following:
1. The left and column parameters will be verified that they are evenly divisible by 8. If not,
they will be changed to be a value that is a multiple of 8.
2. Parameters will be checked to verify that the scrolling area is valid. The minimum scrolling area is
a width of 8 pixels and a height of one row.
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
cols is the number of columns in the window, must be evenly divisible by 8
rows is the number of rows in the window
nPix is the number of pixels to scroll within the defined window (negative value to scroll up)
SEE ALSO
glHScroll
void glXPutBitmap(int left, int top, int width,
int height, unsigned long bitmap);
Draws bitmap in the specified space. The data for the bitmap are stored in xmem. This function automatically calls
ible by 8).
Any portion of a bitmap image or character that is outside the LCD display area will be clipped.
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
width is the width of the bitmap
height is the height of the bitmap
bitmap is the address of the bitmap in xmem
SEE ALSO
glXPutFastmap if the bitmap is byte-aligned (left edge and width are each evenly divis-
glXPutFastmap, glPrintf
90eDisplay (OP7200)
void glXPutFastmap(int left, int top, int width,
int height, unsigned long bitmap);
Draws bitmap in the specified space. The data for the bitmap are stored in xmem. This is like
glXPutBitmap, except that it's faster. The restriction is that the bitmap must be byte-aligned.
Any portion of a bitmap image or character that is outside the LCD display area will be clipped.
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
width is the width of the bitmap
height is the height of the bitmap
bitmap is the address of the bitmap in xmem
SEE ALSO
glXPutBitmap, glPrintf
void glXGetBitmap(int x, int y, int bmWidth,
int bmHeight, unsigned long xBm);
Gets a bitmap from the LCD page buffer and stores it in xmem RAM. This function automatically calls
glXGetFastmap if the bitmap is byte-aligned (left edge and width are each evenly divisible by 8).
PARAMETERS
x is the x coordinate of the left edge of the bitmap (in pixels)
y is the y coordinate of the top edge of the bitmap (in pixels)
bmWidth is the width of the bitmap (in pixels)
bmHeight is the height of the bitmap (in pixels)
xBm is the address of the bitmap in xmem RAM
SEE ALSO
glXPutFastmap, glPrintf
User’s Manual91
void glXGetFastmap(int left, int top, int width,
int height, unsigned long xmemptr);
Draws bitmap in the specified space. The data for the bitmap are stored in xmem. This is like
glXPutBitmap, except that it's faster. The restriction is that the bitmap must be byte-aligned.
Any portion of a bitmap image or character that is outside the LCD display area will be clipped.
PARAMETERS
left is the upper left corner of bitmap, must be evenly divisible by 8
top is the left top corner of the bitmap
width is the width of the bitmap
height is the height of the bitmap
xmemptr is the address of the bitmap in xmem
SEE ALSO
glXPutBitmap, glPrintf
void TextBorderInit(windowFrame *wPtr, int border,
char *title);
Initializes the window frame structure with the border and title information. The TextWindowFrame
function must be executed before running this function.
PARAMETERS
WindowFrame is a pointer to the window frame descriptor
border is the border style:
SINGLE_LINE—single-line border around the text window
DOUBLE_LINE—double-line border around the text window
title is a pointer to the title:
1. If a NULL string is detected, then no title is written to the text menu
2. If a string is detected, then it will be written to the top of the text menu box as the centered title
Displays the border for a given window frame. The TextBorderInit function must be executed
before running this function.
This function will automatically adjust the text window parameters to accommodate the space taken by
the text border. This adjustment will only occur once after the