PK2100C-Programmable ControllerUsers ManualRevision 2.0
PK2100x s About This Manual
PK2100G-4 s Appendix G: Battery
PK2100 Board LayoutBOARD LAYOUTZ180RS485OU18U16U13PALJ7J11U34EPROU1RAU2REL2 REL1RelayLERelayU25RS232U33JP1H8BufferU30OU19MUU7SWX1SupervisorU10U28Flip
This page is intentionally blank.
PK2100 Index s I-1INDEXSymbols#define ... 4-3, 4-4#INT_VEC ... D-6#JUMP_VEC ...
PK2100I-2 s Indexblock diagramdimensions ... B-2PK2100 ... 3-3, B-2board jumpers ... 2-2, 3-4, 3-1
PK2100 Index s I-3constantscalibration ...3-9, 5-3, 5-6contact protection ... 3-4contactsclosuresdetecting ...
PK2100I-4 s Indexdriverscalibrated ... 5-3direct ... 5-2, 5-3, 5-5expansion bus ... F
PK2100 Index s I-5high-gain input ... 5-3, 5-4high-level drivers ... 5-2high-sensitivity analog input ... 3-8high-s
PK2100I-6 s IndexjumpersJ1... B-5J3... B-5J7... 3
PK2100 Index s I-7NN_WATCHDOG ... 4-4NETWORK.LIB ... 5-12nickel-cadmium battery ... 1-3NMI ...
PK2100PK2100 Overview s 1-1PK2100 OVERVIEWChapter 1 provides an overview and brief description of the PK2100C-Programmable controller features, option
PK2100I-8 s IndexprogrammingFull C ... 4-3gate ...4-2, 4-3, 5-12programsdownloading ...
PK2100 Index s I-9Serial Channel 1 ... 4-9serial communication ... 1-2, 1-4,2-2, 2-3, 3-2, 3-4, 4-2,4-8, 4-9, 4-10, 5-10seria
PK2100I-10 s IndexUU1HIGH ... 5-5U1HIGH, U2HIGH, ...U5HIGH, U6HIGH... 4-6U1IN ...
Part No. 019-0024-02Revision 2.0Printed in U.S.A.Z-World2900 Spafford StreetDavis, California 95616-6800, U.S.A.Telephone:Facsimile:24-Hour FaxBack:W
This page is intentionally blank.
PK21001-2 s PK2100 OverviewPK2100 OverviewThe PK2100 series is Z-Worlds most comprehensive controller thatconnects directly to many sensors and perip
PK2100PK2100 Overview s 1-3PK2100 Features Seven fixed digital inputs Six universal inputs One high-gain differential analog input Ten high-curr
PK21001-4 s PK2100 Overview$Z-Worlds Dynamic C reference manuals provide completesoftware descriptions and programming instructions.Software Developm
PK2100Getting Started s 2-1GETTING STARTEDChapter 2 provides instructions for connecting the PK2100 to a host PCand running a sample program.
PK21002-2 s Getting StartedInitial PK2100 SetupWhen the PK2100 powers up, it reads its board jumpers, the keypad, ifany, and the contents of the EEPRO
PK2100Getting Started s 2-3Once the necessary changes have been made to establishcommunication between the host PC and the PK2100, use theDynamic C sh
PK21002-4 s Getting Started2. Compile the program by pressing F3 or by choosing Compile from theCompile menu. Dynamic C compiles and downloads the pr
PK2100 I/O Configurations s 3-1I/O CONFIGURATIONSChapter 3 discusses how to configure the available inputs/outputs in thePK2100 controller.
Z-World2900 Spafford StreetDavis, California 95616-6800 U.S.A.Company AddressNotice to UsersWhen a system failure may cause serious consequences, pro
PK21003-2 s I/O ConfigurationsPK2100 Inputs and OutputsThe PK2100 provides these types of inputs/outputs: Universal analog inputs. Protected digit
PK2100 I/O Configurations s 3-3Figure 3-2. PK2100 Block DiagramThe connector labeled +10-V ref is nominally 7 volts for the PK2110/PK2130 12-volt v
PK21003-4 s I/O Configurations3 One high-sensitivity differential analog input. Normally, thehigh-sensitivity range is 01 volts, but the input gain
PK2100 I/O Configurations s 3-5software (see Chapter 4, System Development) provides the two thresh-olds.The universal inputs are protected against o
PK21003-6 s I/O ConfigurationsMultiple contacts may be connected with external resistors to a singleuniversal input (Figure 3-5).+10-V ref3.3 kΩ1 kΩ+1
PK2100 I/O Configurations s 3-7Three of the digital inputs also serve as counter inputs. In addition, thereis a special differential counter input.
PK21003-8 s I/O Configurationsexact time, within a few microseconds, at which an event occurs byprogramming the DMA channel to store one byte and then
PK2100 I/O Configurations s 3-9g = 10 = R5 + RP5AR5 × RP5BRP5B + R11 Jumper H7 installedThe gain at the plus and minus inputs is 10 when jumper H7 is
PK21003-10 s I/O Configurationsx1 = 1ay - a0 .If the negative input x2 is tied to ground, the equation becomesy = a1 × (x1 + a0)or, solving for x1,Th
PK2100 I/O Configurations s 3-11+VR11R1R5RP5AR2+10 V47 kΩ47 kΩ470 kΩV0g = g0 × 1 – 11 + R5R2 + R5R1 .−1++350000,47350000,47
PK2100Contents s iiiCONTENTSAbout This Manual viiPK2100 Overview 1-1PK2100 Overview ...
PK21003-12 s I/O ConfigurationsThe relay output signals are routed through the U35 high-current driverchip.Digital OutputsThe PK2100 has 10 digital ou
PK2100 I/O Configurations s 3-13The diodes on U35 for outputs O8O10 use the PK2100s power supplydirectly.InductiveloadD.C. in D.C. inDigital outputc
PK21003-14 s I/O Configurationslines can also operate at up to 38,400 baud (57,600 with the optional9.216-MHz clock upgrade).A second RS-232 port can
PK2100System Development s 4-1SYSTEM DEVELOPMENTChapter 4 describes the programming support for the PK2100.
PK21004-2 s System DevelopmentGate programming is not C programming. It is done with anapplication program, written in C, that modifies the param-et
PK2100System Development s 4-3Full C-Language ProgrammingFull C-language programming may access all the features available inDynamic C and its librari
PK21004-4 s System DevelopmentThe following preprocessor variables control features of the virtual driver. #define N_WATCHDOG nnSpecify the number o
PK2100System Development s 4-5 lcd_printf( long cursor, char *fmt, arg... )Print on the liquid crystal display screen. The variable cursordetermines
PK21004-6 s System DevelopmentVirtual Driver VariablesThe variables described here are defined in CPLC.LIB. The virtual driverupdates the input vari
PK2100System Development s 4-7TimersThere are 10 virtual timers. Each timer has an input flag, an output flag,and a reload value.T1IN, T2IN ... T10I
PK2100iv s ContentsVirtual Driver... 4-3Invoking the Virtual Driver
PK21004-8 s System Development$Refer to the Dynamic C manual for a discussion on memorymapping and remote downloading and execution of code.Downloadi
PK2100System Development s 4-9For example, to read and write from serial port 0:char ch;ch = inport( RDR0 );outport( TDR0, ch );Ports may be polled or
PK21004-10 s System DevelopmentThe serial ports may be polled or interrupt-driven. A polling driver teststhe ready flags (TDRE and RDRF) until a rea
PK2100Software Reference s 5-1SOFTWARE REFERENCEChapter 5 presents information on the Dynamic C software drivers andcommunication software for the PK2
PK21005-2 s Software ReferenceDriver SoftwareDrivers in the Dynamic C software library make it easy to communicatewith the PK2100 inputs and outputs.
PK2100Software Reference s 5-3Analog InputThe A/D system relies on software calibration, using calibration constantsstored in the system EEPROM. Unca
PK21005-4 s Software Reference int up_adtest( int channel, int testval )Returns 1 if external voltage is greater than test value expressed as anuncal
PK2100Software Reference s 5-5This relationship is shown in Figure 5-1 for Channel 1.U1HIGH = up_uncal( 8000 );U1LOW = up_uncal( 7900 );U1IN = up_a
PK21005-6 s Software Reference void up_dac420( int current )Sends a current value to the DAC output channel. The current isspecified such that 1000
PK2100Software Reference s 5-7 uint DMASnapShot( byte channel, uint *counter )This function reads the number of pulses that a DMA ch
PK2100 Contents s vAppendix B: Specifications B-1Hardware Dimensions...B-2Jumper
PK21005-8 s Software ReferenceThe following routines read and write the clock:int tmc_wr( struct tm *x ); // write the clockint tmc_rd( struct tm *x
PK2100Software Reference s 5-9 void lc_init_timer1( uint count )Initializes the timer reload register. The term count is expressed asshown below for
PK21005-10 s Software Reference void lc_wait()Waits for the LCD to become free (i.e., not busy).EEPROM Read / Write int ee_rd( int address )Reads EE
PK2100Software Reference s 5-11It may seem to be contradictory to write to ROM, but this ispossible with flash EPROM, where the flash memory istreated
PK21005-12 s Software ReferenceTable 5-1. PK2100 Support LibrariesLibrary DescriptionZ0232.LIB RS-232 library for the Z180 port 0.MODEM232.LIB Miscel
PK2100Software Reference s 5-13Table 5-2. Sample Programs in SAMPLES\CPLCProgram Description5KEYCODE.C Code-driven sample program for the five-keysys
PK21005-14 s Software ReferenceTable 5-3. Sample Communication Programs in SAMPLES\NETWORKSample DescriptionRS232.C RS-232 communication with a PC du
PK2100 Appendix A: Troubleshooting s A-1APPENDIX A: TROUBLESHOOTING Appendix A provides procedures for troubleshooting system hardwareand software.
PK2100A-2 s Appendix A: TroubleshootingOut of the BoxCheck the items listed below before starting development. Recheckingmay help to solve problems
PK2100 Appendix A: Troubleshooting s A-3Dynamic C Will Not StartIf Dynamic C will not start, an error message on the Dynamic C screen(for example, T
PK2100vi s Contents
PK2100A-4 s Appendix A: TroubleshootingCommon Programming Errors Values for constants or variables out of range. Counting up from, or down to, one
PK2100 Appendix B: Specifications s B-1APPENDIX B: SPECIFICATIONSAppendix B provides the dimensions and specifications for the PK2100controller.
PK2100B-2 s Appendix B: Specificationsmenusetupitem fieldrunup downhelpinitF2 F3 addF4 delF1D3D4D5/C1AD6/C1BD7/C2AGNDGNDTx–Tx+Rx–Rx+C2B+C2B–D2D1GNDU6
PK2100 Appendix B: Specifications s B-3Table B-1 presents the specifications for the PK2100 series of controllers.Table B-1. PK2100 SpecificationsB
PK2100B-4 s Appendix B: SpecificationsJumper and Header SpecificationsFigure B-3 shows the locations of the PK2100 headers and jumpers.H11J3J911J1114
PK2100 Appendix B: Specifications s B-5Table B-3. PK2100 Jumper ConnectionsHeader Pins Description1-2 Connect if using 32K RAM or 128K RAM.2-3 Conn
PK2100B-6 s Appendix B: SpecificationsTable B-5. PK2100 Header J4 ConnectionsPins Description2-3 Place PK2100 in programming mode at 38,400 bps.6-7
PK2100 Appendix B: Specifications s B-7ConnectorsThe ideal conductor for a screw clamp terminal is a single, solid conduc-tor. However, bare coppe
PK2100B-8 s Appendix B: Specifications
PK2100 Power Management s C-1APPENDIX C: POWER MANAGEMENTAppendix C provides detailed information on power systems and sources.
PK2100About This Manual s viiABOUT THIS MANUALThis manual provides instructions for installing, testing, configuring, andinterconnecting the Z-World P
PK2100C-2 s Power ManagementPower Failure InterruptsThe following events occur when power fails:1. The power-failure nonmaskable interrupt (NMI) is tr
PK2100 Power Management s C-3Do not forget the interaction between the watchdog timer and the power-failure interrupt. If a brownout causes an exten
PK2100C-4 s Power Management
PK2100 Appendix D: I/O Map and Interrupt Vectors s D-1APPENDIX D: I/O MAP ANDINTERRUPT VECTORS
PK2100D-2 s Appendix D: I/O Map and Interrupt VectorsI/O MapThe internal registers for the input/ouput devices built into to the Z180processor occupy
PK2100 Appendix D: I/O Map and Interrupt Vectors s D-3Table D-1. Addresses 00-3F for Z180 Internal I/O Registers (concluded)Address Name Descriptio
PK2100D-4 s Appendix D: I/O Map and Interrupt VectorsTable D-2 and Table D-3 present the I/O addresses that control I/Odevices external to the Z180 p
PK2100 Appendix D: I/O Map and Interrupt Vectors s D-5Table D-2. Write Registers (concluded)Address Bit(s) Symbol Function0x9D 0 DRV5 Digital outpu
PK2100D-6 s Appendix D: I/O Map and Interrupt VectorsInterrupt VectorsMost interrupt vectors can be altered under program control. The ad-dresses ar
PK2100 Appendix D: I/O Map and Interrupt Vectors s D-7Jump VectorsThese special interrupt vectors occur in a different manner. Instead ofloading th
PK2100viii s About This ManualTerms and AbbreviationsTable 1 lists and defines terms and abbreviations that may be used in thismanual.ConventionsTabl
PK2100D-8 s Appendix D: I/O Map and Interrupt VectorsInterrupt PrioritiesThe interrupt priorities are listed below in descending order.1. Trap (Illeg
PK2100 Appendix E: EEPROM s E-1APPENDIX E: EEPROM
PK2100E-2 s Appendix E: EEPROMPK2100/PK2120 24-V Version CalibrationTable E-1 presents the calibration constants for the PK2100/PK2120, thestandard 2
PK2100 Appendix E: EEPROM s E-3Table E-1. Calibration Constants for PK2100/PK2120 EEPROM (continued)Address Definition0x15CFor the standard PK2100,
PK2100E-4 s Appendix E: EEPROMPK2110/PK2130 12-V Version CalibrationTable E-2 presents the calibration constants for the PK2110/PK2130, the12-volt ve
PK2100 Appendix F: PLCBus s F-1APPENDIX F: PLCBUSAppendix F provides the pin assignments for the PLCBus, describes theregisters, and lists the soft
PK2100F-2 s Appendix F: PLCBusPLCBus OverviewThe PLCBus is a general-purpose expansion bus for Z-World controllers.The PLCBus is available on the BL1
PK2100 Appendix F: PLCBus s F-3The PLCBus consists of the following lines. /STBXnegative-going strobe. A1XA3Xthree control lines for selecting
PK2100F-4 s Appendix F: PLCBusThere are eight registers corresponding to the modes determined by buslines A1X, A2X, and A3X. The registers are liste
PK2100 Appendix F: PLCBus s F-5Place an address on the bus by writing (bytes) to BUSADR0, BUSADR1and BUSADR2 in succession. Since 4-bit and 8-bit a
PK2100About This Manual s ix Pin Number 1A black square indicatespin 1 of all headers and jumpers.IconsTable 3 displays and defines icons that may b
PK2100F-6 s Appendix F: PLCBusZ-World provides software drivers that access the PLCBus. To allowaccess to bus devices in a multiprocessing environme
PK2100 Appendix F: PLCBus s F-7Digital output devices, such as relay drivers, should be addressed withthree 4-bit addresses followed by a 4-bit data
PK2100F-8 s Appendix F: PLCBusThere are 4-bit and 8-bit drivers. The 4-bit drivers employ the followingcalls. void eioResetPlcBus()Resets all expan
PK2100 Appendix F: PLCBus s F-9 void set4adr( int adr )Sets the current address for the PLCBus. All read and write operationsaccess this address u
PK2100F-10 s Appendix F: PLCBus char read4data( int adr )Sets the last four bits of the current PLCBus address using adr bits 811, then reads four
PK2100 Appendix F: PLCBus s F-11 void set8adr( long address )Sets the current address on the PLCBus. All read and write operationswill access this
PK2100F-12 s Appendix F: PLCBus
PK2100 Appendix G: Battery s G-1APPENDIX G: BATTERYAppendix G provides information about the onboard lithium battery.
PK2100G-2 s Appendix G: BatteryStorage Conditions and Shelf LifeThe battery on the PK2100 will provide approximately 9,000 hours ofbackup for the rea
PK2100 Appendix G: Battery s G-3Battery Cautions Caution (English)There is a danger of explosion if battery is incorrectly replaced.Replace only wi
Comentarios a estos manuales