PK2200 Series C-Programmable Controllers User’s Manual 019–0015 • 071126–F
PK2200 User’s Manual Part Number 019-0015 • 071126-F • Printed in U.S.A. © 1999–2007 Rabbit Semiconductor Inc. • All rights reserved. Rabbit Semiconductor reserves the right to make changes and improvements to its products without providing notice. No part of the contents of this manual may be reproduced or transmitted in any form or by any means without the express written permission of Rabbit Semiconductor.
TABLE OF CONTENTS About This Manual vii Chapter 1: Overview 11 Chapter 2: Getting Started 17 Chapter 3: Subsystems 21 Chapter 4: System Development 33 Introduction .......................................................................................... 12 Standard Features ................................................................................. 14 Flexibility and Customization Options ................................................ 15 Development Kit ...................................
Digital Inputs ....................................................................................... 36 Using the Digital Inputs .................................................................. 36 Interrupt Inputs ................................................................................ 36 High Speed DMA Counter .............................................................. 36 Digital Outputs .....................................................................................
Appendix B: Specifications 69 Appendix C: Power Management 79 Appendix D: Interrupt Vectors and I/O Addresses 85 Appendix E: PLCBus 95 General Specifications ......................................................................... 70 Hardware Mechanical Dimensions ...................................................... 71 High Voltage Driver Specifications ..................................................... 75 Environmental Temperature Constraints ..............................................
Blank vi s Table of Contents PK2200
ABOUT THIS MANUAL This manual provides instructions for installing, testing, configuring, and interconnecting the Z-World PK2200 controller. All product references in this manual are made to the PK2200 series. The term PK2200 is used as a generic term referring to any of the PK2200 series. Where necessary, specific model numbers are used. ® Instructions are also provided for using Dynamic C functions. Assumptions Assumptions are made regarding the user's knowledge and experience in the following areas.
Acronyms Table 1 lists and defines the acronyms that may be used in this manual. Table 1.
Conventions Table 3 lists and defines the typographic conventions that may be used in this manual. Table 3. Typographic 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).
Blank x s About This Manual PK2200
CHAPTER 1: OVERVIEW Chapter 1 provides a comprehensive overview and description of the PK2200.
Introduction The PK2200 is an inexpensive control computer well suited for a variety of applications in areas such as packaging, materials handling, and process control. Figure 1-1 illustrates the PK2200 with the 2 × 20 character LCD and a 2 × 6 keypad. PLCBus Expansion Connector Screw Connectors menu item field run up down F3 F4 del setup F1 Screw Connectors F2 LCD DISPLAY LED help init add Keypad RS-232 Connector Figure 1-1.
Figure 1-3 illustrates the PK2200 without an enclosure. U10, U16 are under the EPROM U8, U11 are under the SRAM DCIN J1 LED JP1 C1 U2 U3 H.C. Driver JP2 LCD U1 U5 U6 U4 PLC Bus Connector JP3 485 L1 U7 U9 PLD Buffer RS-232 U12 RS232 Y1 U15 U14 SRAM Buffer Inv. Battery EPROM H1 U13 Mux U18 JP4 H3 Keypad RTC J2 Z180 H2 Beeper RT U17 Mux Mux U20 Phone Jack RJ-12 Y2 RS-232 Connector U19 JP5 Reset Button J3 Figure 1-3.
Standard Features The PK2200 series includes the following standard features: Compact size: 4" × 5.5" × 1.34" 16 protected digital inputs for detecting contact closures, counting pulses, or detecting voltage input signals. 14 high-current digital outputs, suitable for driving relays, solenoids, or lamps. RS-485 and RS-232 serial ports for external communication and controller networking using links up to several kilometers 9.216 MHz clock with 18.
Flexibility and Customization Options The PK2200 is available with either quick-release pluggable terminals or fixed screw terminals. For added flexibility, special order the PK2200 Series controller with the following options installed. Backlit character LCD (for PK2200 and PK2210 only). 128K or 512K battery-backed RAM. 128K flash EPROM for program and nonvolatile data storage. High-voltage sourcing drivers.
CE Compliance The PK2200 has been tested by an approved competent body, and was found to be in conformity with applicable EN and equivalent standards. Note the following requirements for incorporating the PK2200 in your application to comply with CE requirements. The power supply provided with the Development Kit is for development purposes only. It is the customers responsibility to provide a clean DC supply to the controller for all applications in end-products.
CHAPTER 2: GETTING STARTED Chapter 2 provides instructions for connecting the PK2200 to a PC and running a sample program.
Connecting the PK2200 to a PC The PK2200 is programmed with a PC through an RS-232 port using the programming cable provided in the Development Kit. To connect the PK2200 to a PC use the following steps: 1. Install Dynamic C as described in your Dynamic C manuals. 2. Using the supplied adapter, connect the programming cable from the PK2200s RJ-12 (J2) socket to the appropriate COM port of your computer. PK2200 Series Controller To PC's COM Port Programming Cable Adapter Figure 2-1.
Figure 2-2 illustrates the power supply connections. K +DC GND J1 + Long Lead Red Shrink Wrap Short Lead Power Supply Leads Figure 2-2. Power Supply Connection 4. Plug the power supply into a wall socket. The PK2200 is now ready to run. Establishing Communication with the PK2200 To establish communication with the PK2200 use the following steps. 1. Double-click the Dynamic C icon to start the software. Note that each time you start Dynamic C, communication with the attached PK2200 is attempted. 2.
Running a Sample Program To run a sample program on the PK2200 use the following steps. 1. Open the sample program CDEMO_RT.C located in the SAMPLES\CPLC Dynamic C subdirectory. 2. Compile the program by pressing F3 or by choosing Compile from the compile menu. Dynamic C compiles and downloads the program into the PK2200s memory. During compilation, Dynamic C rapidly displays several messages in the compiling window. This condition is normal.
CHAPTER 3: SUBSYSTEMS Chapter 3 describes the various PK2200 subsystems and interfaces, software drivers and sample programs.
Subsystem Overview The PK2200 is composed of several subsystems. The following list of subsystem elements is illustrated in Figure 3-1.
Processor Core The PK2200s processor core is composed of the CPU, microprocessor supervisor/watchdog timer, battery-backed static RAM, EPROM/flash EPROM, EEPROM, and RTC. CPU The PK2200 is available with either 9.216 MHz or 18.432 MHz CPU clock speeds. The 18.432 MHz clock improves system performance and allows baud rates up to 11,500 bps. PK2200s with the 9.216 MHz option are limited to 57,600 bps. The system clock speed is a 16-bit value stored at location 0x108 in the EEPROM.
Even though slightly more expensive than standard EPROM, flash EPROM offers the following benefits. • In-system programmability. • Remote downloading of program code and data. • Easier to reprogram. • Erases quicker without a special eraser. EEPROM EEPROM offers a separate area for storing permanent or semi-permanent information such as clock speed, network address, calibration coefficients, and installation data.
The digital inputs can be pulled up to +5 V or down to GND by installing jumpers on JP2. When jumpered, the digital input line impedance is 4.7 kΩ in the range 05 V for inputs 110 and 1516. The impedance on inputs 1114 is approximately 1.5 kΩ. Outside this range, the input impedance is greater than 3.9 kΩ for inputs 110 and 1516. Jumper JP2 connects the inputs to pull-up or pull-down resistors. Table 3-1 lists the JP2 jumper settings and Figure 3-2 illustrates JP2 jumper settings. Table 3-1.
Inputs 1114, in addition to the protected digital input function, have the capabilities listed in Table 3-2. Table 3-2. Digital Input 11-14 Alternate Functions Input Z180 Signal Function 11 /INT0 Interrupt for user programs 12 /INT2 Interrupt for user programs 13 CKA0/DREQ0 DMA channel 0, used for counting 14 /DREQ1 DMA channel 1, used for counting Inputs 11 and 12 can be used to generate hardware interrupts on the PK2200 CPU.
Digital Outputs The PK2200s 14 digital outputs (HV01 through HV14) provide highvoltage, high-current digital outputs for your application. Sinking and optional sourcing drivers will drive a variety of loads including inductive loads such as relays, small solenoids, or stepping motors. Note the following points regarding the digital outputs: Each output is individually addressable. Each output includes a protective diode that returns inductive spikes to the power supply. Sinking drivers are standard.
Figure 3-6 illustrates the connection for the UDN2985A sourcing driver. (Note the connections on header JP1.) K 1 2 external DC JP1 Channel (114) HV01HV14 inductive load 4 3 UDN2985A JP1 Figure 3-6. Sourcing Driver Configuration Note the following points regarding the UDN2985A sourcing driver. Outputs pull high (source current) when turned on. The chips rating is 30 V and 250 mA maximum per channel, subject to the chips thermal limits and ambient temperature.
Serial Communication Two serial ports support asynchronous communication at baud rates from 300 bps to 57,600 bps on 9.216 MHz versions up to 115,200 bps with the 18.432 MHz versions. The serial ports can be configured as follows: Two 3-wire RS-232 ports. One 5-wire RS-232 port (with RTS and CTS) and one half-duplex RS-485 port. The RJ-12 phone jack connector J2 supports full-duplex RS-232 communication with handshake lines.
Table 3-4 lists JP3 jumper settings and Figure 3-10 illustrates jumper setting configurations for the two serial channels. If only one RS-232 channel is desired, use one of the first two configurations. With these configurations, the RS-485 port is also active on the second Z180 serial channel (Z1). Unless the application software explicitly enables Z1, the RS-485 channel has no effect on the Z180.
Keypad and Display The PK2200 Series supports operator I/O through both keypad and LCD. The following two standard operator I/O configurations are available on PK2200 controller models with enclosures: 2-row by 20-column character LCD module plus a 2-row by 6-column keypad. 128-column by 64-row backlit graphic LCD module plus a 4-row by 3-column keypad.
Blank 32 s Subsystems PK2200
CHAPTER 4: SYSTEM DEVELOPMENT Chapter 4 describes system development using the PK2200 interfaces and presents some sample programs to illustrate their use.
Changing Modes The operating mode of the PK2200 is determined during power-up initialization. If a valid program is found in EPROM, then it is executed. Otherwise, the operating mode is determined by the jumper settings on JP4 or by keypress combinations. Following are the possible modes of operation:. • Run a program stored in RAM or flash EPROM. • Prepare for Dynamic C programming using the RS-232 port. The mode can be changed by either of the following two methods: 1.
Program Mode Run Mode 7 8 9 7 8 9 4 5 6 4 5 6 1 2 3 1 2 3 - 0 - 0 . . Figure 4-2. 3x4 Keypad Mode Settings Program Mode 8 7 6 5 Run Mode 3 4 2 8 1 7 6 JP4 19,200 bps 5 4 3 2 1 JP4 28,800 bps Figure 4-3. JP4 Mode Settings Do not jumper more than one pair of pins to configure a mode. Development Options Memory Options Programs for the PK2200 are written and compiled on a PC and then downloaded to the PK2200 memory and executed.
EPROM EPROMs offer a permanent storage option for programs and data. The PK2200 BIOS is factory installed in the EPROM. After an application is fully debugged and running, it can be compiled and stored in EPROM with an EPROM burner. Each time the PK2200 powers up, it will run the stored application. Flash EPROM Flash EPROM offers the benefits of both battery-backed RAM and standard EPROM. You can quickly change and download a program as if you were using RAM.
The following points summarize the counters capabilities: The counter can measure the time at which a negative edge occurs with a precision of a few microseconds. A minimum time must occur between successive events to allow for interrupt processing. The counter can measure the width of a pulse by counting (up to 65,536) at a rate that varies from 300 Hz to 600 kHz, providing 16-bit accuracy. Count negative-going edges for up to two channels.
Serial Communication Dynamic C has serial communication support libraries. For the Z180 port z0 and Z180 port z1, use AASC.LIB, Z0232.LIB, and Z1232.LIB. For RS-232 expansion cards that interfaced through the PLCBus on the PK2200, use EZIOPLC.LIB.
Echo Option If the echo option is turned on during initialization of the serial port (with Dinit_z0, Dinit_z1, or Dinit_uart) any character received is automatically echoed back (transmitted out). This feature is ideal for use with a dumb terminal and also for checking the characters received. CTS/RTS Control Z180 port 0 is constrained by hardware to have the CTS (clear to send) pulled low by the RS-232 device with which it is communicating.
Library functions for the RS-232 port support communication with a Hayes Smart Modem or compatible. Note the following points: The CTS, RTS, and DTR lines of the modem are not used. If the modem used is not truly Hayes Smart Modem compatible, the user has to tie the CTS, RTS, and DTR lines on the modem side together. The CTS and RTS lines on the PK2200 side also have to be tied together. A NULL connection is required for the TX and RX lines.
Interrupt Handling for Z180 Port 0 Normally, a serial interrupt service routine would be declared with the compiler directive: #INT_VEC SER0_VEC routine However, if you use the same serial port for Dynamic C programming, your program has to be downloaded first with Dynamic C before the address of the serial interrupt service routine is loaded into the interrupt vector table. That is, the service routine must be loaded at run-time.
Developing an RS-485 Network The two-wire RS-485 serial-communication port and Dynamic-C network software allow network development. Screw terminal strip J1 provides a half-duplex RS-485 interface. The RS-485 signals are on screw terminals 18 and 19.
Keypad and LCD The PK2200 Series supports operator I/O with a keypad and LCD. Two standard operator I/O configurations are available on PK2200 series controllers with enclosures: 2-row by 20-column character LCD module with a 2-row by 6column keypad. 128-column by 64-row backlit graphic LCD module with a 4-row by 3-column keypad. The character LCD module is also available with an LED backlighting option. The graphic LCD has electroluminescent backlighting installed as a standard feature.
Keypad Insert Templates The keypads are designed to accept paper inserts. Inserts can be produced on regular paper using a laser printer, thus allowing quick and easy customization of keypad legends. menu item field up F1 F2 F3 F4 down help del add 0.40 0.10 1.13 0.13 0.10 You can use the templates below for creating inserts. All dimensions are in inches. Inserts can be secured by taping the portion of the insert that extends beyond the keypad to the supporting bracket 0.30 0.40 0.40 0.
Keypad Codes The PK2200 keypads are supported by Dynamic C functions that return codes corresponding to the key pressed. The figures below show the codes for the 2x6 and 3x4 keypads used on the PK2200 Series controllers. 1 2 3 4 5 6 7 8 9 10 11 12 Figure 4-8. 2x6 Keypad Codes 24 25 26 16 17 18 8 9 10 0 1 2 Figure 4-9.
PK2200 LCDs The PK2200 Series LCDs are easy to use with Dynamic C software libraries. Shown below are the layouts for both the 2x20 character display and the 64x128 graphic display. 2x20 Character LCD Row 0 Row 1 Column 0 Column 19 Figure 4-10. 2X20 Character LCD 64x128 Graphic LCD Row 0 Row 63 Column 127 Column 0 Figure 4-11. 64X128 Graphic LCD Graphic LCD Status Several Dynamic C library functions return the operating status of the LCD. The LCD status bits are shown in the following bitmap.
ON/OFF - When the ON/OFF bit is set ( 1 ) the display is on, any image on the screen will be visible. When the bit is reset ( 0 ) any images on the display will not be visible. The image is still in the display memory. RESET - Resets the LCD module when low ( 0 ). Bitmapped Graphics Many of the Dynamic C functions that operate on the graphic LCD use bitmaps. These bitmaps represent the images on a section of the display. An individual dot, or pixel, is represented by one bit in the bitmap.
Blank 48 s System Development PK2200
CHAPTER 5: SOFTWARE REFERENCE Chapter 5 covers the software drivers used with the PK2200 series controllers.
Software Drivers Drivers are functions that simplify accessing PK2200 hardware and I/O. For the following reasons, Z-World drivers make writing software easier: Provide commonly needed functionality. Eliminate the need to know all of the details of operation. Previously tested. Simplify source code by replacing multiple lines of code with one function call. $ Refer to the Dynamic C Technical Reference Manual for more information on using drivers.
EEPROM The following functions provide access to the EEPROM. The EEPROM is generally used for storing system information, calibration information, or any data that does not need to change often. int ee _ rd (int address) Reads value from EEPROM at specified address. PARAMETER1: The address to read from. RETURN VALUE: EEPROM data (0-255) if successful; negative value if unable to read EEPROM. int ee_wr (int address, char data) Writes value to EEPROM at specified address.
Digital Inputs and Outputs DIGIN1, DIGIN2, ..., DIGING16 The virtual driver variables DIGIN1, DIGIN2, ... DIGIN16 represent the state of the digital inputs. These variables take the value 1 if the input is high and 0 if the input is low. The value is changed only if the new value remains the same for 2 ticks (25 to 50 milliseconds) of the virtual driver. void VIOInit(); VIOInit is a dummy function used as a host for the GLOBAL_INIT of the virtual I/O variables.
The lower eight bits returned by the inport() function represent the status of the digital inputs. Bits which are set ( 1 ) represent inputs which are high. Bits which are reset ( 0 ) correspond to inputs which are low. Example: lowDIBank = inport( DIGBANK1 ); highDIBank = inport( DIGBANK2 ); void DMA0Count (unsigned int count) Loads the DMA channel 0 with the count value and enables the DMA channel 0 interrupt. The function sets the flag _DMAFLAG0 to zero.
Digital Output Drivers Following are the digital output drivers for the PK2200: int up_setout( int channel, int value ) Sets the state of digital output. PARAMETER1: The digital output channel to set. PARAMETER2: The state to set. 1 (active) or 0 (inactive). RETURN VALUE: None. Pass channel (114) and value: 0 for OFF, 1 for ON. OUT1, OUT2, ..., OUT14 Set the virtual driver variables OUT1, OUT2, OUT3, ... OUT13, OUT14 to a value of 0 to turn off the output, or 1 to turn on the output.
LCD and Keypad The following functions provide routines for writing to the LCD and reading the keypad. Include the following directives in your program if using the PK2240. #use wintek.lib #use kp.lib The following directives provide information to the compiler about the graphic LCD and keypad on the PK2240. void lc_init_keypad() Initializes timer1, keypad driver, and variables, and, if used, the realtime kernel. RETURN VALUE: None.
int lc_cmd (int cmd) Waits for LCD busy flag to clear, then sends cmd to LCD command register. RETURN VALUE: 0, if successful in writing to the LCD; else -1, if timeout void lc_ctrl (byte cmd) Write a control cmd to the LCD. RETURN VALUE: None. void lc_init() Initializes the LCD. The display is turned on, cleared, and the cursor (now in the top left character position) blinks. RETURN VALUE: None void lc_ nl() Performs a new line function on the LCD.
int glInit() Initializes the LCD module (software and hardware). RETURN VALUE: returns the status of the LCD. If the initialization was successful, this function returns 0. Otherwise, the returned value indicates the LCD status. int glBlankScreen() Blanks the screen of the LCD. RETURN VALUE: The returned value indicates the status of the LCD after the operation. int glPlotDot(int x, int y) Plots one pixel on the screen at coordinate (x,y). PARAMETER1: the x coordinate of the pixel to be drawn.
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. PARAMETER1: x coordinate of the bitmap (left edge). PARAMETER2: y coordinate of the bitmap (top edge). PARAMETER3: width of the bitmap. PARAMETER4: height of the bitmap. PARAMETER5: pointer to the bitmap. RETURN VALUE: None. void glGetBitmap(int x, int y, int bmWidth, int bmHeight, char *bm) Gets a bitmap from the LCD.
void 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. PARAMETER1: pointer to the font descriptor to be initialized. PARAMETER2: width of each font item (must be uniform for all items). PARAMETER3: height of each font item (must be uniform for all items).
void glPrintf(int x, int y, struct _fontInfo *pInfo, char *fmt,...) Prints a formatted string (much like printf) on the LCD screen. PARAMETER1: x coordinate of the text (left edge). PARAMETER2: y coordinate of the text (top edge). PARAMETER3: pointer to the font descriptor used for printing on the LCD screen. PARAMETER4: pointer to the format string RETURN VALUE: None. void glPlotCircle(int xc, int yc, int rad) Draws a circle on the LCD. PARAMETER1: x coordinate of the center.
void kpInit(int (*changeFn)()) Initializes the kp module. This function should be called before other functions of this module are called. PARAMETER1: This 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 call-back function. The first argument is a pointer to an array that indicates the current state of the keypad.
int kpDefGetKey() This is the default get key function. This function 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. The function kpDefInit should be used to initialize the module. RETURN VALUE: -1 if no key is pressed. Otherwise it returns the normalized key number. The normalized key number is 8*row+col+edge*256. Edge is 1if the key is released, and 0 if the key is pressed.
Table 5-1. PK2200 Sample Programs (concluded) Program Description LADDERC.C Use ladder C for I/O control. LCGRAM.C Illustrates use of the LCD character generator. OUTDEMO.C Use keypad to toggle the state of the digital outputs. OUTVDVR.C Similar to OUTDEMO.C, but uses the virtual driver to change the state of the output. PRT0DEMO.C Use TIMER0 for timer interrupt . READIO.C Read and toggle the I/Os through STDIN. The I/Os are driven by function calls. READKEY.
Table 5-2. Sample Communication Programs (concluded) Program Description CZ0REM.C More elaborate sample of serial communication between board and PC dumb terminal. Includes modem communication, data monitoring, time and date setup, memory read and write, data logging, XMODEM download of the data log, XMODEM upload of binary file for remote downloading. Also supports master-to-slave communication. (Slave has to be running the program CSREMOTE.C.) RS232.
APPENDIX A: TROUBLESHOOTING Appendix A provides procedures for troubleshooting system hardware and software.
Out of the Box Check the items mentioned in this section before starting development. Verify that the PK2200 runs in standalone mode before connecting any expansion boards or I/O devices. Verify that the entire host system has good, low-impedance, separate grounds for analog and digital signals. Often the controller is 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.
Dynamic C Will Not Start In most situations, when Dynamic C will not start, an error message announcing a communication failure will be displayed. Following is a list of situations causing an error message and possible resolutions. Wrong Baud Rate In rare cases, the baud rate has to be changed when using the Serial Interface Board for development. Wrong Communication Mode Both sides must be talking RS-232. Wrong COM Port A PC generally has two serial ports, COM1 and COM2.
Common Programming Errors Values for constants or variables out of range. Table A-1 lists acceptable ranges for variables and constants. Table A-1. Constant and Variable Ranges Type Range 15 int –32,768 (–2 ) to 15 +32,767 (2 –1) long int −2 , 147,483,648 ( −2 ) to 31 +2147483647 (2 −1 ) float 1.18 × 10 to 38 3.40 × 10 char 0 to 255 31 –38 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.
APPENDIX B: SPECIFICATIONS Appendix B provides comprehensive PK2200 physical, electronic, and environmental specifications.
General Specifications Table B-1 lists the electrical, mechanical, and environmental specifications for the PK2200. Table B-1. PK2200 General Specifications Parameter Specification Operating Temp −40° C to 70° C Humidity 5% to 95%, noncondensing Input Voltage 9 V to 24 V DC Digital Inputs 16 protected, −20 V to +24 V DC Digital Outputs 14 high-current sinking (500 mA max.) or sourcing (250 mA max.). Processor Z80180 Clock 9.216 MHz or 18.432 MHz.
Hardware Mechanical Dimensions Top view for models PK2200 and PK2210. 3.09 (78.5) 2.42 (61.5) 1.85 (47.0) add 5.5 (140) del F3 F1 F4 init up run 0.31 typ (7.9) F2 10-32 clr, 4x field menu item setup 4.35 (110.5) 1.15 (29.2) 1.11 (28.2) 4.85 (123.2) 4.39 (111.5) down help 0.67 (17.0) 0.37 (9.0) 0.2 typ (5) 4.0 (101) Figure B-1.
Top view for model PK2240. 1.105 (28.1) 1.75 (44.5) 0 – 10-32 clr, 4x 4.88 (124.0) 2.719 (69.1) 5.5 (139.7) 2 1 . 5 4 3 8 7 6 1.262 (32.1) 0.37 (9.4) 0.2 typ (5) 4.0 (102) 0.31 typ (7.9) 0.621 (15.8) 3.750 (95.3) 4.85 (123.2) 1.350 (34.3) 9 1.455 (37.0) Figure B-2.
End view for models PK2200, PK2210 and PK2240. 1.71 (43.4) 1.2 (30.5) 0.75 (19.1) 0.22 (5.6) 2.95 (75.0) 0.55 (14.0) 0.2 (5.1) 1.44 (36.6) Figure B-3. End View PK2200, PK2210, and PK2240 The board dimensions are 4.0"×5.32" overall. The centers of the mounting holes are inset (0.220", 0.770") from the corners of the board. They are 2.46" and 4.88" on center. Mounting holes are 0.160" in diameter.
Top view of models PK2220 and PK2230. 0.030 (0.76) 0.220 (5.59) 0 .470 (11.9) 5.100 (129.5) 5.320 (135.1) R 0.125 X 4 (3.2) R 0.125 X 4 (3.2) 0.200 (5.1) 0.770 (19.6) 3.230 (82.0) 3.800 (96.5) 4.000 (101.6) Figure B-4.
High Voltage Driver Specifications Table B-2. Sinking Driver Specifications Parameter Output Voltage Output Current Power Dissipation (Change) Power Dissipation (Package) C-E Saturation Voltage (max.) Derating Factor Absolute Maximum Rating at 25C 50 V DC 500 mA 1.0 W 2.25 W 1.3 V 18.18 mW/C above 25 C Table B-3.
Connectors 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 this, use tinned wires or clean, shiny copper wire.
Table B-4. Headers and Jumper Settings Header Pins Description 1–3, 2–4 1–2, 3–4 Sink/source control. The drivers will be damaged if the jumpers are set incorrectly. Connect for the ULN2803 sinking drivers (default). Connect for the UDN2985A sourcing drivers.
Blank 78 s Specifications PK2200
APPENDIX C: POWER MANAGEMENT Appendix C provides information about power management and hardware and software specific to power management on the PK2200.
Power Failure Detection Circuitry Figure C-1 shows the power failure detection circuitry of the PK2200. DCIN R1 +5V IC691 /PFI R2 R4 Microprocessor U15 D6 /NMI D6 /PFO /RES U11 3B /RESET 3Y 74HC257 D6 U18 Figure C-1. PK2200 Power-Fail Circuit Power Failure Sequence of Events The following events occur as the input power fails:. 1. The 691 power-management IC first triggers a power-failure /NMI (non-maskable interrupt) when the unregulated DC input voltage falls below approximately 7.
The ratio of your power supplys output capacitors value to your circuits current draw determines the actual duration of the holdup-time interval, t . H Power Fails 9.0 Unregulated DC 8.0 Regulated +5V 7.0 Dropout Voltage 6.0 5.0 4.0 C 3.0 Slope = C/-I 2.0 I VOLTS 1.0 tH TIME 691 Asserts PFO 691 Asserts RESET 691 Ceases Operation Figure C-2. Power Fail Sequence of Events This setup can fail when multiple power fluctuations happen rapidly a common occurrence in the real world.
Recommended Power Fail Routine Z-World recommends the following routines to handle an NMI. The routines monitor the state of the /PFO line, via U18 and the data bus, to determine if the brownout condition is continuing or if the power has returned to normal levels. If you use one of these routines, you need not worry about multiple power-failure /NMIs because these routines never return from the first /NMI unless the power returns. Program C-1. Suggested Power Fail Routine main(){ ... } ...
The watchdog timer should be enabled. However, if the watchdog is not enabled, you can force the processor to restart execution at 0x0000. Substitute this section for the one labeled timeout above. Program C-2. Alternate Power Fail Code restart: ld a,0xe2 out0 (CBAR),a jp 0000h ; ; ; ; ; ; ; make sure 0x0000 points to start of EPROM BIOS set the CBAR jump to logical (physical) address 0x0000 #endasm If the DC input voltage continues to decrease, the controller powers down.
Blank 84 s Power Management PK2200
APPENDIX D: INTERRUPT VECTORS AND I/O ADDRESSES Appendix D provides a suggested interrupt vector map and information on EEPROM address, processor I/O addresses, and peripheral addresses.
Most of the following interrupt vectors can be altered under program control. The addresses are given in hex, relative to the start of the interrupt vector page, as determined by the contents of the I-register. These are the default interrupt vectors set by the boot code in the Dynamic C EPROM.
Jump Vectors These special interrupts occur in a different manner: instead of loading the address of the interrupt routine from the interrupt vector, these interrupts cause a jump directly to the address of the vector, which contains a jump instruction to the interrupt routine. For example, 0x66 non-maskable power-failure interrupt Because nonmaskable interrupts can be used for Dynamic C communication, your interrupt vector for power failure is normally stored just in front of the Dynamic C program.
EEPROM Addresses These EEPROM constants apply to the standard PK2200. Table D-3. Z180 I/O Device Register Addresses Address Description 0x000 Startup Mode. If 1, enter program mode. If 8, execute loaded program at startup. 0x001 Baud rate in units of 1200 baud. 0x100 Unit “serial number.” BCD time and date with the following format: second, minutes, hours, day, month, year. 0x108 Microprocessor clock speed in units of 1200 Hz (16bits). For 9.216 MHz clock speed, this value is 7680. For 18.
Processor Register Addresses The Z180s I/O-device registers occupy the first 40 addresses. H Table D-4.
Table D-4.
PK2200 Peripheral Addresses The following addresses control the I/O devices that are external to the Z180 processor. Table D-5. PK2200 External I/O Device Registers Address Bit(s) Symbol Function 0x40 7 WDOG Watchdog is “hit” (when JP3:1-2) by setting bit 7 of this address. 0x60 7 LED Turns on LED by setting bit 7 of this address. Turn off by clearing bit 7. 0x80 7 SCL EEPROM clock bit. Set the clock high by setting bit 7 of this address, and low by clearing bit 7.
Table D-5. PK2200 External I/O Device Registers (continued) Address Bit(s) Symbol Function 0x100 0–3 RTALE Real-time clock, address register 0x120 0–3 RTRW Real-time clock, read/write data register 0x140 7 BUZZER Self-resonating buzzer. Set bit 7 to turn on. Clear bit 7 to turn off. 0x160 7 ENB485 Set bit 7 to enable RS-485 channel. Clear bit 7 to disable. 0x180 0–7 DIGBANK1 Digital Input, Bank 1. Bit 0 corresponds to input 1; bit 7 corresponds to input 8.
Table D-5. PK2200 External I/O Device Registers (continued) Address Bit(s) Symbol Function 0x1B1 4–7 KROW1H Keypad drive row 1, leftmost 2 keys. Bit 5 is leftmost key. Bit 4 is key next to that. Bit 7 represents EEPROM SDA line. Bit 6 presents power-failure (NMI) state. Row 1 is bottom-most row. 0x1B 2 4–7 KROW2H Keypad drive row 2, leftmost 2 keys. Bit 5 is leftmost key. Bit 4 is next. Bit 7 represents EEPROM SDA line. Bit 6 presents powerfailure (NMI) state.
Table D-5. PK2200 External I/O Device Registers (concluded) Address Bit(s) Symbol 0x1C3 5 DRV4 Digital output 4. Writing 0x20 turns on output. Writing 0 turns off output. 0x1C4 5 DRV5 Digital output 5. Writing 0x20 turns on output. Writing 0 turns off output. 0x1C5 5 DRV6 Digital output 6. Writing 0x20 turns on output. Writing 0 turns off output. 0x1C6 5 DRV7 Digital output 7. Writing 0x20 turns on output. Writing 0 turns off output. 0x1C7 5 DRV8 Digital output 8.
APPENDIX E: PLCBUS Appendix E provides the pin assignments for the PLCBus, describes the registers, and lists the software drivers.
PLCBus Overview The PLCBus is a general-purpose expansion bus for Z-World controllers. The PLCBus is available on the BL1200, BL1600, BL1700, PK2100, PK220, and PK2600 controllers. The BL1000, BL1100, BL1300, BL1400, and BL1500 controllers support the XP8300, XP8400, XP8600, and XP8900 expansion boards using the controllers parallel input/output port. The BL1400 and BL1500 also support the XP8200 and XP8500 expansion boards.
Two independent buses, the LCD bus and the PLCBus, exist on the single connector. The LCD bus consists of the following lines. LCDXpositive-going strobe. /RDXnegative-going strobe for read. /WRXnegative-going strobe for write. A0Xaddress line for LCD register selection. D0X-D7Xbidirectional data lines (shared with expansion bus). The LCD bus is used to connect Z-Worlds OP6000 series interfaces or to drive certain small liquid crystal displays directly.
There are eight registers corresponding to the modes determined by bus lines A1X, A2X, and A3X. The registers are listed in Table E-2. Table E-2.
Place an address on the bus by writing (bytes) to BUSADR0, BUSADR1 and BUSADR2 in succession. Since 4-bit and 8-bit addressing modes must coexist, the lower four bits of the first address byte (written to BUSADR0) identify addressing categories, and distinguish 4-bit and 8-bit modes from each other. There are 16 address categories, as listed in Table E-3. An x indicates that the address bit may be a 1 or a 0. Table E-3.
Z-World provides software drivers that access the PLCBus. To allow access to bus devices in a multiprocessing environment, the expansion register and the address registers are shadowed with memory locations known as shadow registers. The 4-byte shadow registers, which are saved at predefined memory addresses, are as follows.
Digital output devices, such as relay drivers, should be addressed with three 4-bit addresses followed by a 4-bit data write to the control register. The control registers are configured as follows bit 3 A2 bit 2 A1 bit 1 A0 bit 0 D The three address lines determine which output bit is to be written. The output is set as either 1 or 0, according to D. If the device exists on the bus, reading the register drives bit 0 low. Otherwise bit 0 is a 1.
There are 4-bit and 8-bit drivers. The 4-bit drivers employ the following calls. void eioResetPlcBus() Resets all expansion boards on the PLCBus. When using this call, make sure there is sufficient delay between this call and the first access to an expansion board. LIBRARY: EZIOPLC.LIB, EZIOPLC2.LIB, EZIOMGPL.LIB. void eioPlcAdr12( unsigned addr ) Specifies the address to be written to the PLCBus using cycles BUSADR0, BUSADR1, and BUSADR2.
void set4adr( int adr ) Sets the current address for the PLCBus. All read and write operations access this address until a new address is set. A 12-bit address may be passed to this function, but only the last four bits will be set. Call this function only if the first eight bits of the address are the same as the address in the previous call to set12adr. PARAMETER: adr contains the last four bits (bits 811) of the physical address. LIBRARY: DRIVERS.LIB.
char read4data( int adr ) Sets the last four bits of the current PLCBus address using adr bits 8 11, then reads four bits of data from the bus with BUSADR0 cycle. PARAMETER: adr bits 811 specifies the address to read. RETURN VALUE: PLCBus data in the lower four bits; the upper bits are undefined. LIBRARY: DRIVERS.LIB. void _eioWriteWR( char ch) Writes information to the PLCBus during the BUSWR cycle. PARAMETER: ch is the character to be written to the PLCBus. LIBRARY: EZIOPLC.LIB, EZIOPLC2.
void set8adr( long address ) Sets the current address on the PLCBus. All read and write operations will access this address until a new address is set. PARAMETER: address contains the last eight bits of the physical address in bits 1623. A 24-bit address may be passed to this function, but only the last eight bits will be set. Call this function only if the first 16 bits of the address are the same as the address in the previous call to set24adr. LIBRARY: DRIVERS.LIB.
Blank 106 s PLCBus PK2200
APPENDIX F: BACKUP BATTERY PK2200 Backup Battery s 107
Battery Life and Storage Conditions The ten-year estimated life of a battery on the PK2200 is based on typical use. Most systems are operated on a continuous basis with the battery only powering the SRAM and real time clock during power outages and/ or routine maintenance. A ten-year life expectancy is an estimate that reflects the shelf-life of a lithium battery with occasional usage rather than the ability of the battery to power the circuitry full time. The battery on the PK2200 has a 165 mA·h capacity.
Battery Cautions w Caution (English) There is a danger of explosion if battery is incorrectly replaced. Replace only with the same or equivalent type recommended by the manufacturer. Dispose of used batteries according to the manufacturers instructions. w Warnung (German) Explosionsgefahr durch falsches Einsetzen oder Behandein der Batterie. Nur durch gleichen Typ oder vom Hersteller empfohlenen Ersatztyp ersetzen. Entsorgung der gebrauchten Batterien gemäb den Anweisungen des Herstellers.
Blank 110 s Backup Battery PK2200
INDEX Symbols #INT_VEC ........................... 41, 86 #JUMP_VEC ................................ 87 /AT ............................................. 97 /DREQ1 ..................................... 26 /INT0 ......................................... 26 /INT2 ......................................... 26 /RDX .......................................... 97 /STBX ........................................ 97 /WRX ......................................... 97 ...................................
bus (continued) operations 4-bit .................... 97, 98, 100 8-bit ........................... 97, 101 BUSADR0 ................... 91, 98, 99 BUSADR1 ................... 91, 98, 99 BUSADR2 ................... 91, 98, 99 BUSADR3 ...................... 104, 105 BUSRD0 91, 101, 102, 103, 105 BUSRD1 .................. 91, 101, 102 BUSRESET ............................... 91 BUSSPARE ............................... 91 BUSWR ............................ 91, 102 BUZZER ....................................
DIGBANK2 ............................... 91 digital inputs ......... 24, 26, 36, 62 drivers .................................... 52 reading ................................... 52 multiple inputs ................... 52 virtual driver variables ........... 52 digital outputs ....... 27, 37, 54, 91 drivers .................................... 52 virtual driver variables ........... 54 writing .................................... 54 Dinit_uart ............................. 40 Dinit_z0 ..........................
expansion boards reset ...................................... 102 expansion bus .... 86, 87, 91, 96101 4-bit drivers ......................... 102 8-bit drivers ......................... 104 addresses .............................. 100 devices ........................ 100, 101 digital inputs ........................ 101 functions ...................... 102105 rules for devices ................... 100 software drivers ................... 101 expansion register .................... 100 EZIOLGPL.LIB ........
INT1 .......................................... 87 INT1_VEC .................................. 86 INT2 .......................................... 87 INT2_VEC .................................. 86 interface operator .................................. 31 interrupt handling for Z180 Port 0 .. 41 interrupt routines ................. 83, 87 interrupt vector CSIO_VEC .............................. 86 DMA0_VEC .............................. 86 DMA1_VEC .............................. 86 INT1_VEC ...................
LCD graphic (continued) contrast .............................. 60 drawing ......... 56, 57, 58, 60 font initialization ......... 58, 59 initialization ....................... 57 turning display ON/OFF .... 60 writing ......................... 59, 60 initialization ........................... 56 positioning text ...................... 56 writing ............................. 55, 56 commands .......................... 56 LCD bus ..................................... 97 LCDRD .................................
PLCBus (continued) relays DIP ..................................... 96 drivers .............................. 101 writing data ............................ 98 ports serial ...................................... 38 power failure detection ................................ 80 interrupts .................. 80, 83, 87 recommended routine ............ 82 power management .................... 79 power supply ....................... 18, 83 overload ................................. 83 program run ..................
SE1100 ....................................... 96 select PLCBus address ............. 102 SER0_VEC ........................... 41, 86 SER1_VEC .................................. 86 Serial Channel 0 control register B ................... 89 receive data register ............... 89 status register ......................... 89 transmit data register .............. 89 Serial Channel 1 control register A ................... 89 control register B ................... 89 receive data register ...............
troubleshooting (continued) communication mode ............. 67 expansion boards ................... 66 grounds .................................. 66 memory size ........................... 67 operating mode ...................... 67 repeated resets ....................... 67 TX line ....................................... 40 write12data ......................... write24data ......................... write4data ........................... write8data ........................... U XMODEM ..................
Blank
SCHEMATICS PK2200