Rabbit OP7100 User Manual

OP7100
Serial Graphic Display
User ’s Manual
019–0065 • 070831–O
OP7100 User’s Manual
Part Number 019-0065 • 070831-O • Printed in U.S.A.
Rabbit Semiconductor reserves the right to make changes and
improvements to its products without providing notice.
No part of the contents of thi s ma nua l may be reproduced or transmitt ed in an y form or by any means without the express written permission of Rabbit Semiconductor.
Permission is granted to make one or more copies as long as the copyright page con ta in ed therein is included. These copies of the manuals may not be let or sold for any reason without the express written permission of Rabbit Semiconductor.
Trademarks
Dynamic C
Windows
PLCBus
The latest revision of this m an ual is a v aila ble on th e Ra b b it S e mic o nd u cto r Web site ,
www.rabbit.com, for free, unregistered download.
®
is a registered trademark of Rabbit Semiconductor Inc.
®
is a registered trademark of Microsoft Corporation
is a trademark of Rabbit Semiconductor Inc.
Rabbit Semiconductor Inc.
www.rabbit.com
Table of Contents


iiiOP7100
TABLE OF CONTENTS
About This Manual vii
Chapter 1: Overview 11
Introduction..........................................................................................12
Features................................................................................................13
Options ............................................................................................13
Development and Evaluation Tools .....................................................14
Software ..........................................................................................14
CE Compliance ....................................................................................15
Chapter 2: Getting Started 17
Initial OP7100 Setup............................................................................18
Parts Required................................................................................. 18
Setting Up the OP7100 ...................................................................18
Connecting the OP7100 to a Host PC..................................................20
Running Dynamic C.............................................................................22
Chapter 3: Hardware 23
OP7100 Subsystems Overview ............................................................24
Computing Module .........................................................................24
Power Management .............................................................................25
ADM691 Supervisor Chip ..............................................................26
Handling Power Fluctuations........................................................26
Watchdog T imer ...........................................................................27
Power Shutdown and Reset ..........................................................28
PFI “Early Warning”.....................................................................28
Memory Protection .......................................................................29
Battery Backup .............................................................................29
System Reset ...................................................................................29
Liquid Crystal Display (LCD) .............................................................30
Contrast Adjustment........................................................................30
Background ..................................................................................... 31
Coordinate Systems.........................................................................32
LCD Controller Chip ......................................................................32
Keypad Interface..................................................................................34
iv


Table of Contents OP7100
Digital I/O ............................................................................................35
Serial Communication..........................................................................36
RS-232 Communication ..................................................................38
Receive and T ransmit Buffers.......................................................38
CTS/R TS Control .........................................................................39
Modem Communication ...............................................................39
RS-485 Communication ..................................................................40
Developing an RS-485 Network...................................................40
Use of the Serial Ports..................................................................... 42
Z180 Serial Ports ..........................................................................43
Asynchronous Serial Communication Interface...................................45
ASCI Status Registers .....................................................................45
/DCD0 (Data Carrier Detect)........................................................45
TIE (Transmitter Interrupt Enable)...............................................45
TDRE (Transmitter Data Register Empty) ...................................45
CTS1E (CTS Enable, Channel 1) .................................................46
RIE (Receiver Interrupt Enable)................................................... 46
FE (Framing Error) .......................................................................46
PE (Parity Error)...........................................................................46
OVRN (Overrun Error) ................................................................46
RDRF (Receiver Data Register Full)............................................46
ASCI Control Register A ................................................................47
MOD0–MOD2 (Data Format Mode Bits) ....................................47
MPBR/EFR (Multiprocessor Bit Receive/Error Flag Reset)........47
/R TS0 (Request to Send, Channel 0) ............................................47
CKA1D (CKA1 Disable)..............................................................47
TE (Transmitter Enable)............................................................... 47
RE (Receiver Enable) ...................................................................48
MPE (Multiprocessor Enable) ......................................................48
ASCI Control Register B ................................................................48
SS (Source/Speed Select) .............................................................48
DR (Divide Ratio) ........................................................................49
PEO (Parity Even/Odd) ................................................................49
/CTS/PS (Clear to Send/Prescaler) ...............................................49
MP (Multiprocessor Mode) ..........................................................49
MPBT (Multiprocessor Bit Transmit) ..........................................49
Chapter 4: Software 51
Supplied Software................................................................................52
Digital I/O ............................................................................................53
Real-Time Clock (RTC).......................................................................54
Display .................................................................................................55
Flash EPROM .................................................................................55
Table of Contents


vOP7100
Dynamic C 32 Libraries.......................................................................56
OP71HW.LIB..................................................................................56
Keypad Programming .....................................................................65
Using Dynamic C v . 5.xx .....................................................................66
EZIOOP71.LIB...............................................................................66
GLCD.LIB ......................................................................................66
KP_OP71.LIB.................................................................................70
SYS.LIB .......................................................................................... 72
Upgrading Dynamic C .........................................................................73
New LCD Controller Chip ..............................................................73
Chapter 5: Graphics Programming 75
Initialization .........................................................................................76
Drawing Primitives ..............................................................................76
Plot a Pixel ......................................................................................76
Plot a Line .......................................................................................77
Plot a Circle ....................................................................................77
Plot a Polygon .................................................................................77
Fill a Circle .....................................................................................77
Fill a Polygon ..................................................................................77
Draw a Bitmap ................................................................................77
Font and Bitmap Conversion ...............................................................78
Using the Font/Bitmap In Your Program ........................................79
Printing T ext.........................................................................................80
Keypad Programming ..........................................................................81
Initialization ....................................................................................81
Scanning the Keypad.......................................................................81
Reading Keypad Activities..............................................................81
Chapter 6: Installation 83
Grounding ............................................................................................84
Installation Guidelines .........................................................................85
Mounting..............................................................................................86
Bezel-Mount Installation.................................................................86
General Mounting Recommendations.............................................87
Appendix A: Troubleshooting 89
Out of the Box......................................................................................90
Dynamic C W ill Not Start ....................................................................91
Dynamic C Loses Serial Link ..............................................................91
OP7100 Repeatedly Resets..................................................................91
Common Programming Errors.............................................................92
vi


Table of Contents OP7100
Appendix B: Specifications 93
Electrical and Mechanical Specifications ............................................94
LCD Dimensions.............................................................................94
Bezel Dimensions ...........................................................................94
General Specifications ....................................................................95
Header and Jumper Configurations .....................................................96
Appendix C: Memory, I/O Map, and Interrupt Vectors 99
OP7100 Memory ...............................................................................100
Execution Timing ..........................................................................101
Memory Map .....................................................................................102
Input/Output Select Map ...............................................................102
Z180 Internal Input/Output Registers Addresses 00-3F................102
Epson 72423 Timer Registers 0x4180–0x418F............................104
Other Registers..............................................................................105
Interrupt Vectors ................................................................................106
Power-Failure Interrupts ...............................................................107
Interrupt Priorities .........................................................................107
Appendix D: Serial Interface Board 109
Introduction........................................................................................110
External Dimensions .......................................................................... 111
Appendix E: Backup Battery 113
Battery Life and Storage Conditions..................................................114
Replacing the Lithium Battery ........................................................... 114
Battery Cautions ................................................................................115
Index 117
Schematics 125
OP7100 About This Manual


vii
ABOUT T HIS M ANUAL
This manual provides instructions for installing, testing, configuring, and interconnecting the Rabbit Semiconductor OP7100 touchscreen operator interface. Instructions are also provided for using Dynamic C functions.
Assumptions
Assumptions are made regarding the user's knowledge and experience in the following areas.
Ability to design and engineer the target system that interfaces with the OP7100.
Understanding the basics of operating a software program and editing files under Windows on a PC.
Knowledge of the basics of C programming.
For a full treatment of C, refer to the following texts. The C Programming Language by Kernighan and Ritchie and/or C: A Reference Manual by Harbison and Steel
Knowledge of basic assembly language and architecture for the Z180 microprocessor.
For documentation from Zilog, refer to the following texts.
Z180 MPU User's Manual Z180 Serial Communication Controllers Z80 Microprocessor Family User's Manual
OP7100viii


About This Manual
Acronyms
Table 1 lists and defines the acronyms that may be used in this manual.
Icons
Table 2 displays and defines icons that may be used in this manual.
Table 1. Acronyms
Acronym Meaning
EPROM Erasable Programmable Read-Only Memory EEPROM Electronically Erasable Programmable Read-Only Memory LCD Liquid Crystal Display LED Light-Emitting Diode NMI Nonmaskable Interrupt PIO Parallel Input/Output Circuit
(Individually Programmable Input/Output)
PRT Programmable Reload Timer RAM Random Access Memory RTC Real-Time Clock SIB Serial Interface Board SRAM Static Random Access Memory UART Universal Asynchronous Receiver Transmitter
Table 2. Icons
Icon Meaning Icon Meaning
Refer to or see
Note
Please con tact
Ti
p
Tip
Caution
High Voltage
FD
Factory Default
OP7100 About This Manual


ix
Conventions
Table 3 lists and defines the typographical conventions that may be used in this manual.
Pin Number 1
A black square indicates pin 1 of all headers.
Measurements
All diagram and graphic measurements are in inches followed by millime­ters enclosed in parenthesis.
J1
Pin 1
Table 3. Typographical Conventions
Example Description
while
Courier font (bold) indicates a program, a fragment of a program, or a Dynamic C keyword or phrase.
// IN-01…
Program comments are written in Courier font, plain face.
Italics
Indicates that something should be typed instead of the italicized words (e.g., in place of filename, type a file's name).
Edit
Sans serif font (bold) signifies a menu or menu selection.
. . .
An ellipsis indicates that (1) irrelevant program text is omitted for brevity or that (2) preceding program text may be repeated indefinitely.
[ ]
Brackets in a C function’s definition or program segment indicate that the enclosed direct ive is optional.
< >
Angle brackets occasionall y enclose classes of terms.
a | b | c
A vertical bar indicates that a choice sh ould be made from among the items listed.
OP7100x


About This Manual
OP7100 Overview


11
CHAPTER 1: OVERVIEW
Chapter 1 provides an overview and a brief description of the OP7100 features.
OP710012


Overview
Introduction
The OP7100 is a serial graphic display in a compact, easy to integrate module. The OP7100 features an LCD that has a white background with blue images. The LCD has pixel graphics and provides two-color (mono­chrome) displays. Five standard fonts are included in the supplied soft­ware. Additional custom fonts are easily created to meet the needs of an application.
The OP7100 can operate with Rabbit Semiconductor single-board comput­ers or other serial displays over an RS-485 network. The OP7100 also supports RS-232 communication.
The OP7100 display terminal uses display technologies that require mini­mal mounting depth and offer maximum viewing angles. The memory allows up to 25 application-screen bitmaps (240 × 320) to be stored with­out compression in a 256K flash EPROM. A further 256K is available for the application in a second flash EPROM.
Figure 1-1 illustrates the standard OP7100 board layout.
C48
R31
0V / GND
JP4
C29
R53
J3
J4
DIGITAL I/O
C104
C106
C101
C95
C96
R62 R61
C102
JP5
BT1
C61
C60
C56
C2
C62
C55
C59
Battery
J9
RS485 TERM.
J11
DCIN
GND
485+
485
GND
C47
D3
D2
C44
J7
PRGM PORT
U20
JP1
LCD
Y1
C4
C7
U4
R2
C51
J1
LCD
U1
R1
Y2
C12
R51
R52
RN2
R14
C13
R15
C34
R13
C31
U17
C32
U18
RN3
C33
U19
U6
U2
RT1
R33 C49
J2
C1
T1
Q3
DANGER! HIGH VOLTAGE
L1
Q2
Q1
KEYPAD
J5
J6
RN1
C14
C15
C16
C17
C18
C19
C20
C21
R43
R44
R45
R48
R50
R42
R41
R40
R39
R38
R37
R36
R35
LS1
R20
R16
R17
R54
U22
R22
R21
R19
R18
JP2
RN4
U11
U12
U10
C27
U9
C23
U8
C22
U7
C24
U13
U14
U5
C50
Flash
U16
U15
C30
U29
C9
R5
R6
R7
C25
C26
R8
R9
R10
R11
R12
C53
C8
C10
R56
MV2
MV1
R24
R23
R25
R26
U24
JP3
C36
C35
C37
U23
U26
D1
U25
C38
C39
C42
U27
C40
C41
R28
R27
C45
U28
C43
J8
D5
R29
R30
RS232
R32
C46
L2
C52
R55
C28
C11
R4
R3
J10
Trans­former
C58
RT2
JP7
JP6
C105
U30
JP10
JP9
JP8
C98
C100
C99
C97
C103
EPLD
R60
R59
R46
R49
R47
R34
C54
PAL
691
U21
D4
RTC
SRAM
Flash
Flash
C3
C57
C6
Z180
LCD
Control
Powe r, RS-485
Contrast Adjustment
RS-232
to
backlight
Figure 1-1. OP7100 Board Layout
OP7100 Overview


13
Features
The OP7100 includes the following features.
240 × 320 ¼ VGA LCD (with touchscreen on OP7100 only)
jumper-selectable background—positive (blue images on white background) or negative (white images on blue background)
software-controlled cold-cathode fluorescent backlighting
software-controlled contrast is enabled/disabled with jumper settting
temperature compensation for LCD contrast changes with temperature
RS-485 and RS-232 serial communication up to 57,600 bps
8 CMOS/TTL-level digital inputs and 8 CMOS/TTL-level digital outputs
18.432 MHz clock with Z180 microprocessor, 9.216 MHz LCD controller
256K flash EPROM for program, 256K flash EPROM for screen bitmaps
switching voltage regulator
Appendix B provides detailed specifications for the OP7100.
The OP7100 also includes battery-backed RAM (128K) and a battery­backed real-time clock a watchdog timer, and power -failure interrupt.
Options
The OP7100 series of serial displays has two versions. Table 1-1 lists their standard features.
Either model may be used in either a portrait or a landscape orientation by using the corresponding software library .
For ordering information, call your Rabbit Semiconuctor Sales Representative.
Table 1-1. OP7100 Series Features
Model Features
OP7100
Serial graphic display, touchscreen, blue and white screen, ¼VGA LCD with bezel mount, software contrast control
OP7110 OP7100 with no touchscreen, manual contrast control
OP710014


Overview
Development and Evaluation Tools
The OP7100 is supported by a Tool Kit that include everything you need to start development with the OP7100.
The Tool Kit includes these items.
Serial cable
24 V DC power supply capable of delivering 1.1 A
User’s manual with schematics An optional Serial Interface Board (SIB) is available to program the
OP7100 when a second RS-232 serial port is needed by the application being developed.
For ordering information, call your Rabbit Semiconductor Sales Representative.
Software
The OP7100 is programmed using Rabbit Semiconductor’s Dynamic C, an integrated development environment that includes an editor, a C compiler, and a debugger. Library functions provide an easy and robust interface to the OP7100.
Rabbit Semiconductor’s Dynamic C reference manuals provide complete software descriptions and programming instructions.
OP7100 Overview


15
CE Compliance
The OP7100 has been tested and was found to be in conformity with applicable EN immunity and emission standards. Note the following requirements for incorporat­ing the OP7100 into your application to comply with CE requirements.
The power supply provided with the Tool Kit is for development purpose only . It is the customer’ s responsibility to provide a CE compliant power supply for their end-product application.
The OP7100 has been tested to meet the following 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.
The OP7100 has been tested to meet the EN55022 Class A emissions standard with ferrite RFI suppressors on the I/O cables. Additional shielding or filtering may be needed to meet Class B emissions standards.
Since Rabbit Semiconductor products are connected to other devices, good EMC prac-tices should be taken to ensure compliance. CE compliance is eventually the responsibility of the integrator. For more information on tips and technical assistance, visit our Web site at www.rabbit.com/products/ ce_certification/, or contact your local authorized Rabbit Semiconductor distributor.
OP710016


Overview
OP7100 Getting Started


17
CHAPTER 2: GETTING ST A RTED
Chapter 2 provides instructions for connecting the OP7100 to a host PC and running a sample program.
OP710018


Getting Started
Initial OP7100 Setup
Parts Required
24 V unregulated DC power supply capable of delivering up to 1.1 A
Serial cable The necessary parts are supplied with the Tool Kit.
Setting Up the OP7100
1. Remove the green power connector shown in Figure 2-1 from the back of the OP7100.
2. Attach the bare leads from the power supply to the terminals on the power connector as shown in Figure 2-1.
3. Plug the connector back into the power connection header at the back of the OP7100. Watch the polarity of the connection so that the banded wire from the power supply goes to DCIN as shown in Figure 2-1.
Figure 2-1. OP7100 Power Supply Connections
Be careful to connect the power supply wires to the correct screw terminals on header J8. The OP7100 may be destroyed if the power supply is connected to the wrong screw terminal. A protective diode prevents damage to the OP7100 if the power supply polarity is reversed.
4. Plug the power supply into a wall outlet. The display should now light up with the demonstration screens shown in Figure 2-2.
485
+
GND
485 GND
4
3
2
1
DCIN (1230 VDC)
5
to power
supply
DCIN
GND
485+
485
GND
OP7100 Getting Started


19
OP7100 SERIES
DISPLAY/CONTROLLER
Menu
FEATR
EXIT
SUPRT
DEMO
Clock
EXIT
Bklit
Ctrst Beep
Exit
Display Bitmaps
+Yr
Exit
+Day
+Mon
Hr
Sec
Min
+Hr +Min +Sec
Yr
Mon
Day
Set
1999 Dec 31
23 : 59 : 59
Exit
Press Keys Before Tiimeout
EXIT
SUPPORT
Z-WORLD
TECHNICAL SUPPORT
15307573737
www.zworld.com
Figure 2-2. OP7100 Demo Screens
OP710020


Getting Started
5
4
3
2
1
CONTRAST
RS232
485
+
GND
n.c.
485 GND
4
3
2
1
9
8
7
6
232_RX1/ CT 232_TX1/ RT PWR_DE9
TXA RXA
n.c.
GND
n.c.
DCIN (1230 VDC)
5
CAUTION: High-Voltage Transformer. Only qualified persons may open this case.
S/N:
Connecting the OP7100 to a Host PC
1. Unplug any power supply connected to the OP7100 and remove the back cover from the OP7100 assembly. The back cover is attached with the two screws shown in Figure 2-3.
Figure 2-3. OP7100 Back Cover
2. Establish a serial communication link. A PC “communicates” with the OP7100 via Serial Port 0 or the Clocked Serial Input/Output port on the OP7100’s Z180 microprocessor . There are two options for the serial communication link.
Option 1 (via optional SIB)—Connect an RJ-12 cable between the PC and the SIB. An RJ-12 to DB9 adapter is included for DB9 PC COM ports. Remove any jumpers that may be installed on the OP7100’ s header J4 and plug the SIB’ s 8-pin connector onto header J4 as shown in Figure 2-4. Make sure that pin 1 on the ribbon cable connector (on the striped side) matches up with pin 1 on J4 (indicated by a small white circle next to the header).
Option 2 (directly)—Place a jumper across pins 1–2 of header J4 on the OP7100 as shown in Figure 2-5. Connect the PC COM port to the DB9 jack on the OP7100, header J7, using the DB9 to DB9 serial cable supplied with the Tool Kit.
3. The OP7100 is now ready for programming. The power supply may be plugged in and turned on.
OP7100 Getting Started


21
Marked
Conductor
to Pin 1
Pin 1
J4
PRGM PORT
Figure 2-4. SIB Programming Connection
Figure 2-5. Direct Programming Connection
Option 2 uses an RS-232 serial port to program the OP7100. If this serial port is needed in your application, use the SIB as described in Option 1.
See Chapter 3, “Hardware,” for more information on the serial ports.
J4 SIB2
To PC
J4
1234567
8
OP710022


Getting Started
Running Dynamic C
Double-click the Dynamic C icon to start the software. Note that the PC attempts to communicate with the OP7100 each time Dynamic C is started. No error messages are displayed once communication is established.
The communication rate, port, and protocol are all selected by choosing
Serial Options from Dynamic C’s OPTIONS menu. The SIB and the
OP7100 both set their baud rate automatically to match the communication rate set on the host PC using Dynamic C (9600 bps, 19,200 bps, 28,800 bps, or 57,600 bps). To begin, adjust the communications rate to 19,200 bps.
Make sure that the PC serial port used to connect the serial cable (COM1 or COM2) is the one selected in the Dynamic C OPTIONS menu. Select the 1-stop-bit protocol.
See Appendix A, “Troubleshooting,” if an error message such as Target Not Responding or Communication Error appears.
Once the necessary changes have been made to establish communication between the host PC and the OP7100, use the Dynamic C shortcut <Ctrl Y> to reset the controller and initiate communication.
At this point, the LCD should be blank and the backlight should be off. Once communication is established, load the sample program
DEFDEMOL.C in the Dynamic C SAMPLES\QVGA subdirectory . Compile
and run the program by pressing F9 or by selecting Run from the Run menu.
The OP7100 should now alternately display the large font (17x × 35h) and the small font (6w × 8h). The fonts should scroll across the display.
Compiling and running this sample program will overwrite the demonstration program shown in Figure 2-3.
OP7100 Hardware


23
CHAPTER 3: HARDW ARE
Chapter 3 describes how to use the OP7100. Sections are included to describe the following features.
Subsystems Overview
Power Management
Liquid Crystal Display
Keyboard Interface
Digital I/O
Serial Communication
OP710024


Hardware
OP7100 Subsystems Overview
The OP7100 consists of several subsystems, including a computing module, serial communication channels, lquid crystal display (LCD), a buzzer, and a keypad interface. Figure 3-1 provides a block diagram of the OP7100.
Figure 3-1. OP7100 Block Diagram
Computing Module
The OP7100 computing module consists of a Zilog Z180 microprocessor, 128K of battery-backed static RAM, and 512K of flash EPROM. The computing module operates in tandem with a real-time clock and a watchdog timer/microprocessor supervisor .
The Z180 CPU runs at 18.432 MHz, and the LCD controller runs at
9.216 MHz. The watchdog timer/microprocessor chip provides a watchdog timer
function, power-failure detection, RAM protection, and battery backup. The real-time clock provides time and date information to applications
running on the OP7100.
The EEPROM is simulated in flash EPROM for consistency with Rabbit Semiconductor controllers whose software libraries rely on exchanging information with the EEPROM. The simulated EEPROM in the OP7100 is unused at the present time, but addresses 0 and 1 are reserved for furture use. Do not use these addresses in your application.
Flash2SRAM
RTC
Batt.
Z180
Flash1
8
LCD
Control
VRAM2VRAM1
’691
super.
Keypad
Interface
EPLD
Backlight
RS-232
RS-485
LCD
320 x 240
8
Optional Software Contrast Adjustment
Contrast Adjustmen
t
Drive
S
ense
Buzzer
Touchscreen
8
8
Digital
I/O
OP7100 Hardware


25
Power Management
The OP7100 was designed to operate from a 12 V to 30 V DC source, and consumes about 4.5 W with the backlight on, 1.5 W with the backlight off. To allow for a surge current when the OP7100 is first turned on, the power supply used must be able to handle at least four times this power (for example, 800 mA at 24 V).
The OP7100 power supply is converted internally to supply three voltages.
1. A switching regulator outputs VCC (+ 5 V).
2. A linear regulator outputs VEE (approximately –20 V).
3. A high-voltage section supplies 300 V rms to drive the cold-cathode fluorescent backlight. The backlight can be turned on or off under software control whereby a high on the gate of Q3 enables Q1 and Q2 to oscillate, and a low turns off Q3, stopping the oscillation of Q1 and Q2.
Figure 3-2 shows these internal power supplies in a block diagram
Figure 3-2. Block Diagram of OP7100 Internal Power Regulators
The DC input source can also be brought out on pin 9 of header J10, the DE-9 connector, by installing a 0 resistor at R32. This option allows power to be supplied to a serial device connected to the OP7100 as long as the serial device’ s RS-232 port can handle the DC input on pin 9.
Be sure to use a power supply with sufficient capacity (for example, 1.1 A at 24 V) to handle surges when the OP7100 and any devices connected to it are first turned on.
VCC
J10:9
1230 V DC
J11:5
1230 V DC
U28
2575
Sw Reg
U27
2951
Lin Power
U25
7662
Sw Reg
U23
7662
Sw Reg
VEE
VCC
2575
Sw Reg
Backlight
Power
from EPLD
300 V rms, 32.7 kHz, to CCFL backlight
Q3
OP710026


Hardware
ADM691 Supervisor Chip
A voltage divider consisting of R29 and R30 across the DC input provides a PFI signal to the ADM691 watchdog supervisor. The ADM691 chip performs the following services.
Watchdog timer resets the microprocessor if software “hangs.”
Power-failure shutdown and reset.
Generates an “early warning” power-failure interrupt (PFI) that lets the system know when power is about to fail.
Memory protection feature prevents writes to RAM when power is low .
Supports battery backup.
Handling Power Fluctuations
During a normal power-down, an interrupt service routine is used in response to a power-failure interrupt to save vital state information for the application for when power recovers. The amount of code that the interrupt service routine can execute depends on how fast the voltage decreases.
Theoretically , a power failure would cause a single power -failure interrupt. Then, the interrupt service routine would restore data from the previous state when the voltage recovers.
However, fluctuations in the DC input line could cause the ADM691 to see multiple crossings of the 1.3 V input power-reset threshold. These multiple negative-edge transitions would, in turn, cause the Z180 to see multiple power-failure interrupts.
The ADM691 generates a power-failure interrupt, INT1. After reset, INT1 must be enabled by a write into the ITC register as well as execution of the EI instruction followed by a RETI instruction. The Z180 will restore saved state information when it executes the RETI instruction.
Ideally, the Z180 should be able to pop the stack and return to the location where the program was first interrupted. Also, depending on the number of fluctuations of the DC input (and hence, the number of stacked power­failure interrupts), the processor’s stack can overflow, possibly into your program’s code or data.
The following sample program shows how to handle a power-failure interrupt.
OP7100 Hardware


27
main(){
...
}
...
char dummy[24];
...
#define INT1_BIT 0 ; bit 0
#INT_VEC INT1_VEC power_fail_isr
#asm
power_fail_isr::
ld sp,dummy+24 ; force stack pointer
; to top of dummy vector ; to prevent overwriting ; code or data
do whatever service, within allowable execution time
loop:
call hitwd ; make sure no watchdog reset
; while low voltage
ld bc,INT1 ; load the read INT1 register
; to bc
in a,(c) ; read the read INT1 register
; for /PFO
bit INT1_BIT, a ; check for status of /PFO jr nz,loop ; wait until the brownout
; clears
timeout: ; then...a tight loop to
; force a watchdog timeout,
jp timeout ; resetting the Z180
#endasm
Of course, if the DC input voltage continues to decrease, then the OP7100 will just power down.
Call the Dynamic C function hitwd during the power-failure service routine to make sure that the watchdog timer does not time out and thereby reset the processor . The controller can continue to run at low voltages, and so it might not be able to detect the low-voltage condition after the watchdog timer resets the processor.
Watchdog T imer
T o increase reliability, the ADM691’ s watchdog timer forces a system reset if a program does not notify the supervisor nominally at least every second. The assumption is that if the program fails to “hit” the watchdog, the program must be stuck in a loop or halted. The Dynamic C function for hitting the
OP710028


Hardware
watchdog timer is hitwd. To hold the watchdog timer at bay, make a call to
hitwd in a routine that runs periodically at the lowest software priority level.
A program can read the state of the WDO line with a call to wderror. This makes it possible to determine whether a watchdog timeout occurred. The following sample program shows how to do this when a program starts or restarts.
main(){
if( wderror() ) wd_cleanup(); hitwd(); ...
}
Power Shutdown and Reset
When VCC (+5 V) drops below V
MIN
(between 4.5 V and 4.75 V), the ADM691 supervisor asserts /RESET and holds it until VCC goes above V
MIN
and stays that way for at least 50 ms. This delay allows the system’s
devices to power up and stabilize before the CPU starts.
PFI “Early Warning”
When PFI drops below 1.3 V ± 0.05 V (i.e., DCIN drops below ~10 V), the supervisor asserts /NMI (nonmaskable interrupt), and allows the program to clean up and get ready for shutdown. The underlying assump­tion here is that PFI will cause the interrupt during a power failure before the ADM691 asserts /RESET.
In order to improve the performance of the power-failure interrupt circuit, we have added some hysteresis to the power-failure comparator by adding a resistor, R34, between the comparator input and output pins. R34 can be found on the 175-0196 and the 175-0211 versions of the OP7100. The hysteresis prevents the comparator from switching rapidly—and therefore generating multiple interrupts—when the input voltage is falling slowly. Once the comparator switches (DC IN falls to approximately 8.5 V), this feedback holds the input (PFI) low and prevents further interrupts from being generated. At this point, the 5 V regulator still has sufficient voltage to keep the processor operating, so that an interrupt service routine can perform shutdown tasks and “tidying up” before the Vcc line fails. The comparator will not turn the output (PFO) high until DC IN has risen to about 9.2 V. The hysteresis will also help prevent any system oscillation in adverse power supply/loading situations.
The voltage at which the power-failure interrupt occurs may be changed by adjusting the values of R29 and R30, which are shown in Figure 3-3. To calculate the values of these components, let VL be the voltage at which PFO turns off as DC IN falls, and let VH be the voltage at which PFO turns on as DC IN rises.
OP7100 Hardware


29
Figure 3-3. OP7100 Power-Failure Detection Circuit
Since R34 >> RN2, the difference between VH and VL, the hysteresis voltage, would be 5 V × (R30/R34). For a nominal hysteresis voltage of
1.25 V, R
30
= 0.25 × R34.
Memory Protection
When /RESET is active, the ADM691 supervisor disables the RAM chip­select line, preventing accidental writes.
Battery Backup
The backup battery protects data in the RAM and the real-time clock (R TC). VRAM, the voltage supplied to the RAM and R TC, can also protect other devices attached to the system against power failures. The ADM691 super­visor switches VRAM to VBA T or VCC, whichever is greater . (T o prevent “hunting,” the switchover actually occurs when Vcc is 50 mV higher than VBAT.)
The circuit draws no current from the battery once regular power is applied.
System Reset
The ADM691 chip drives the /RESET line. The /RESET line is not pulled up internally .
DCIN
U28 Reg.
VCC
R30
29.4 kW
R29
4.99 kW
PFI to supervisor
VIN VOUT
C44
47 µF
U12 Supervisor
VBAT
WDI
PFI
VOUT
WDO
PFO
RST
INT1
R34
220 kW
RST
VCC
RN2 10 kW
⎥ ⎦
⎢ ⎣
⎟ ⎠
⎜ ⎝
+
⎟ ⎠
⎜ ⎝
+=
⎥ ⎦
⎢ ⎣
⎟ ⎠
⎜ ⎝
+
⎟ ⎠
⎜ ⎝
+=
R34
R30
R29
R30
1V3.1V
RN2)V(R341.3
V)1.3-V5(R30
R29
R30
1V3.1V
H
L
OP710030


Hardware
Liquid Crystal Display (LCD)
The 240 × 320 ¼ VGA LCD supports both graphics and text. Automatic contrast control is built in so that the contrast, once set, does not drift as the OP7100 warms up or is moved.
Figure 3-4 provides a block diagram of the LCD control and RAM circuits.
Figure 3-4. Block Diagram LCD Control and Memory
The LCD is connected to the OP7100 circuit board through header J1 or J3 on the circuit board.
Contrast Adjustment
Figure 3-5 shows the location of the manual contrast adjustment. This con­trast adjustment is the factory default for the OP7110. The OP7100 is configured with software contrast control as the fac­tory default. W ith software contrast con­trol, the contrast level may be set via a software function call. Since it is hard to guess the correct level in software, buttons defined on the OP7100 touch­screen and in software can be used to adjust the contrast. A user-supplied key­pad can facilitate this type of software control for the OP7110.
CONTRAST
Figure 3-5. Location of OP7100
Manual Contrast Adjustment
U2
VCC
VRAMCS1
A[0–14]
/CS VCC
D[0–7]
RAM
U1
VCC
VRAMCS2
A[0–14]
/CS VCC
D[0–7]
RAM
U3
VA[0–14]
VD[0–7]
FRAME
ON/OFF
/RESET
SED1335F LCD Control
XD[0–3]
/INT0
D[0–7]
A0
FRAME
XD[0–3] VCC
ON/OFF
LCD
VEE
ADJUST
VCC
R26
10 k
R31
2.5 k
-
+
Manual
Software Contrast
Adjustment
OP7100 Hardware


31
Figure 3-6 shows the jumper settings for the contrast control options.
Figure 3-6. Contrast Control Jumper Configurations
Background
The OP7100 comes factory-configured to display blue characters on a white (positive) background. The jumpers on header JP1 may be rear­ranged as shown in Figure 3-7 to display white characters on a blue (negative) background.
Figure 3-7. LCD Background Jumper Settings
JP2
JP2
Software
Contrast
Adjustment
Manual
Contrast
Adjustment
FD
FD
OP7110
3
2
1
3
2
1
OP7100
FD
Positive Background
(white with blue graphics)
Negative Background
(blue with white graphics)
10
12
JP1
123456789
11
10 12
JP1
123456789
11
JP1
U4
OP710032


Hardware
Coordinate Systems
Figure 3-8 shows the coordinate systems for the touchscreen and the LCD.
Figure 3-8. Coordinate Systems
(row, column)
LCD Controller Chip
The LCD controller chip provides support for the LCD module. The controller chip is attached to the data bus on the OP7100, and is mapped to the I/O address space. This interface is composed of eight data bits, one address line, and three control lines (RD, WR, and 1335-CS).
The interface from the LCD controller to the LCD module is unidirectional. 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 particu­lar LCD module. The controller continually reads the SRAM for data placed there by the microprocessor, and refreshes the display periodically.
landscape
0,7
7,0
7,7
0,0
landscape
320,240
0,0
320,0
0,240
portrait
7,7
0,7
7,0 0,0
portrait
240,0
0,320
0,0
240,320
Touchscreen
LCD
OP7100 Hardware


33
J3
C104
C106
C101
C95
C96
R62 R61
C102
JP1
Y1
C4
C7
U4
R2
C51
J1
LCD
U1
R1
C12
R51
R52
U6
U2
RT1
R33 C49
J2
C1
T1
Q3
DANGER! HIGH VOLTAGE
Q2
C8
C10
R56
R4
Trans­former
RT2
JP7
JP6
C105
U30
JP10
JP9
JP8
C98
C100
C99
C97
C103
LCD
Control
JP1
Y1
C4
C5
C7
U4
R2
C51
C6
J1
LCD
U3
R1
C12
R51
R52
U6
C3
U2
C2
U1
RT1
R33
C49
J2
C1
T1
Q3
DANGER! HIGH VOLTAGE
Q2
C10
R56
R4
Trans­former
LCD
Control
CURRENT
OP7100
PRE-2006
OP7100
Other functions support the LCD module to adjust its contrast and to turn the white CCFL backlight on and off. A variable resistor between two of the LCD module’s terminals sets the contrast, which is set either by soft­ware or manually, depending on the jumper setting on header JP2. Once a contrast value is set, it will be maintained. A single programmed I/O bit is used to turn the backlight on or off.
The controller chip used in OP7100’s sold before 2006 supported either 32K or 64K of SRAM. These OP7100s were designed using a dual­footprint SRAM to accept either one 32K or two 32K SRAM. One 32K part was standard.
OP7100 units sold after June, 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 3-9 shows the area of the OP7100 that changed to accommodate the new LCD controller chip. The new LCD controller is not 100% code-compatible with the old chip—the New LCD Controller Chip section on p. 73 explains how to handle programs developed for an OP7100 for the older LCD controller chip.
Figure 3-9. How to Identify Pre-2006 OP7100 Boards
OP710034


Hardware
Keypad Interface
The OP7100 has a touchscreen, which is connected to the circuit board at header J5. Header J6 is available for a customer-supplied keypad for the OP7110.
Table 3-1 lists the pinouts for headers J5 and J6. The pinout for header J5 is identical to the pinout for header J6.
Figure 3-10 shows the location of headers J5 and J6.
Figure 3-10. OP7100 Headers J5 and J6 (Keypad Interface)
Figure 3-11 shows a simplified diagram of the keypad interface.
Figure 3-11. Block Diagram of OP7100 Keypad Interface
Table 3-1. OP7100 Keypad Header Pinout
Signal Header J5/J6 Pin Signal Header J5/J6 Pin
ROW0 1 COL0 9 ROW1 2 COL1 10 ROW2 3 COL2 11 ROW3 4 COL3 12 ROW4 5 COL4 13 ROW5 6 COL5 14 ROW6 7 COL6 15 ROW7 8 COL7 16
J6
J5
U10
VCC
Q[07]
ROW[07]
A[07]Y[07]
74HC244
D[07]
/COLUMN
Keypad sense
8
8
8
To J5 (or to J6) keypad connectors
COL[07]
U8, U9
Keypad/Buzzer drive
C14C21
1 nF
RN1
47 k
OP7100 Hardware


35
Digital I/O
The OP7100 has eight CMOS/TTL-level digital inputs and eight CMOS/ TTL-level digital outputs. The digital inputs are provided with pullup resistors, shown in Figure 3-12, to provide a known state before a digital input is applied..
Figure 3-12. OP7100 Digital Inputs
The digital I/O are located on header J7, and are available through a con­nector on the outside of the OP7100 back cover. Figure 3-13 shows the pinout and the location of header J7.
Figure 3-13. OP7100 Header J7
10 k
+5 V
+5 V
To Z180 Data Bus
CMOS
Input
DIN[07]
10 12
J7
123456789
11 13
15
17 19
14 16
18
20
OUT0
OUT1
OUT2
OUT3
OUT4
OUT5
OUT6
OUT7
DIN0
DIN1
DIN2
DIN3
DIN4
DIN5
DIN6
DIN7
VCC
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
GND
22
24
26
28
30
32
34
21
23
25
27
29 31 33
J7
OP710036


Hardware
Serial Communication
T wo serial channels support asynchronous communication at baud rates from 300 bps to 57,600 bps. Serial communication provides a simple and robust means for networking controllers and other devices.
Figure 3-14 illustrates the configuration of the OP7100 serial channels.
Figure 3-14. Serial Channels
The factory default configuration for the OP7100 is for one 5-wire RS-232 port (with R TS and CTS) and one half-duplex RS-485 port. An RS-485 channel can provide half-duplex asynchronous communication over twisted-pair wires for distances up to 3 km. T wo other configurations, shown in Figure 3-14, are one 3-wire RS-232/one RS-485, and two 3-wire RS-232. The configurations are set with jumpers on header JP3.
Figure 3-15. Serial Communication Jumper Configurations
T1OUT
T2OUT
R1IN
R2IN
T1IN
T2IN
R1OUT
R2OUT
TX1/RTS
TXA0
232A
485
RX1/CTS
RXA0
D
R
DE
RE
A
B
U24
VCC
U26
to J11
to J10 (DE9) and J8
TXA1
RXA1
EN485
TXA0 RTS0 RXA0 CTS0
FD
10
12
JP3
12
34
56
78
9
11
5-wire RS-232,
RS-485
10
12
JP3
12
34
56
78
9
11
two
3-wire RS-232
10
12
JP3
12
34
56
78
9
11
3-wire RS-232,
RS-485
OP7100 Hardware


37
The jumpers on header JP4 may be reconfigured so that header J11 carries the Z180 Port 1 TX1 and RX1 RS-232 signals on pins 2 and 3 instead of the factory-default RS-485+ and RS-485– signals.
Figure 3-16 shows the header JP4 jumper configurations and the location of headers JP3 and JP4.
Figure 3-16. Serial Communication Options for
External Plug Connector (Header J11)
FD
JP4
12
34
56
78
RS-485 on header J11
JP4
12
34
56
78
RS-232 on header J11
JP4
JP5
JP3
OP710038


Hardware
J8
GND
CTS/RX1
RTS/TX1
RX0
GND
RTS/TX1
CTS/RX1
J10
TX0
1
2
3
4
5
6
7
8
9
10
246
8
13579
RS-232 Communication
Figure 3-17 shows the RS-232 signals on header J8 and header J10 (the DE-9 connector).
Figure 3-17. RS-232 Signals
Pin 9 on header J10, the DE-9 connector, may be configured to carry DCIN, the input voltage, by adding a 0 resistor at R32. Be careful when connecting other devices to header J10 when R32 is installed since not all devices can handle DCIN. For example, PCs are limited to 12 V.
The availability of DCIN on pin 9 of header J7 allows a DC power supply to be made available to the device being connected to the OP7100.
Rabbit Semiconductor has RS-232 support libraries for Z180 Ports 0 and
1. The following functional support for serial communication is included.
Initializing the serial ports.
Monitoring and reading a circular receive buffer.
Monitoring and writing to a circular transmit buffer .
CTS (clear to send) and RTS (request to send) control for Z180 Port 0.
Receive and T ransmit Buffers
Serial communication is easier with a background interrupt routine that updates receive and transmit buffers. Every time a port receives a charac­ter, the interrupt routine places it into the receive buf fer. A program can read the data one character at a time or as a string of characters terminated by a special character .
OP7100 Hardware


39
RX
TX
GND
RTS CTS
DTR
RX TX GND RTS CTS
Modem
Side
OP7100 Side
Figure 3-18. Connections Between
Controller and Modem
A program sends data by writing characters into the transmit buf fer. If the serial port is not already transmitting, the write functions will automatically initiate transmission. Once the last character of the buffer is sent, the transmit interrupt is turned off. A high-level application can write data one character at a time or in a string.
CTS/RTS Control
The Z180’s hardware constrains its Port 0 to have the CTS (clear to send) pulled low by the RS-232 device to which it is talking. The OP7100 does not support CTS for the Z180’s Port 1.
Modem Communication
Modems and telephone lines facilitate RS-232 communication across great distances.
The Dynamic C RS-232 library supports communication with a Hayes Smart Modem or compatible. The CTS, RTS and DTR lines of the modem are not used. If the modem used is not truly Hayes Smart Modem compatible, tie the CTS, R TS and DTR lines on the mo­dem side together . The CTS and R TS lines on the controller also have to be tied together . A “NULL-modem” cable is also required for the TX and RX lines. A commercial NULL-mo­dem cable would have its CTS and RTS lines tied together already on both sides.
Figure 3-18 shows the wiring for connections between a modem and the OP7100.
OP710040


Hardware
RS-485 Communication
Figure 3-19 shows the RS-485 sig­nals on header J11.
Developing an RS-485 Network
The 2-wire RS-485 serial-commu­nication port and Dynamic C net­work software are used to develop an RS-485 network.
The OP7100 can be linked together with other Rabbit Semiconductor controllers over a twisted-pair network for up to 1.2 km. When configuring a multidrop network, use single twisted-pair wires to connect RS-485+ to RS­485+ and RS-485- to RS-485- as shown in Figure 3-20.
Figure 3-20. RS-485 Network
485
+
GND
485 GND
4
3
2
1
DCIN (1230 V DC)
5
Figure 3-19. RS-485 Signals
GND
PIN01
PIN02
PIN03
PIN04
PIN05
PIN06
PIN07
PIN08
+5V
PIN09
PIN10
PIN11
PIN12
PIN13
PIN14
PIN15
PIN16
GND
+DC
K
GND
HV01
HV02
HV03
HV04
HV05
HV06
HV07
HV08
HV09
HV10
HV11
HV12
HV13
HV14
485+
485–
PROGRAM
RUN
5
4
3
2
1
CONTRAST
RS232
485
+
GND
n.c.
GND
4
3
2
1
9
8
7
6
232_RX1/CT 232_TX1/RT PWR_DE9
TXA RXA
n.c.
GND
n.c.
DCIN (1230 VDC)
5
CAUTION: High-Voltage Transformer. Only qualified persons may open this case.
S/N:
485
OP7100 Hardware


41
Any Rabbit Semiconductor controller or the OP7100 can be a master or a slave. A network can have up to 255 slaves, but only one master.
A multidrop network requires termination/bias resistors to minimize reflec­tions (echoing) and to keep the network line active during an idle state. The OP7100 termination resistors are already installed, and by default are en­abled by having jumpers installed on header J9. Remove the jumpers from header J9, as shown in Figure 3-21, to disable or remove the termination resistors. Only the first and last devices on a multidrop RS-485 network should have the termination resistors enabled.
Figure 3-21. Enabling/Disabling Termination Resistors
Only a single, solid conductor should be placed in a screw clamp terminal. Bare copper, particularly if exposed to the air for a long period before installation, can become oxidized. The oxide can cause a high-resistance (~20 ) connection, especially if the clamping pressure is not sufficient. To avoid oxidation, use tinned wires or clean, shiny copper wire. If you are using multiple conductors or stranded wire, consider soldering the wire bundle or using a crimp connector to avoid a later loss of contact pressure to a spontaneous rearrangement of the wire bundle. Note that soldering a stranded wire may make the wire subject to fatigue failure at the junction with the solder if there is flexing or vibration.
FD
Termination Resistors
Enabled
Termination Resistors
Disabled
J10
J9
123
4
J9
123
4
J9
OP710042


Hardware
Table 3-2. Z180 Serial Port Registers
Address Name Description
00 CNTLA0 Control Register A, Serial Channel 0 01 CNTLA1 Control Register A, Serial Channel 1 02 CNTLB0 Control Register B, Serial Channel 0 03 CNTLB1 Control Register B, Serial Channel 1 04 STAT0 Status Register, Serial Channel 0 05 STAT1 Status Register, Serial Channel 1 06 TDR0 Transmit Data Register, Serial Channel 0 07 TDR1 Transmit Data Register, Serial Channel 1 08 RDR0 Receive Data Register, Serial Ch annel 0 09 RDR1 Receive Data Register, Serial Ch annel 1
Use of the Serial Ports
If you plan to use the serial ports extensively, or if you intend to use syn­chronous communications, Rabbit Semiconductor recommends that you obtain copies of the following Zilog technical manuals, available from Zilog, Inc, in Campbell, California.
Z180 MPU User’s Manual Z180 SIO Microprocessor Family User’s Manual
Each serial port appears to the CPU as a set of registers. Each port can be accessed directly with the inport and outport library functions using the symbolic constants shown in Table 3-2.
OP7100 Hardware


43
Z180 Serial Ports
The Z180’ s two independent, full-duplex asynchronous serial channels have a separate baud-rate generator for each channel. The baud rate can be divided down from the microprocessor clock, or from an external clock for either or both channels.
The serial ports have a multiprocessor communications feature. When enabled, this feature adds an extra bit to the transmitted character (where the parity bit would normally go). Receiving Z180s can be programmed to ignore all received characters except those with the extra multiprocessing bits enabled. This provides a 1-byte attention message that can be used to wake up a processor without the processor having to intelligently monitor all traffic on a shared communications link.
The block diagram in Figure 3-22 shows Serial Channel 0. Serial Chan­nel 1 is similar, but control lines for /RTS and /DCD do not exist. The five unshaded registers shown in Figure 3-22 are directly accessible as internal registers.
Figure 3-22. Z180 Serial Channel 0
Microprocessor Internal Bus
RDR0 TDR0
TSR0RXA0 TXA0
Shift Register Ou
t
Shift Register In
Baud-Rate
Generator
CKA0
CNTLA0
STAT0
CNTLB0
/RTS0 /CTS0
/DCD0
RSR0
OP710044


Hardware
The serial ports can be polled or interrupt-driven. A polling driver tests the ready flags (TDRE and RDRF) until a ready
condition appears (transmitter data register empty or receiver data register full). If an error condition occurs on receive, the routine must clear the error flags and take appropriate action, if any. If the /CTS line is used for flow control, transmission of data is automatically stopped when /CTS goes high because the TDRE flag is disabled. This prevents the driver from transmitting more characters because it thinks the transmitter is not ready . The transmitter will still function with /CTS high, but exercise care because TDRE is not available to synchronize loading the data register (TDR) properly.
An interrupt-driven port works as follows. The program enables the receiver interrupt as long as it wants to receive characters. The transmitter interrupt is enabled only while characters are waiting in the output buffer . When an interrupt occurs, the interrupt routine must determine the cause: receiver data register full, transmitter data register empty, receiver error , or
/DCD0 pin high (channel 0 only). None of these interrupts is edge-
triggered. Another interrupt will occur immediately if interrupts are re­enabled without disabling the condition causing the interrupt. The signal
/DCD0 is grounded on the OP7100.
Table 3-3 lists the interrupt vectors.
Table 3-3. Serial Port Interrupt Vectors
Address Name Description
0E SER0_VEC Z180 Serial Port 0 (higher priority)
10 SER1_VEC Z180 Serial Port 1
OP7100 Hardware


45
Asynchronous Serial Communication Interface
The Z180 incorporates an asynchronous serial communication interface (ACSI) that supports two independent full-duplex channels.
ASCI Status Registers
A status register for each channel provides information about the state of each channel and allows interrupts to be enabled and disabled.
STAT0 (04H)
76543210
RDRF OVRN PE FE RIE /DCD0 TDRE TIE
R R R R R / W R R R / W
STAT1
(05H)
76543210
RDRF OVRN PE FE RIE CTS1E TDRE TIE
RRRRR / WRRR / W
/DCD0 (Data Carrier Detect)
This bit echoes the state of the /DCD0 input pin for Channel 0. However, when the input to the pin switches from high to low , the data bit switches low only after STAT0 has been read. The receiver is held to reset as long as the input pin is held high. This function is not generally useful because an interrupt is requested as long as /DCD0 is a 1. This forces the program­mer to disable the receiver interrupts to avoid endless interrupts. A better design would cause an interrupt only when the state of the pin changes. This pin is tied to ground in the CM7000.
TIE (T ransmitter Interrupt Enable)
This bit masks the transmitter interrupt. If set to 1, an interrupt is requested whenever TDRE is 1. The interrupt is not edge-triggered. Set this bit to 0 to stop sending. Otherwise, interrupts will be requested continuously as soon as the transmitter data register is empty .
TDRE (T ransmitter Data Register Empty)
A 1 means that the channel is ready to accept another character. A high level on the /CTS pin forces this bit to 0 even though the transmitter is ready.
OP710046


Hardware
CTS1E (CTS Enable, Channel 1)
The signals RXS and CTS1 are multiplexed on the same pin. A 1 stored in this bit makes the pin serve the CTS1 function. A 0 selects the RXS function. (The pin RXS is the CSI/O data receive pin.) When RXS is selected, the CTS line has no effect.
RIE (Receiver Interrupt Enable)
A 1 enables receiver interrupts and 0 disables them. A receiver interrupt is requested under any of the following conditions: /DCD0 (Channel 0 only), RDRF (read data register full), OVRN (overrun), PE (parity error), and FE (framing error). The condition causing the interrupt must be removed be­fore the interrupts are re-enabled, or another interrupt will occur . Reading the receiver data register (RDR) clears the RDRF flag. The EFR bit in CNTLA is used to clear the other error flags.
FE (Framing Error)
A stop bit was missing, indicating scrambled data. This bit is cleared by the EFR bit in CNTLA.
PE (Parity Error)
Parity is tested only if MOD1 in CNTLA is set. This bit is cleared by the EFR bit in CNTLA.
OVRN (Overrun Error)
Overrun occurs when bytes arrive faster than they can be read from the receiver data register. The receiver shift register (RSR) and receiver data register (RDR) are both full. This bit is cleared by the EFR bit in CNTLA.
RDRF (Receiver Data Register Full)
This bit is set when data is transferred from the receiver shift register to the receiver data register . It is set even when one of the error flags is set, in which case defective data is still loaded to RDR. The bit is cleared when the receiver data register is read, when the /DCD0 input pin is high, and by RESET and IOSTOP.
OP7100 Hardware


47
ASCI Control Register A
Control Register A affects various aspects of the asynchronous channel operation.
CNTLA0 (00H)
76543210
MPE RE TE /RTS0
MPBR/
EFR
MOD2 MOD1 MOD0
R / W R / W R / W R / W R / W R / W R / W R / W
CNTLA1 (01H)
76543210
MPE RE TE CKA1D
MPBR/
EFR
MOD2 MOD1 MOD0
R / W R / W R / W R / W R / W R / W R / W R / W
MOD0–MOD2 (Data Format Mode Bits)
MOD0 controls stop bits: 0 1 stop bit, 1 2 stop bits. If 2 stop bits are expected, then 2 stop bits must be supplied.
MOD1 controls parity: 0 parity disabled, 1 parity enabled. (See PEO in ASCI Control Register B for even/odd parity control.)
MOD2 controls data bits: 0 7 data bits, 1 8 data bits.
MPBR/EFR (Multiprocessor Bit Receive/Error Flag Reset)
Reads and writes on this bit are unrelated. Storing a byte when this bit is 0 clears all the error flags (OVRN, FE, PE). Reading this bit obtains the value of the MPB bit for the last read operation when the multiprocessor mode is enabled.
/RTS0 (Request to Send, Channel 0)
Store a 1 in this bit to set the RTS0 line from the Z180 high. This bit is essentially a 1-bit output port without other side effects.
CKA1D (CKA1 Disable)
This bit controls the function assigned to the multiplexed pin (CKA1/ ~TEND0): 1 ~TEND0 (a DMA function) and 0 CKA1 (external clock I/O for Channel 1 serial port).
TE (T ransmitter Enable)
This bit controls the transmitter: 1 transmitter enabled, 0 ⇒ transmitter disabled. When this bit is cleared, the processor aborts the operation in progress, but does not disturb TDR or TDRE.
OP710048


Hardware
RE (Receiver Enable)
This bit controls the receiver: 1 enabled, 0 disabled. When this bit is cleared, the processor aborts the operation in progress, but does not disturb RDRF or the error flags.
MPE (Multiprocessor Enable)
This bit (1 enabled, 0 disabled) controls multiprocessor communica­tion mode which uses an extra bit for selective communication when a number of processors share a common serial bus. This bit has effect only when MP in Control Register B is set to 1. When this bit is 1, only bytes with the MP bit on will be detected. Others are ignored. If this bit is 0, all bytes received are processed. Ignored bytes do not affect the error flags or RDRF.
ASCI Control Register B
Control Register B configures the multiprocessor mode, parity , and baud rate for each channel.
SS (Source/Speed Select)
Coupled with the prescaler (PS) and the divide ratio (DR), the SS bits select the source (internal or external clock) and the baud rate divider, as shown in T able 3-4.
CNTLB0 (02H) and CNTLB1 (03H)
76543210
MPBT MP
/CTS
PS
PEO DR SS2 SS1 SS0
R / W R / W R / W R / W R / W R / W R / W R / W
Table 3-4. Baud Rate Divide Ratios
for Source/Speed Select Bits
SS2 SS1 SS0 Divid e Ratio
000 ÷ 1 001 ÷ 2 010 ÷ 4 011 ÷ 8 100 ÷ 16 101 ÷ 32 110 ÷ 64 1 1 1 external clock*
* May not exceed system clock ÷ 40
OP7100 Hardware


49
Prescaler (
PS
)
÷10
or
÷30
Processor
Clock
Divider
1 2
...
64
Divide Ratio (
DR
)
16
or
64
External
Clock
The prescaler (PS), the divide ratio (DR), and the SS bits form a baud-rate generator, as shown in Figure 3-23.
Figure 3-23. Z180 Baud-Rate Generator
DR (Divide Ratio)
This bit controls one stage of frequency division in the baud-rate generator. If 1 then divide by 64. If 0 then divide by 16. This is the only control bit that affects the external clock frequency.
PEO (Parity Even/Odd)
This bit affects parity: 0 even parity, 1 odd parity. It is effective only if MOD1 is set in CNTLA (parity enabled).
/CTS/PS (Clear to Send/Prescaler)
When read, this bit gives the state of external pin /CTS: 0 ⇒ low, 1 high. When /CTS is high, RDRF is inhibited so that incoming receive characters are ignored. When written, this bit has an entirely different function. If a 0 is written, the baud-rate prescaler is set to divide by 10. If a 1 is written, it is set to divide by 30.
MP (Multiprocessor Mode)
When this bit is set to 1, the multiprocessor mode is enabled. The multi­processor bit (MPB) is included in transmitted data as shown here.
start bit, data bits, MPB, stop bits
The MPB is 1 when MPBT is 1 and 0 when MPBT is 0.
MPBT (Multiprocessor Bit T ransmit)
This bit controls the multiprocessor bit (MPB). When MPB is 1, transmit­ted bytes will get the attention of other units listening only for bytes with MPB set.
OP710050


Hardware
Table 3-5. Baud Rates for ASCI Control Register B
ASCI
B Value
Baud Rate at
9.216 MHz
(bps)
Baud Rate at
18.432 MHz
(bps)
ASCI
B Value
Baud Rate at
9.216 MH z
(bps)
Baud Rate at
18.432 MHz
(bps)
00 57,600 115,200 20 19,200 38,400
01 28,800 57,600 21 9600 19,200 02 or 08 14,400 28,800 22 or 28 4800 9600 03 or 09 7200 14,400 23 or 29 2400 4800
04 or 0A 3600 7200 24 or 2A 1200 2400 05 or 0B 1800 3600 25 or 2B 600 1200 06 or 0C 900 1800 26 or 2C 300 600
0D 450 900 2D 150 300
0E 225 450 2E 75 150
Table 3-5 relates the Z180’s ASCI Control Register B to the baud rate.
OP7100 Software


51
CHAPTER 4: SOFTW ARE
Chapter 4 describes the Dynamic C functions used with the OP7100.
OP710052


Software
Supplied Software
Software drivers for controlling the OP7100 are provided with Dynamic C. Depending on the version of Dynamic C you are using, the OP71L.LIB/
OP71P.LIB or the EZIOOP71.LIB libraries provide drivers specific to the
OP7100. In order to use the OP71L.LIB/OP71P.LIB and other libraries, it is necessary to include the appropriate Dynamic C libraries in your apppli­cation program. These libraries are listed in Table 4-1.
Your application can use these libraries by including them in your pro­gram. To include these libraries, use the #use directive as shown below.
#use op71l.lib or #use op71p.lib
#use op71hw.lib
Choose the corresponding landscape or portrait libraries from Table 4-1 based on your version of Dynamic C and according to whether you will use your OP7100 in a landscape or a portrait orientation.
See the Dynamic C Technical Reference manual for more information on #use and other directives as well as for information on other libraries.
Table 4-1. OP7100 Software Libraries
Library Application
AASCZ0.LIB
Serial communication applications Z180 Serial Po rt 0
AASCZ1.LIB
Serial communication applications Z180 Serial Po rt 1
BIOS.LIB
BIOS routines
DRIVERS.LIB
General drivers
OP71L.LIB OP71P.LIB
Select one of these DC 32 libraries to #use first, corresponding to landscape mode or portrait mode
OP71HW.LIB
DC 32 display hardware functions
EZIOOP71.LIB*
All OP7100 applications
GLCD.LIB*
LCD applications
KP_OP71.LIB
Touchscreen read applications (all DC versions)
LQVGA.LIB*
Landscape image VGA drivers
PQVGA.LIB*
Portrait image VGA drivers
SYS.LIB
General drivers
* Use these libraries with Dynamic C v. 5.xx versions.
OP7100 Software


53
Digital I/O
No specific drivers have been written for the OP7100 digital I/O. The
inport and outport functions in the Dynamic C BIOS.LIB library can
be used to read the inputs and write the outputs. The eight digital inputs (DIN0–DIN7) are bitmapped bits 0 through 7 of the input at 0x4140. Each digital output (OUT0–OUT7) is controlled by bit 0 at 0x4140 through 0x4147.
For example, OUT2 can be turned on using the following statement.
outport( 0x4142,1 );
Likewise, OUT7 can be turned off using the following statement.
outport( 0x4147,0 );
The inport function reads all eight inputs simultaneously, so the bitwise AND operator (&) is useful in checking the status of a particular input. For example, the statement
if( inport(0x4140) & 0x04 )
can be used to check whether DIN2 (whose bit mask is 0x04) is on. Likewise
if( inport(0x4140) & 0x80 )
can be used to check the status of input DIN7. The Dynamic C function IBIT can be used to determine the state of one
input bit. For example, to check DIN2 (which is bit 2 of the inputs), use the statement
if( IBIT(0x4140,2) )
instead of the more complex statement below .
if( inport(0x4140) & 0x04 )
While IBIT works well for the digital inputs, its output equiv­alents, ISET and IRES, will not work with the digital output bits because the output register of the OP7100 is write-only .
ISET and IRES will only operate on output registers whose
current state can be read by the processor.
Refer to the Dynamic C Function Reference manual for more information on the use of these functions.
OP710054


Software
The sample program OP71.C below cycles through through the outputs with one bit high at a time while it displays the state of the digital inputs.
Real-Time Clock (RTC)
The OP7100 has an Epson 72423 chip. The chip stores time and date, and accounts for the number of days in a month, and for leap year . A backup battery will allow the values in the R TC to be preserved if a power failure occurs.
The Dynamic C function library DRIVERS.LIB provides the following R TC functions.
The Dynamic C Function Reference manual describes these functions and the associated data structure tm.
•tm_rd
Reads time and date values from the RTC.
•tm_wr
W rites time and date values into the RTC.
The following points apply when using the R TC.
1. The AM/PM bit is 0 for AM, 1 for PM. The RTC also has a 24-hour mode.
2. Set the year to 96 for 1996, 97 for 1997, and so on.
Constantly reading the RTC in a tight loop will result in a loss of accuracy .
OP71.C
void delay( unsigned wDelay ){
for(;--wDelay;hitwd());
}
void main( void ){
unsigned wAddr; for (;;)
for(wAddr=0x4140;wAddr<0x4148;++wAddr){
outport( wAddr,0x01 ); printf( "%04x%02x\n",wAddr,inport(0x4140) ); delay( 0x8000 ); outport( wAddr,0x00 );
}
}
OP7100 Software


55
Display
Flash EPROM
The WriteFlash function in the Dynamic C DRIVERS.LIB library is used to write data to the program flash EPROM.
int WriteFlash( unsigned long physical_addr, char *buf, int count )
Writes count number of bytes pointed to by buf to the program flash EPROM absolute data location physical
_
adr. Allocate data location
by declaring the byte arrays as initialized arrays or declare an initial­ized xdata array. If byte array is declared, conert logical memory to physical memory with phy
_
adr(array). For initialized xdata, you
can pass the array name directly. PARAMETERS: physical
_
adr is the absolute data location in the
flash EPROM.
*buf is a pointer to the bytes to write. count is the number of bytes to write.
RETURN VALUES:
0 if WriteFlash is okay .
-1 if the program flash EPROM is not in used.
-2 if physical
_
addr is inside the BIOS area.
-3 if physical
_
addr is within the symbol area or the simulated
EEPROM area.
-4 if WriteFlash times out.
The WriteFlash function writes to the program flash EPROM. See the SYS.LIB section later in this chapter for the functions associated with the second flash EPROM.
OP710056


Software
Dynamic C 32 Libraries
When you are using Dynamic C 32, you must first #use op71l.lib or
#use op71p.lib before the #use op71hw.lib line as shown below.
#use op71l.lib or #use op71p.lib
#use op71hw.lib
Call the #use op71p.lib line to use your OP7100 in a portrait orienta­tion, or call the #use op71l.lib line to use your OP7100 in a landscape orientation.
OP71HW.LIB
void op71Init( void );
This call must be used to initialize the OP7100 software and hardware. It also clears the LCD buffer and screen, sets the contrast to 35, turns on the LCD power, and turns on the LCD backlight.
void op71BackLight( int isOn );
Turns the OP7100 backlight on or off. PARAMETER: isOn turns the OP7100 backlight on or off.
1 to turn backlight on 0 to turn backlight off
void op71Power( int isOn );
Turns the OP7100 power on or off. PARAMETER: isOn turns the OP7100 power on or off.
1 to turn power on 0 to turn power off
void op71SetContrast( unsigned level );
Sets the OP7100 contrast level. PARAMETER: level is the contrast level (0–63), visibility increases
with a lower level.
void op71BlankScreen( void );
Blanks (sets to white) the OP7100 screen.
void op71FillScreen( char pattern );
Fills the OP7100 LCD screen with a pattern. The screen will be set to all black if the pattern is 0xFF, all white if the pattern is 0x00, and vertical stripes for any other pattern.
OP7100 Software


57
void op71BrdOff485( void );
Disables the OP7100's RS-485 driver.
void op71BrdOn485( void );
Enables the OP7100's RS-485 driver.
void op71Beep( int onOff );
Controls the OP7100's beeper. PARAMETER: onOff is non-zero to beep, zero to stop beep.
void op71BuffLock( void );
Increments the OP7100 LCD screen locking counter . Graphics calls are recorded in the LCD memory buffer , but are not transferred to the LCD if the counter is non-zero.
op71BuffLock() and op71BuffUnlock() can be nested 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 op71BuffLock and
op71BuffUnlock bracketing a set of related graphics calls speeds up
the rendering significantly .
void op71BuffUnlock( void );
Decrements the OP7100 LCD screen locking counter . The contents of the LCD buffer are transferred to the LCD if the counter goes to zero.
void op71SetBrushType( int type );
Sets the drawing method (or color) of pixels drawn by subsequent graphics calls.
PARAMETER: type can be one of the following:
GL
_
SET or OP71BLACK draws black pixels
GL
_
CLEAR or OP71WHITE draws white pixels
GL
_
XOR or OP71XOR draws “oldPixel xor newPixel” pixels
GL
_
BLOCK or OP71BLACK draws black pixels
int op71GetBrushType( void );
Gets the current method (or color) of pixels drawn by subsequent graphics calls.
RETURN: The current brush type.
OP710058


Software
void op71Left1( int left, int top, int cols, int rows );
Scrolls byte-aligned window left one pixel, right column is filled by current pixel type (color).
PARAMETERS: left is the left edge of the window, must be evenly divisible by 8.
top is the top edge of the window. cols is the number of columns in the window , must be evenly divisible
by 8.
rows is the number of rows in the window.
void op71Right1( int left, int top, int cols, int rows );
Scrolls byte-aligned window right one pixel, left column is filled by current pixel type (color).
PARAMETERS: left is the left edge of the window, must be evenly divisible by 8.
top is the top edge of the window. cols is the number of columns in the window , must be evenly divisible
by 8.
rows is the number of rows in the window.
void op71Up1( int left, int top, int cols, int rows );
Scrolls byte-aligned window up one pixel, bottom column is filled by current pixel type (color).
PARAMETERS: left is the left edge of the window, must be evenly divisible by 8.
top is the top edge of the window. cols is the number of columns in the window , must be evenly divisible
by 8.
rows is the number of rows in the window.
The op71Left1, op71Right1, op71Up1, and op71Down1 function calls may be called multiple times to provide a smoother scrolling effect than provided by the scroll function calls. Do not change the parameters to preserve the window being scrolled.
OP7100 Software


59
void op71Down1( int left, int top, int cols, int rows );
Scrolls byte-aligned window down one pixel, top column is filled by current pixel type (color).
PARAMETERS: left is the left edge of the window, must be evenly divisible by 8.
top is the top edge of the window. cols is the number of columns in the window , must be evenly divisible
by 8.
rows is the number of rows in the window.
void op71HScroll( int left, int top, int cols, int rows, int nPix );
Scrolls byte-aligned window right or left, opposite edge is filled by white pixels.
PARAMETERS: left is the left edge of the window, must be evenly divisible by 8.
top is the top edge of the window. 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 (negative to scroll left).
void op71VScroll( int left, int top, int cols, int rows, int nPix );
Scrolls byte-aligned window up or down, right column is filled by current pixel type (color).
PARAMETERS: left is the left edge of the window, opposite edge is filled by white pixels.
top is the top edge of the window. 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 (negative to scroll up).
OP710060


Software
void op71XPutBitmap( 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. Automatically calls op71XPutFastmap if bitmap is byte­aligned (left-edge and width each evenly divisible by 8).
PARAMETERS: left is the left edge of the bitmap.
top is the top edge 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.
void op71XPutFastmap( 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 is like op71XPutBitmap, except that it is faster . The restriction is that the bitmap must be byte-aligned.
PARAMETERS: left is the left edge of the bitmap.
top is the top edge 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.
void op71XGetBitmap( 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. Automatically calls op71XGetFastmap if the bitmap is byte-aligned (the left edge and width are each evenly divisible by 8).
PARAMETERS: x is the left edge of the bitmap (in pixels).
y is 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 xmem RAM storage address.
Figure 3-8 shows the coordinate system for the LCD pixels.
OP7100 Software


61
void op71XGetFastmap( 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 is like op71XGetBitmap, except that it is faster . The restriction is that the bitmap must be byte-aligned.
PARAMETERS: x is the left edge of the bitmap (in pixels), and must be evenly divisible by 8.
y is the top edge of the bitmap (in pixels). bmWidth is the width of the bitmap (in pixels), and must be evenly
divisible by 8.
bmHeight is the height of the bitmap (in pixels). xBm is the xmem RAM storage address.
void op71PlotDot( int x, int y );
Draws a single pixel in the LCD buffer, and on the LCD if the buffer is unlocked.
PARAMETERS: (x,y) are the coordinates of the dot.
void op71PlotLine( int x0, int y0, int x1, int y1 );
Draws a line in the LCD buffer , and on the LCD if the buf fer is unlocked.
PARAMETERS: (x0,y0) are the (x,y) coordinates of one endpoint. (x1,y1) are the (x,y) coordinates of the other endpoint.
void op71Block( 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.
PARAMETERS: x is the left edge of the pixel.
y is the top edge of the pixel. bmWidth is the width of the block. bmHeight is the height of the block.
OP710062


Software
void op71PlotCircle( int xc, int yc, int rad );
Draws a circle in the LCD page buffer, and on the LCD if the buffer is unlocked.
PARAMETERS: x is the x-coordinate of the center.
y is the y-coordinate of the center . rad is the radius of the circle (in pixels).
void op71FillCircle( int xc, int yc, int rad );
Draws a filled circle in the LCD page buffer , and on the LCD if the buffer is unlocked.
PARAMETERS: x is the x-coordinate of the center.
y is the y-coordinate of the center . rad is the radius of the circle (in pixels).
void op71PlotVPolygon( int n, int *pFirstCoord );
Plots the outline of a polygon in the LCD page buffer , and on the LCD if the buffer is unlocked.
PARAMETERS: n is the number of vertices.
pFirstCoord is a pointer to the array for the vertex with coordinates
(x1,y1), (x2,y2),( x3,y3)...
void op71FillVPolygon( int n, int *pFirstCoord );
Fills a polygon in the LCD page buffer , and on the LCD screen if the buffer is unlocked.
PARAMETERS: n is the number of vertices.
pFirstCoord is a pointer to the array for the vertex with coordinates
(x1,y1), (x2,y2),( x3,y3)...
void op71PlotPolygon( int n, int x1, int y1, int x2, int y2, ... );
Plots the outline of a polygon in the LCD page buffer , and on the LCD if the buffer is unlocked.
PARAMETERS: n is the number of vertices. (x1,y1) are the (x,y) coordinates of the first vertex. (x2,y2) are the (x,y) coordinates of the first vertex...
OP7100 Software


63
void op71FillPolygon( int n, int x1, int y1, int x2, int y2, ... );
Fills a polygon in the LCD page buffer , and on the LCD if the buffer is unlocked.
PARAMETERS: n is the number of vertices. (x1,y1) are the (x,y) coordinates of the first vertex. (x2,y2) are the (x,y) coordinates of the first vertex...
void op71XFontInit( struct _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 is 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 the first printable character in the font (does not
have to be 0).
endChar is the the last printable character in the font. xmemBuffer is a pointer to a linear array of font bitmaps in xmem.
unsigned long op71FontChar( unsigned long font, char letter );
Returns the bitmap address of the character in the font specified. PARAMETERS: font is the font address in xmem.
letter is the ASCII letter code.
RETURN: xmem bitmap address of the character in the font, column major and byte-aligned.
OP710064


Software
void op71PutFont( int x, int y, struct _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.
PARAMETERS: x is the left edge (in pixels).
y is the top edge (in pixels). pInfo is a pointer to the font descriptor. code is the code (character) to display.
int op71GetPfStep( void );
Gets the current op71Printf 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 on the height and width of the font being displayed, which are multiplied by the step values.
Use op71SetPfStep to control the x and y printing step direction. RETURN: The x step is returned in the MSB, and the y step is
returned in the LSB of the integer result.
void op71SetPfStep( int stepX, int stepY );
Sets the op71Printf printing step direction. The x and y step direc­tions are independent signed values. The actual step increments depend on the height and width of the font being displayed, which are multi­plied by the step values.
Use op71GetPfStep to examine the current x and y printing step direction.
PARAMETERS: stepX is the op71Printf x step.
stepY is the op71Printf y step.
OP7100 Software


65
void op71Printf( int x, int y, struct _fontInfo *pInfo, char *fmt, ... );
Prints a formatted string (much like printf) on the LCD screen. Only character codes that exist in the font are printed, others are skipped over . For example, '\b', '\t', '\n', and '\r' (ASCII backspace, tab, new line and carriage return, respectively) print if they exist in the font, but have no effect as control characters.
Use op71SetPfStep to control or use op71GetPfStep to examine the current x and y printing step direction.
PARAMETERS: x is the x-coordinate of the text (left edge).
y is the y-coordinate of the text (top edge). pInfo is a pointer to the font descriptor. fmt is a pointer to the format string...
Keypad Programming
The same library used in Dynamic C v . 5.xx, KP
_
OP71.LIB, is used with
Dynamic C 32. The function calls are described later in this chapter.
OP710066


Software
Using Dynamic C v. 5.xx
EZIOOP71.LIB
void op71BackLight( int onOff )
Turns the backlight of the OP7100 on or off. PARAMETER: onOff is non-zero to turn the backlight on, zero to
turn the backlight off.
void op71SetContrast( unsigned contrast )
Controls the contrast of the LCD. PARAMETER: contrast values range from 0 to 127, 0 for the least
contrast (minimum VEE), 127 for the most contrast (maximum VEE).
void eioBeep( int onOff )
Turns the buzzer on or off. PARAMETER: onOff is non-zero to turn the buzzer on, zero to turn
the buzzer off.
GLCD.LIB
void glFontInit( struct _fontInfo *pInfo, char pixWidth, char pixHeight, unsigned startChar, unsigned endChar, char *bitmapBuffer )
Initializes a font descriptor with the bitmap defined in the root memory. For fonts with bitmaps defined in xmem, use glXFontInit.
PARAMETERS: pInfo is a pointer to the font descriptor to be initialized.
pixWidth is the width of each font item (pixWidth must be uniform
for all items).
pixHeight is the height of each font item (pixHeight must be
uniform for all items).
startChar is the offset to the first useable item (useful for fonts for
ASCII or other fonts with an offset).
endChar is the index of the last useable font item. bitmapBuffer is a pointer to a linear array of the font bitmap. The
bitmap is a column with the major byte aligned.
OP7100 Software


67
glXFontInit( struct _fontInfo *pInfo, char pixWidth, char pixHeight, unsigned startChar, unsigned endChar, unsigned long xmemBuffer )
Initializes a font descriptor that has the bitmap defined in xmem. For bitmaps defined in root memory, use glFontInit.
PARAMETERS: pInfo is a pointer to the font descriptor to be initialized.
pixWidth is the width of each font item (pixWidth must be uniform
for all items).
pixHeight is the height of each font item (pixHeight must be
uniform for all items).
startChar is the offset to the first useable item (useful for fonts for
ASCII or other fonts with an offset).
endChar is the index of the last useable font item. xmemBuffer is a pointer to a linear array of the font bitmap. The
bitmap is a column with the major byte aligned.
void glSetBrushType( int type )
Sets the type of brush type and controls how pixels are drawn on the screen until the next call to glSetBrushType.
PARAMETER: type is the type of the brush. The four macros described below have been defined for valid values to pass to the function.
All four brush types can be used to display text or bitmaps. Do not use GL
_
BLOCK for glPlot or glFill graphics primitive
functions.
Macro Description Effect
GL_SET
Pixels specified by subsequent gl functions will turn on the LCD pixels
LCDPi x = LCDPix | newPix
GL_CLEAR
Pixels specified by subsequent gl functions will turn off the LCD pixels
LCDPi x = LCDPi x & ~newPix
GL_XOR
Pixels specified by subsequent gl functions will toggle the LCD pixels
LCDPi x = LCDPix ^ newPix
GL_BLOCK
Pixels specified by subsequent gl functions will be displayed on the LCD as is
LCDPix = newPix
OP710068


Software
int glInit()
Initializes the LCD module (software and hardware). RETURN VALUE: the status of the LCD. If the initialization was
successful, this function returns 0. Otherwise, the returned value indicates the LCD status.
int glPlotDot( int x, int y )
Plots one pixel on the screen at coordinate (x,y). PARAMETERS: x is the x coordinate of the pixel to be drawn.
y is the y coordinate of the pixel to be drawn.
RETURN VALUE: Status of the LCD after the operation.
void glPlotLine( int x1, int y1, int x2, int y2 )
Plots a line on the LCD. PARAMETERS: x1 is the x coordinate of the first endpoint.
y1 is the y coordinate of the first endpoint. x2 is the x coordinate of the second endpoint. y2 is the y coordinate of the second endpoint.
void glPrintf( int x, int y, struct _fontInfo *pInfo, char *fmt,... )
Prints a formatted string (much like printf) on the LCD screen. PARAMETERS: x is the x coordinate of the text (left edge).
y is the y coordinate of the text (top-edge). *pInfo is the pointer to the font descriptor used for printing on the
LCD screen.
*fmt is the pointer to the format string
void glPlotCircle( int xc, int yc, int rad )
Draws a circle on the LCD. PARAMETERS: xc is the x coordinate of the center.
yc is the y coordinate of the center . rad is the radius of the circle.
void glFillCircle( int xc, int yc, int rad )
Draws a filled-in circle on the LCD. PARAMETERS: xc is the x coordinate of the center.
yc is the y coordinate of the center . rad is the radius of the circle.
OP7100 Software


69
void glPlotVPolygon( int n, int *pFirstCoord )
Plots a filled-in polygon. PARAMETERS: n is the number of vertices.
*pFirstCoord is an array of vertex coordinates (x
1,y1
), (x2,y2), …
void glPlotPolygon( int n, int x1, int y1, int x2, int y2,... )
Plots the outline of a polygon. 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.
void glFillVPolygon( int n, int *pFirstCoord )
Fills in a polygon. PARAMETERS: n is the number of vertices.
*pFirstCoord is an array of vertex coordinates (x
1,y1
), (x2,y2), …
void glFillPolygon( int n, int x1, int y1, int x2, int y2,... )
Fllls in a polygon. 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.
void glPutBitmap( int x, int y, int bmWidth, int bmHeight, char *bm )
Displays a bitmap stored in root memory on the LCD. For bitmaps defined in xmem memory, use glXPutBitmap.
PARAMETERS: x is the x coordinate of the bitmap left edge.
y is the y coordinate of the bitmap top edge. bmWidth is the width of the bitmap. bmHeight is the height of the bitmap. bm is a pointer to the bitmap. The bitmap format is a column with the
major byte aligned for each column.
OP710070


Software
void glXPutBitmap( int x, int y, int bmWidth, int bmHeight, unsigned long bmPtr )
Displays a bitmap stored in xmem on the LCD. For bitmaps stored in root memory , use glPutBitmap.
PARAMETERS: x is the x coordinate of the bitmap left edge.
y is the y coordinate of the bitmap top edge. bmWidth is the width of the bitmap. bmHeight is the height of the bitmap. bmPtr is a pointer to the bitmap. The bitmap format is a column with
the major byte aligned for each column.
KP_OP71.LIB
void kpInit( int (*changeFn)() )
Initializes the kp module. Call this function before calling other functions in this library . If the default keypad scanning routine will be used, use kpDefInit instead of this function.
PARAMETER: changeFn is a pointer to a function that will be called when the driver detects a change (when kpScanState is called). Two arguments are passed to the callback function. The first ar gument is a pointer to an array that indicates the current state of the keypad. The second is a pointer to an array that indicates what keypad positions are changed and detected by kpScanState. The byte offset in the array represents the line pulled high (row number), and the bits in a byte represents the positions (column number) read back.
int kpScanState()
Scans the keypad and detects any changes to the keypad status. If
kpInit is called with a non-NULL function pointer, that function will
be called with the state of the keypad. This function should be called periodically to scan for keypad activities.
RETURN VALUE: 0 if there is no change to the keypad, non-zero if there is any change to the keypad.
OP7100 Software


71
int kpDefStChgFn( char *curState, char *changed )
This is the default state change function for the default get key function
kpDefGetKey. This function is called back by kpScanState when
there is a change in the keypad state. If the current key is not read by
kpDefGetKey, the new key pressed will not be registered.
PARAMETERS: curState points to an array that reflects the current state of the keypad (bitmapped, 1 indicates key is not currently pressed).
changed points to an array that reflects the CHANGE of keypad state
from the previous scan. (bitmapped, 1 indicates there was a change). RETURN VALUE: -1 if no key is pressed. Otherwise kpScanState
returns the normalized key number . The normalized key number is
8*row+col+edge*256. edge is 1 if the key is released, and 0 if the
key is pressed.
int kpDefGetKey()
This is the default get key function. It returns the key previously pressed (i.e., from the one-keypress buffer). The key pressed is actually interpreted by kpDefStChgFn, which is called back by kpScanState.
kpDefInit should be used to initialize the module.
RETURN VALUE: -1 if no key is pressed. Otherwise, kpDefGetKey returns the normalized key number . The normalized key number is
8*row+col+edge*256. edge is 1 if the key is released, and 0 if the
key is pressed.
void kpDefInit()
Initializes the library to use the default state change function to inter­pret key presses when kpScanState is called. Use kpDefGetKey to get the code of the last key pressed.
OP710072


Software
SYS.LIB
int sysChk2ndFlash( struct _flashInfo *pInfo )
Checks for the existence and configuration of the second flash EPROM mapped to memory space.
PARAMETER: pInfo is a pointer to struct
_
flashInfo, which
stores the configuration of the flash. RETURN VALUE: 0 is returned if the second flash EPROM exists
and the configuration is valid; otherwise, a negative number is returned.
void sysRoot2FXmem( struct _flashInfo *pInfo, void *src, unsigned long int dest, unsigned integer len )
Copies memory content from the root memory space to the second flash EPROM mapped to memory space.
PARAMETERS: pInfo is a pointer to struct
_
flashInfo
(initialized by sysChk2ndFlash).
src points to the beginning of the block in root memory to be copied
to the second flash EPROM.
dest (a physical address) points to the beginning of the block in the
second flash EPROM mapped to memory space.
len is the length of the block to be copied.
OP7100 Software


73
Upgrading Dynamic C
Dynamic C patches that focus on bug fixes are available from time to time. Check the Web site
www.rabbit.com/support/downloads/ for the latest patches, workarounds, and bug fixes. You may need to download upgraded libraries to run an OP7100 purchased
after June, 2006. When downloading the libraries from the Web site, click on the product-
specific links until you reach the links for the OP7100 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 .
New LCD Controller Chip
OP7100 units sold after June, 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 OP7100 are backward-compatible for use with the old LCD controller chip.
If you are using a program developed for the now-obsolete LCD controller chip, you will need to replace either the existing Dynamic C OP71L.LIB,
OP71P.LIB, and OP71HW.LIB libraries or the LQVGA.LIB and PQVGA.LIB
libraries in your Dynamic C installation — you only have to replace one of these two sets of libraries, depending on which set you used when you created your original application. You may , of course, replace all five libraries, which will allow you to access the other updated set at a later date.
Unzip the contents of the compressed file you opened or downloaded into a non-Dynamic C folder to see the updated library files. If you customized any of these libraries, you should first make backup copies of the libraries you customized. Then customize the new libraries, if needed. Now copy and paste the new libraries to replace the old versions in the LIB folder in your Dynamic C installation. You will have to recompile your program once you have replaced the libraries.
The changes to the libraries will improve the OP7100 screen update time for OP7100 units using the new LCD controller chip. Otherwise, the form, fit, and function of the OP7100 are not affected by the changes.
For applications that are operating in the landscape mode using the new
OP71L.LIB library , there is a macro that can be defined to enhance the LCD
performance for older OP7100s using the original LCD controller chip. Add the following macro at the start of your program before the graphic libraries are #used. Using the macro may increase your interrupt latency.
#define LCD_ENHANCED_MODE
OP710074


Software
OP7100 Graphics Programming


75
CHAPTER 5: GRAPHICS PROGRAMMING
Chapter 5 provides helpful guidelines for drawing graphics on the OP7100.
OP710076


Graphics Programming
Initialization
The OP7100, unlike most other Rabbit Semiconductor controllers, uses the maximum I/O and memory wait states when main() gets control. The wait states can be reduced to improve performance. The following statement sets up the proper wait states for the standard OP7100 (using a 90 ns flash memory).
outport(DCNTL,(inport(DCNTL)&0xf)|0x60);
The graphic LCD can be set up by a simple function call to
op71Init();
This function initializes and starts the LCD controller before supplying voltage to the LCD screen.
The backlight is controlled by op71BackLight(int isOn). Pass zero to turn off the backlight (default) or a non-zero value to turn on the backlight.
If you have an OP7100 equipped with software contrast control, call
op71SetContrast(unsigned level) to change contrast. The range
of level is from 0 to 63. A level of 30 usually yields reasonable contrast at room temperature.
Drawing Primitives
You can draw various objects on the LCD. Before doing any drawing, specify the type of the "brush" by calling op71SetBrushType(int
type)
. Four brush macros are supported:
GL
_
SET sets the pixels as specified by the plot commands, but leaves
other pixels alone;
GL
_
CLEAR clears the pixels as specified by the plot commands, but
leaves other pixels alone;
GL
_
XOR toggles the pixels as specified by the plot command, but
leaves other pixels alone;
GL
_
BLOCK forces the value of pixels in groups of eight vertical
pixels. GL
_
BLOCK is useful when speed is important, the current
pixels need to be overwritten, and the overwriting pixels are aligned in eight-pixel rows.
Plot a Pixel
int op71PlotDot(int x, int y);
x and y are the coordinates, the upper left corner is (0,0).
Figure 3-8 shows the coordinate system for the LCD pixels.
OP7100 Graphics Programming


77
Plot a Line
void op71PlotLine(int x1, int y1, int x2, int y2);
(x1,y1) and (x2,y2) are the endpoints of the line.
Plot a Circle
void op71PlotCircle(int xc, int yc, int rad);
(xc,yc) is the center of the circle, rad is the radius.
Plot a Polygon
void op71PlotPolygon(int n, int x1, int y1,...);
n is the number of vertices, (x1,y1) is the first vertex, followed by the
other vertices in the x-first order .
Fill a Circle
void op71FillCircle(int xc, int yc, int rad);
Similar to op71PlotCircle, but paints the circle solid.
Fill a Polygon
void op71FillPolygon(int n, int x1, int y1,...);
Similar to op71PlotPolygon, but paints the polygon solid. Note that this function works for polygons with concave angles.
Draw a Bitmap
void op71XPutBitmap( 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. Automatically calls op71XPutFastmap if bitmap is byte­aligned (left-edge and width each evenly divisible by 8).
PARAMETERS: left is the left edge of the bitmap.
top is the top edge 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.
OP710078


Graphics Programming
Font and Bitmap Conversion
Customers are encouraged to design their own fonts and bitmaps. These restrictions must be followed.
Save bitmaps as Windows bitmaps ( .bmp), not OS/2 bitmaps.
The bitmap can only have two colors. Color 0 is the background, and color 1 is the foreground. This is the reverse of most bitmap editors.
Fonts must be bitmapped (not true type) and must be of fixed pitch.
Save font files as .fnt (version 3).
The OP7100 uses a "vertical stripe" display logic format. The conversion utility programs fntstrip.exe (landscape image) and fntcvtr.exe (portrait image) convert the .fnt and .bmp file format to the Rabbit Semiconductor vertical stripe format.
Follow these instructions to use these utilities.
1. Create the .fnt or .bmp file that conforms to the restrictions listed above.
2. Start fntstrip or fntcvtr.
3. Specify the file to convert (select the file from the menu List files of
type
), and choose either .fnt or .bmp.
Entering *.fnt or *.bmp in the File name window will not work. The file must be selected after clicking on Font files or
Bitmap files in the List files of type window .
4. Click the OK button or double-click on the file to convert. At this point, the software asks the destination of the conversion. Specify a file to store the result (text file) of the conversion. Click OK when the file is specified.
5. The title bar displays "[inactive]" when the conversion is done. Close the window .
Dynamic C may be used to edit the text file that was generated. The generated file typically looks as follows.
/*Automatic output from Font Converter font file is U:\TEST\DC5X\SAMPLES\QVGA\6X8.OUT. dfVersion = 0x300 dfSize = 5148 dfCopyright = (c) Copyright 1997,1998 Rabbit Semi-
conductor. All rights reserved. dfType = 0x0 horizontal size is 6 pixels. vertical size is 8 pixels. first character is for code 0x20.
Tip
OP7100 Graphics Programming


79
last character is for code 0xff. make call to glFontInit(&fi, 6, 8, 32, 127, fontBitMap) to initialize table*/
char fontBitMap[] = { /* char 0x20 of width 6 at 0x5da */ '\x0', '\x0', '\x0', '\x0', '\x0', '\x0', ... '\x0' };
The first task is to rename the array so that it is unique. Then you can decide whether the font/bitmap should be stored in root memory or in extended memory . Because bitmaps can be large and root memory space is precious, Rabbit Semiconductor recommends you to use xmem to store the font/bitmap. To store the font/bitmap in xmem, you need to change the following line.
char fontBitMap[] = {
to
xdata fontBitMap {
Once these changes are made, you can copy and paste the font (as an initialized character array or as an initialized xdata item) into your program or library.
Remember to #use either the OP71L.LIB (landscape image) or the OP71P.LIB (portrait image) library in your program.
Using the Font/Bitmap In Your Program
The array does not store the dimensions of the font or the bitmap. This information is contained in the comments. The following lines in the comments indicate the dimensions of the font.
/*horizontal size is 6 pixels. vertical size is 8 pixels.*/
For fonts, the comments also indicate the starting character and the ending character code with the following line.
/*make call to op71XFontInit(&fi, 6, 8, 32, 127,
fontBitMap)*/
The fourth argument is the first character code mapped to the font and the fifth argument is the last character code mapped to the font.
OP710080


Graphics Programming
To initialize a font information structure (of type struct
_
fontInfo),
you can call op71XFontInit for a font stored in xmem. To display a bitmap, call op71XPutBitmap to display a bitmap stored in
xmem.
Printing Text
Printing text involves setting the font information structures. Call
void op71XFontInit(struct _fontInfo *pInfo,
char pixWidth, char pixHeight, unsigned startChar, unsigned endChar, unsigned long xmemBuffer);
to initialize a font information structure if the font is stored in xmem.
pInfo points to a font information structure, pixWidth is the width of
each character (fixed pitch), pixHeight is the height of each character,
startChar is the ASCII code of the first character in the font, endChar is
the ASCII code of the last character in the font, and xmemBuffer is a physical address pointing to the font table stored in xmem.
Rabbit Semiconductor supplies five font sizes for the OP7100. The smallest font, engFont6x8, compiles to xmem, and each character is 6 pixels wide by 8 pixels high. The largest font, engFont17x35, also compiles to xmem, and each character is 17 pixels wide by 35 pixels high.
When you need to print text to the LCD, call
void op71Printf(int x, int y,
struct _fontInfo *pInfo, char *fmt,...);
where (x,y) is the upper left corner of the text, pInfo points to a font information structure, fmt points to a format string (much like printf), and the rest of the parameters specify what to print for each field in the format string (same as printf).
OP7100 Graphics Programming


81
Keypad Programming
The sample program KPDEFLT.C in the Dynamic C SAMPLES\QVGA subdi­rectory demonstrates how to read the keypad. Add the following directives at the top of the program to make it possible to use the keypad routines.
#use op71l.lib (landscape orientation) OR #use op71p.lib (portrait orientation)
#use op71hw.lib
#use kp_op71.lib
Initialization
To initialize the keypad driver, call kpDefInit(). This must be per­formed before other keypad operations.
Scanning the Keypad
The function kpScanState() must be called periodically to scan the keypad for changes. In a cooperative multitasking (big-loop style), this function should be called every 25 ms or so. If you are using a real-time kernel, you can also attach this function to one of the tasks and have it invoked approximately every 25 ms. Note that this function scans for changes, but it does not report what was changed.
Reading Keypad Activities
The function kpDefGetKey() returns the interpretation of the state change detected by kpScanState() into key activities. The means that the kpDefGetKey() function must be called no less frequently than
kpScanState() to ensure no key activity is lost. The function kpDefGetKey() returns an integer. If the integer is –1, no key activity
was detected. Otherwise, bit 0 to bit 3 indicates the index of the sense line of the key, and bit 4 to bit 7 indicate the index of the drive line of the key. Bit 8 indicates whether the key has been "pressed"—the key was pressed if bit 8 is a 1.
Note that if two key activities occur between two calls to kpScanState(), only one key activity is interpreted by the kpDefGetKey() function even though both activities may be registered by the kpScanState() function. The priority of key interpretation is from drive line 0 (highest priority) to drive line 7. On the same drive line, the priority is from sense line 0 (highest priority) to sense line 7.
Once a key activity is detected by kpScanState(), no further key activities will be detected by further calls to kpScanState() unless
kpDefGetKey() is called.
OP710082


Graphics Programming
OP7100 Installation


83
CHAPTER 6: INST ALLATION
Chapter 6 provides installation and protective grounding guidelines for the OP7100.
OP710084


Installation
Grounding
Many of the OP7100 ICs are sensitive to static. Use extra caution when handling units in high-static areas.
T o meet electromagnetic compatibility requirements, and in particular to prevent misoperation or damage from electrostatic discharges, the bezel must be connected to a protective ground via a low-impedance path.
A protective building ground is recommended once the OP7100 is installed at the location where it will be used. In addition to providing protection against an unexpected electric shock, the connection to building ground also mitigates any problems from external electrostatic discharges and transients, and dampens any RF emissions.
The metal casing is already connected electrically to the bezel, and so does not require a separate ground connection. The connection to the building ground should always be made through the bezel.
The recommended way to connect an OP7100 to a building ground is to mount the unit in a metal panel that is already grounded. Ensure that the areas around the securing nuts are clean and free from corrosion or other contaminants so that a good electrical connection can be realized.
Alternatively, use a wire with a size of at least 20AWG (0.5 mm2), prefer­ably stranded, to establish a connection between one of the bezel mounting studs and the protective building ground. This wire should be as short as possible to keep its impedance low.
There is an electrical connection between the OP7100 bezel/casing and the connection marked GND on the power supply header, J11, via a jumper on header JP5. This connection is also the return for the DC power supply and the I/O signals, and should not be relied on for a protective ground connection.
Remove the jumper across JP5 if you wish to isolate the OP7100 bezel/ casing ground from the power supply ground. Any common-mode voltage between signal ground and protective ground should be kept below 40 V DC.
OP7100 Installation


85
FD
JP5
12
0 V/GND
FGND
JP5
12
0 V/GND
FGND
Bezel/Casing to Power Supply GND
Bezel/Casing to External Ground
External Ground
External Ground
JP4
JP5
JP3
Figure 6-1 shows the location of header JP5.
Figure 6-1. Location of Header JP5
Installation Guidelines
When possible, following these guidelines when mounting an OP7100.
1. Leave sufficient ventilation space
2. Do not install the OP7100 directly above machinery that radiates a lot of heat (for example, heaters, transformers, and high-power resistors).
3. Leave at least 8" (20 cm) distance from electric power lines and even more from high-voltage devices.
4. When installing the OP7100 near devices with strong electrical or magnetic fields (such as solenoids), allow a least 3" (8 cm), more if necessary.
The OP7100 has strong environmental resistance and high reliability , but you can maximize system reliability by avoiding or eliminating the following conditions at the installation site.
Abrupt temperature changes and condensation
Ambient temperatures exceeding a range of 0°C to 50°C
Relative humidity exceeding a range of 25% to 65%
Strong magnetism or high voltage
Corrosive gasses
Direct vibration or shock
Excessive iron dust or salt
Spray from harsh chemicals
OP710086


Installation
Mounting
A bezel and a gasket are included with the OP7100. When properly mount­ed in a panel, the bezel of the OP7100 is designed to meet NEMA 4 speci­fications for water resistance.
Since the OP7100 employs an LCD display , the viewing angle must be considered when mounting the display . Install the OP7100 at a height and angle that makes it easy for the operator to see the screen.
Note that the contrast controls, both manual and software, act as view-angle controls, and should be adjusted to provide theoptimum display quality at the angle from which the display will normally be viewed.
Bezel-Mount Installation
This section describes and illustrates how to bezel-mount the OP7100. Follow these steps for bezel-mount installation.
1. Cut mounting holes in the mounting panel in accordance with the recommended dimensions in Figure 6-2, then use the bezel faceplate to mount the OP7100 onto the panel.
Figure 6-2. Recommended Cutout Dimensions
2. Remove all eight 4-40 locking hex nuts from their studs on the bezel, and carefully “drop in” the OP7100 with the bezel and gasket attached.
4.600
(117)
7.000
(178)
3.500
(89)
5.380
(137)
0
.180
(4.5)
1.620
(40)
0.125 D, 8x
(3)
1.100
(28)
CUTOUT
0.150
(3.8)
OP7100 Installation


87
3. Fasten the unit with the eight 4-40 hex nuts that were removed in Step 2. Carefully tighten the nuts equally until the gasket is compressed to approximately 75% of its uncompressed thickness of 0.125" (3.2 mm).
Do not tighten each nut fully before moving on to the next nut since this risks distorting either the panel or the bezel (or both). Apply only one or two turns to each nut in sequence until all are tightened to the required amount.
In order to seal the bezel against the panel, the gasket must be compressed by the pressure of the mounting nuts. If the panel is very thin (<0.06" or 1.6 mm), this pressure may distort the panel, allowing water ingress. In this case, Rabbit Semicon­ductor recommends using strengthening brackets between the rear of the panel and the mounting nuts as shown in Figure 6-3.
Figure 6-3. Strengthening Bracket
General Mounting Recommendations
If the OP7100 is mounted inside a panel, the enclosure must not be airtight to ensure that the touchscreen will not distorted by differences in air pressure. If the OP7100 is mounted in a completely airtight enclosure, a pressure differential may build up across the window overlay, and could adversely affect the operation of the touchscreen.
Tip
OP7100 Bezel/Gasket
5
4
3
2
1
CONTRAST
RS232
485
+
GND
n.c.
485 GND
4
3
2
1
9
8
7
6
232_RX1/ CT 232_TX1/ RT PWR_DE9
TXA RXA
n.c.
GND
n.c.
DCIN (1230 VDC)
5
CAUTION: High-Voltage Transformer. Only qualified persons may open this case.
S/N:
Bracket
Panel
OP710088


Installation
OP7100 Troubleshooting


89
APPENDIX A: TROUBLESHOOTING
Appendix A provides procedures for troubleshooting system hardware and software. The sections include the following topics.
Out of the Box
Dynamic C W ill Not S tart
Dynamic C Loses Serial Link
OP7100 Repeatedly Resets
Common Programming Errors
OP710090


Troubleshooting
Out of the Box
Check the items mentioned in this section before starting development.
Verify that the OP7100 runs in standalone mode before connecting any devices.
Verify that the entire host system has good, low-impedance, separate grounds for analog and digital signals. The OP7100 might be connected between the host PC and another device. Any differences in ground potential from unit to unit can cause serious problems that are hard to diagnose.
Do not connect analog ground to digital ground anywhere.
Double-check the connecting ribbon cables to ensure that all wires go to the correct screw terminals on the OP7100.
Verify that the host PC’s COM port works by connecting a good serial device to the COM port. Remember that COM1/COM3 and COM2/ COM4 share interrupts on a PC. User shells and mouse drivers, in particular, often interfere with proper COM port operation. For example, a mouse running on COM1 can preclude running Dynamic C on COM3.
Use the supplied Rabbit Semiconductor power supply. If another power supply must be used, verify that it has enough capacity and filtering to support the OP7100.
Use the supplied Rabbit Semiconductor cables. The most common fault of user-made cables is failure to properly assert CTS. Without CTS being asserted, theOP7100’s RS-232 port will not transmit. Assert CTS by either connecting the R TS signal of the PC’s COM port or looping back the OP7100’s RTS.
Experiment with each peripheral device connected to the OP7100 to determine how it appears to the OP7100 when powered up, powered down, and/or when its connecting wiring is open or shorted.
The frame ground and 0 V are connected internally via a jumper on header JP5. Remove the jumper if this connection causes problems or is otherwise not required.
OP7100 Troubleshooting


91
Dynamic C Will Not St art
In most situations, when Dynamic C will not start, an error message announcing a communication failure will be displayed. The following list describes situations causing an error message and possible resolutions.
Wrong Communication Mode — Both sides must be talking RS-232.
Wrong COM Port — A PC generally has two serial ports, COM1 and COM2. Specify the one being used in the Dynamic C “Target Setup” menu. Use trial and error, if necessary.
Wrong Operating Mode — Communication with Dynamic C will be lost when the OP7100 is configured for standalone operation. Make sure pins 1–2 on header J4 are connected to reconfigure the board for programming mode as described in Chapter 2, “Getting Started.”
If all else fails, connect the serial cable to the OP7100 after power up. If the PC’s RS-232 port supplies a large current (most commonly on portable and industrial PCs), some RS-232 level converter ICs go into a nonde­structive latch-up. Connect the RS-232 cable after power up to eliminate this problem.
Dynamic C Loses Serial Link
If the application disables interrupts for a period greater than 50 ms, Dynamic C will lose its serial link with the application. Make sure that interrupts are not disabled for a period greater than 50 ms.
OP7100 Repeatedly Resets
The OP7100 resets every 1.0 second if the watchdog timer is not “hit.” If a program does not “hit” the watchdog timer, then the program will have trouble running in standalone mode. To “hit” the watchdog, make a call to the Dynamic C library function hitwd.
OP710092


Troubleshooting
Common Programming Errors
Values for constants or variables out of range. T able A-1 lists accept­able ranges for variables and constants.
Mismatched “types.” For example, the literal constant 3293 is of type
int (16-bit integer). However, the literal constant 3293.0 is of type float. Although Dynamic C can handle some type mismatches,
avoiding type mismatches is the best practice.
Counting up from, or down to, one instead of zero. In software, ordinal series often begin or terminate with zero, not one.
Confusing a function’s definition with an instance of its use in a listing.
Not ending statements with semicolons.
Not inserting commas as required in functions’ parameter lists.
Leaving out ASCII space character between characters forming a different legal—but unwanted—operator .
Confusing similar-looking operators such as && with &, == with =, and // with /.
Inadvertently inserting ASCII nonprinting characters into a source-code file.
Table A-1. Ranges of Dynamic C
Function Types
Type Range
int
–32,768 (–2
15
) to
+32,767 (2
15
– 1)
long int
2,147,483,648 (−2
31
) to
+2147483647 (2
31
– 1)
float
1.18 × 10
-38
to
3.40 × 10
38
char
0 to 255
OP7100 Specifications


93
APPENDIX B: SPECIFICATIONS
Appendix B provides comprehensive physical, electronic, and environ­mental specifications for the OP7100.
OP710094


Specifications
Electrical and Mechanical Specifications
LCD Dimensions
Figure B-1. OP7100 LCD Dimensions
Bezel Dimensions
Figure B-2. OP7100 Bezel Dimensions
0.250 (6.4)
0.712 (18.1)
0.909 (23.1)
1.500 (3 8.1)
0.13 (3.2)
LCD aperture is 122 x 92 mm
Pixel matrix (320 x 240) is 115.17 x 86.37 mm
8.00
(203)
4-40-8 screws, 8x
4-40-4 screws, 4x
1.619 typ
(41)
7.3 6
(187)
2.120 typ
(54)
1.244
(31.6)
4.763
(121)
3.76
(96)
5.984
(152)
0.125R, typ
(3.18)
~0.39 (10)
2.400
(61)
3.583
(91)
3.976
(101)
4.900
(124)
5.400
(137)
0.125R typ.
(3.18)
0.320 typ
(8 .1)
6.299
(160)
0.433
(11.0)
6.579
(167)
4.291
(109)
0.157 typ
(4)
0.335
(8.5)
320 x 240 pixel matrix 115.17 mm x 86.37 mm (4.534" x3.400")
0.256
(6.5)
0.433 max
(11)
3.976
(101)
3.622
(92)
4.803
(122)
5.551
(141)
5.984
(152)
0.984
(25)
0.157 typ
(4.0)
OP7100 Specifications


95
General Specifications
T able B-1 presents the physical, electronic and environmental specifications.
Table B-1. OP7100 General Specifications
Parameter Specification
Module Size
6.63" × 4.40" × 1.36" (168 mm × 112 mm × 35 mm)
Bezel Size
8.00" × 5.4" × 0.156" (203 mm × 137 mm × 4.0 mm)
with gasket
Package Size 8.0" × 5.4" × 1.6" (203 mm × 137 mm × 41 mm)
Backlight
Replaceable dual co ld-cathode fluorescent tube rated at 20,000 h to 30,000 h with software on/off control
LCD
STN, 320 × 240 pixels, blue on white background. Pixel matrix is 115.2 mm × 86.4 mm, 0.36 mm pitch. Viewing area is 121 mm × 91 mm. Adjust­able contrast with temperatur e compensation.
Touchscreen
8 × 8 matrix, 225 touch switches with software in­terpolation to 15 × 15, rated 10
6
contacts Operating Temperature 0°C to 50°C, may be stored at –20°C to 70°C Humidity 5% to 95%, noncon de nsing
Power
12 V to 30 V DC, 4.5 W with backlight on,
1.5 W with backlight off
Digital I/O
Eight C MOS/TTL-level inputs, –2.0 V to +7.0 V Eight CMOS/TTL-level outputs , up to 6 mA per
channel Processor Z180 at 18.432 MHz SRAM 128K standard, up to 512K VRAM 32K standard, up to 64K EEPROM Simulated in flash EPROM Flash EPROM Two 256K
Serial Ports
One 5-wire RS-232 and one RS-485, on e 3-wire
RS-232 and one RS-485, or two 3-wire RS-232 Serial Rate 600 bps to 57,600 bps Watchdog Yes Time/Date Clock 72423
Keypad
OP7100—touchscreen
OP7110—up to 8 × 8 user-supplied
Backup Battery
Panasonic CR2330, 3 V DC lithium ion, rated life
265 mA⋅h
OP710096


Specifications
Header and Jumper Configurations
Figure B-3 shows the locations of the configurable headers on the OP7100.
Table B-2 lists the headers that carry signals.
Table B-2. OP7100 Signal Headers
Header Description
J1 LCD (hard-wired) J2 Backlight J3 LCD (ribbon cable) J4 Programming port J5 Touchscreen interface (OP7100 only) J6 Keypad interface (OP7110 only) J7 Digital I/O
J8 RS-232 port (header) J10 RS-232 port (DE9) J11 DC power supply, RS-485 port
RS485 TERM.
U1
DANGER! HIGH VOLTAGE
RS232
J2
J1
LCD
JP1
J3
J4
PRGM PORT
J7
LCD
DIGITAL I/O
J11
J8
J10
JP4
JP5
J9
JP2
J6
J5
KEYPAD
JP3
Figure B-3. OP7100 Headers
OP7100 Specifications


97
Table B-3 lists the jumper configurations.
FD
FD
Table B-3. OP7100 Jumper Settings
Header
Pins
Connected
Function
Factory Default
1–2 5–6 7–8
11–12
Positive LCD background
(blue characters on white
background)
JP1
1–3 4–6 7–9
10–12
Negative LCD background
(white characters on blue
background)
1–2 Software contrast adjustment OP7100
JP2
2–3 Manual contrast adjustm e nt OP7110 1–2
5–6
9–10
11–12
One 5-wire RS-232,
one RS-485
1–2 5–6
One 3-wire RS-232,
one RS-485
JP3
3–4 7–8
Two 3-wire RS-232
3–4 5–6
RS-485 on J11: 2– 3
JP4
1–2 7–8
RS-232 on J11: 2– 3
JP5 1–2
Connect to connect frame
ground to power supply
ground
Connected
J4 1–2
Connect to enable program
mode, disconnect for run
mode
Not
connected
J9
1–2 3–4
Connect to enable termination
resistors, disconnect to disable
termination resistors
Connected
FD
OP710098


Specifications
OP7100 Memory, I/O Map, and Interrupt Vectors


99
APPENDIX C: MEMORY,
I/O MAP, AND INTERRUPT VECTORS
Appendix C provides detailed information on memory and an I/O map. The interrupt vectors are also listed.
OP7100100


Memory, I/O Map, and Interrupt Vectors
OP7100 Memory
Figure C-1 shows the memory map of the 1M address space.
Figure C-1. Memory Map of 1M Address Space
Figure C-2 shows the memory map within the 64K virtual space.
Figure C-2. Memory Map of 64K Virtual Space
The various registers in the input/output (I/O) space can be accessed in Dynamic C by the symbolic names listed below. These names are treated as unsigned integer constants. The Dynamic C library functions inport and outport access the I/O registers directly.
data_value = inport( CNTLA0 );
outport( CNTLA0, data_value );
UNITIALIZED
DATA
USER CODE
LIBRARY
RAM
ROM
RAM
ROM
UNUSED
RAM-Based ROM-Based
0
STACK
XMEM
64K
UNITIALIZED
DATA
USER CODE
LIBRARY
UNUSED
STACK
XMEM
512K
1024K
Socket U8
RAM
Socket U7
EPROM
0x00000
0x80000
Loading...