Home
XP8700 and XP8800 - Digi International
Contents
1. ke e KKK Simulate origin signal FEI III EE EEEE E IIA void wait origin int id define ORG 0x04 bit 2 printf Connect ORG to GND printf to simulate origin signal while smc statO id 8 ORG runwatch printf ORG detected n RRR KK Simulates end limit signal Dir CW or CCW HK IK KK KKK IK KK KKK e e e f void wait_EL int id int dir int mask bit 0 for EL bit 1 for EL char sign or 9 if dir mask 2 sign direction CW Jelse mask 1 sign direction CCW printf Connect EL c to GND sign printf to simulate end limit while smc statO id amp mask runwatch printf end limit detected n K KKK KK KKK KKK HK KKK RRR define CCW 0 counterclockwise direction define CW 1 clockwise direction RRR KKK KKK KKK KKK KKK HK KKK k k k k HK main int FL 10 low speed 10 pps int FH 100 high
2. 87 Index 117 software functions oe eee 35 76 libraries 35 76 96 XP8700 29 36 37 38 40 41 KP8800 77 79 81 software reset 8800 63 8 specifications 8600 106 XP8900 107 aaa 37 status bits 66 STEP LIB 75 stepper motor controller 50 suspend 31 42 T TERMINAL 42 43 terminating character 39 d 25 time delay 42 transmitter holding register 25 two phase mode XP8800 5 stes 57 PDT 29 TXxEMI nie 30 U 40 41 2 internal register 27 reading 26 37 39 40 writing 26 38 39 40 UART LIB 27 art 37 VART CR 38 uart reg 37 uart reg 38 uart reset 27 37 UART 5 37 UART232 LIB 38 UARTADDR definition 38 118 Index 38 uartbinaryset 38 uartmodemset 38 uartmodemstat 38 4
3. PCL AK Signals Meaning ics ao mb wR 0 0 0 1 0 Write command buffer 0 0 1 1 0 Write register bits 0 7 0 1 0 1 0 Write bits 8 15 0 1 1 1 0 Write register bits 16 17 counter 0 0 0 0 1 Read status 0 0 1 0 1 Read register bits 0 7 0 1 0 0 1 Read register bits 8 15 Read register bits 16 17 counter 0 1 1 0 1 with assorted status bits 1 x x x x D0 D7 at high impedance 0 x x 0 0 Inhibit Registers Table 7 2 lists the PCL AK registers Table 7 2 PCL AK Registers Register Bits Description 18 Down counter gives the number of pulses to generate for Preset Mode This register is readable When read it gives the number of remaining pulses FL 13 Low frequency from which to accelerate or decelerate 13 High frequency from which to decelerate or accelerate ADR 10 Acceleration deceleration rate RD 16 Ramp down point When the PCL AK is generating pulses in the Preset Mode the ramp down point is the point number of pulses before end of count at which the PCL AK will start ramping down decelerating from high speed to low speed This register is readable MUL 10 Multiplier register interacts with FL and FH to give various pulse rates 64 Configurations XP8800 Acceleration Deceleration Rate ADR Register The ADR register with settings from 2 to 1023 governs the ramping up acceleration and ramping down
4. Dg 098 194 00095 p 096 dg Bi d 8 gi i uU x ui 1 ug alle 5 Bu jm nog Jp o o i i o o dg 110 Cod mn Bin m 00 o o 14 do d es B I gig o o 07 Dn q Dn De T B ye h e ALI J H1 7 H2 X1 RN4 i l edi 1 R2 D3 D4 D5 D6 E bu Motor S Driver o o o H6 o 96965 6069 69 695 69 609 0 09 9 9 Screw Terminals Figure 6 1 XP8800 Board Layout 52 Getting Started XP8800 Connecting Expansion Boards to Z World Controller Use the 26 conductor ribbon cable supplied with an expansion board to connect the expansion board to the PLCBus on a Z World controller See Figure 6 2 The expansion board s two 26 PLCBus connectors and P2 are used with the ribbon cable Z World recommends using the cable supplied to avoid any connection problems Controller G00000000000090009099 O PLCBus Port 8 lO O XP8800 Controller With PLCBus Figure 6 2 Connecting XP8800 Expansion Board to Controller PLCBus ze Pin 1 H1 n e Be sure power to the co
5. 102 addresses eacus 98 devices 98 9 8700 8800 expansion bus functions 100 101 102 103 rules for devices 98 software drivers 99 expansion register 98 2 17 11 99 EZIOLGPL LIB 99 EZIOMGPL LIB 99 EZIOPL2 LIB 99 EZIOPLC LIB 99 EZIOTGPL 99 F FFULL 2 1 23 25 FIFQ 25 FIFO full 23 25 x WS elus 78 find 37 framing errors sees 21 function libraries 96 H half step mode 8800 57 hardware reset 8800 60 61 3 Hayes compatible modem 29 1 HSTEP 56 IMR x 25 inport 100 101 103 inputs digital esses 99 installation expansion boards tech 17 53 110 111 INTI framework 2222 4 4 30 8700 14 30 31 interrupt mask register 25 interrupt service request KP8800 seen teh 78 XP8700 XP8800 interrupt service routine 31 42 interrupt status register 25 interrupts 4442427 95 98 routines 2 2 22 98 XP8700 none 14 30 880
6. 37 102 8 103 read8dataO0 37 8700 8800 read8datal 37 reading data on the PLCBus e Rae MR GE 96 101 receive buffer 39 receiver holding register 25 receiver ready 23 25 reference clock quadrature decoder 70 relays 94 AVETS o EE N 99 relocate_intl 31 77 reset expansion boards 100 XP8700 asd esten 40 8800 60 RAR 25 ribbon cables 110 ROM code 31 RS 232 command register 23 M 27 38 RS 232 communication 29 7 34 40 41 42 4 24 CTS RTS control 39 downloading 40 uploading 222 41 RIS onbres EDO 39 RX ists Uo s 29 RxRDY 23 25 30 S sample programs 8700 42 XPBS8800 5 aciei 87 2691 21 screw terminal block 8800 56 SETIOQ ovens 94 select PLCBus address 100 sense inputs 59 12 100 Setl6adr een 100 set24adr 34 36 102 XP8
7. Random Access Memory Real Time Clock SIB Serial Interface Board 5 Static Random Access Memory UART Universal Asynchronous Receiver Transmitter Icons Table 2 displays and defines icons that may be used in this manual Table 2 Icons Icon Meaning Icon Meaning Refer to or see Note Please contact Ti p Tip A Caution A High Voltage Factory Default viii About This Manual XP8700 XP8800 Conventions Table 3 lists and defines the typographical conventions that may be used in this manual 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 AF XN 2013 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 us 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 directive is optional lt gt Angle brackets occasionally enclose classes of terms alblc A vertical bar indicates that a choice should be made from among the items listed Pin Num
8. 57 67 57 67 PHD des 57 67 phy ewe 41 physical addresses 8700 34 8800 74 layout 2 20 XPS8800 56 116 Index PLC EXP LIB 35 74 PLCBus 74 94 95 96 98 99 26 pin connector pin assignments 94 4 bit operations 95 97 8 bit operations 95 97 addresses 96 97 installing boards 17 53 110 interrupt service request 77 reading data 96 7 0 ribbon cables 110 special cabling 17 53 writing data 96 cable eeu 111 plcbus 31 38 42 power consumption 18 54 power failure 8800 56 57 power up 5800 ere 60 PROCOM 42 43 prompt eene tent 40 pulse generator chip 62 74 61 quadrature decoder 50 60 62 69 74 reference 1 70 reset ted e 60 61 quadrature inputs 57 59 R ramp down point 8800 66 readl2data 101 read24data 103 read24data0 34 37 read24datal
9. 71 Chapter 8 Software Reference 73 Expansion Board Addresses 74 Logical Addresses eR UO EE 75 Dynamic C Libraries 76 XPS8800 Software iii do Ce eerie bei ania T Data Structures idee ate e pP is 77 ETE Ue 78 XP8800 Driver Functions 4 40 0 7 79 Miscellaneous XP8800 Function Descriptions 81 87 iv Table of Contents XP8700 XP8800 APPENDICES Appendix A PLCBus 93 4 Allocation of Devices on the 2202 0404 98 A Bit Devices eere eedem eio 98 B Bit Devices REM 99 Expansion Bus Software sss 99 Appendix B Specifications 105 XP8700 Hardware Specifications esee 106 XP8800 Hardware Specifications esses 107 Appendix C Connecting and Mounting Multiple Boards 109 Connecting Multiple Boards 2 10 Mounting Expansion 112 Index 113 XP8700 XP8800 Table of Contents v Blank Table of Contents XP8700 XP8800 THis MANUAL This manual provides instructions for installing testing configuring and interconnecting the Z World XP8700 RS 232 and XP8800 motion control expansion boards 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 en
10. EZIOCMMN LIB BL1200 BL1600 PK2100 PK2200 EZIOPBDV LIB BL1200 BL1600 PK2100 PK2200 EZIOPLC LIB BL1200 BL1600 PK2100 PK2200 EZIOPLC2 LIB BL1700 EZIOBL17 LIB BL1700 PLC EXP LIB BL1200 BL1600 PK2100 PK2200 Before using one of these libraries in an application first include the library name in a use command For example to use functions in the library PLC_EXP LIB be sure there is a line at the beginning of the program in the following format use PLC EXP LIB 76 Software Reference XP8800 XP8800 Software The sample programs SM DEMO1 C SM DEMO2 C and SM DEMO3 C in the Dynamic C SAMPLES PLCBUS subdirectory illustrate the use of these functions The software is designed to simplify the task of using the XP8800 on the PLCBus Z World recommends using the software or at least following the guidelines for the software structure 1 Only access the control register using driver functions These func tions keep track of the shadow variables that prevent inadvertently changing other control lines 2 Initialize and use the arrays designated for handling multiple board addresses and status These are described in detail 3 Ifusing interrupts make the declaration define USE STEPPER early in the main program This tells the PLCBus interrupt service to call the function sm int 4 Also if using interrupts add the call relocate intl1 This connects the proper PLCBus interrupt service routine to
11. Performs a hardware reset XP8800 identified by index This resets the PCL AK pulse generator and the quadrature decoder counter and disables the motor driver IC and sets it to two phase mode The function also sets the control register s two select lines to 00 XP8800 Software Reference 81 void sm_ctlreg int index int value Writes value to the control register on the XP8800 specified by index The function updates the shadow variable for the control register void sm drvoe int index int onoff Turns the motor driver IC of the XP8800 specified by index on or off The term onoff is Boolean when zero the motor driver IC gets turned off Otherwise it gets turned on int sm find boards Searches for all possible XP8800s and fills in the XP8800 table which is sorted according to physical board address The table holds physical addresses in the array sm addr The table also holds status bytes and interrupt service flags which this function initializes The function return is the number of boards found The function places a marker 1 or OxFFFF following the last entry in the table The function sends a control register value of 0xA7 1010 0111 to all XP8800s found This puts the motor driver IC in two phase mode and turns it off makes the select lines 00 turns the LED D2 on and resets both the PCL AK pulse generator and the quadrature counter The function return is the number of XP8800 boards on the
12. 0 00 2nd address byte 5x3 mode outO0 BUSADR1 a outO0 BUSADR2 a 1 CSR UART s clock select register 1 0 18 3rd address byte 5x3 mode Selected 1 0 19 address byte for outO0 BUSADR2 a DATA register 1 1 a 0xcC 9600 baud for receive amp transmit outO BUSWR a 28 Configurations XP8700 Example 2 Read the RHR receiver holding register 1 0 04 lst address byte 5x3 mode outO0 BUSADRO a 1 0 00 2nd address byte 5 3 mode out0 BUSADR1 a 1 0 18 3rd address byte 5x3 mode outO0 BUSADR2 a 1 UART s receive holding register outO BUSWR a selected 1 0 19 address byte for outO0 BUSADR2 a register 1 0 BUSRD1 a get the character from RHR Communicating The XP8700 can communicate with any RS 232 device such as a COM port on a PC adumb terminal or amodem Figure 3 6 shows typical RS 232 communication arrangements for the XP8700 PC or Z World __ 8700 dumb Controller terminal Z World Ly L Controller XP8700 HOH Modem Null Line Modem Figure 3 6 Placement of UART in Communication Sequence Z World recommends using a Hayes SmartModem or compatible modem Otherwise the RTS CTS and DTR lines must be tied together
13. Connect another expansion board to the first expansion board connecting each board s header to the adjacent board s header 2 Figure C 1 illustrates a controller with expansion boards attached 1 P2 P1 P2 0 _ _ 3 JO f EL E EPROM L B Bl 2180 25 8 lt EE peer IRE 25555 9 5 0 Dm 0000 90000000000 9 0000000000 99oo 10 p e P nnnm XP870 XP8400 Controller Figure C 1 Connecting Multiple Expansion Boards Do not twist the ribbon cable or mount the expansion boards upside down Damage may occur Be sure Pin 1 of P1 and P2 of each board matches up with Pin 1 of the previous board Pin 1 should be at the lower right when the expansion board is right side up that is the board markings are right side up When several expansion boards are connected there may be a voltage drop along the network of expansion
14. L JOP2 01 OP1 7 Relay 0 mE Relay 0 Relay 1 E Relay 1 Relay 2 11 Relay 2 m Relay 3 E Relay 3 Relay 4 11 Relay 4 d Relay 6 0 28 Relay 6 T Relay 5 lo a Relay 5 e 52 m Relay 7 i 5 Relay 7 2 i ES sx INO d3 2180 Controller 6 a os c 00 Figure 6 2 Use of Y Cable to Connect Multiple Expansion Boards For more information call your Z World Technical i Support Representative at 530 757 3737 XP8700 XP880 Connecting and Mounting Multiple Boards 111 Mounting Expansion Boards The XP8700 and XP8800 expansion boards can be installed in modular plastic circuit board holders attached to a DIN rail a widely used mount ing system as shown in Figure C 3 The circuit board holders are 77 mm wide and come in lengths of 11 25 mm 22 5 mm and 45 mm The holders available from Z World snap together to form a tray of almost any length Z World s expansion boards are 72 mm wide and fit directly in these circ
15. PFO can be connected to the NMI or interrupt line on the master controller IPULSE A low pulse on this line signals a one step move to the TTL motor driver IC WAVE Together with the HSTEP signal WAVE determines the operation of the TTL motor driver IC single phase two phase or half step IWDO This is the active low open collector watchdog output line When the watchdog is enabled this line will go low upon a watchdog timeout to generate a hard reset at the PCL AK pulse generator 5 V is the regulated PLCBus 5 V digital power supply This supply should not be used for motor power but can be used to power external logic 24 V is the unregulated PLCBus 24 V supply Though nominally 24 V this can be anywhere from 9 V to 30 V DC This supply may be used to drive the motor if the controller s power supply can handle the current requirements Screw Terminal Block H6 Signals PHA PHB PHC PHD are the open collector motor control outputs They connect to the motor phase lines and can sink up to 1 A depending on the ambient temperature AIN BIN are the TTL compatible quadrature encoded input signals ORG is the active low origin pulse input JORG goes directly to the PCL AK pulse generator thereby allowing the PCL AK to generate pulses until it receives an origin signal ORG is readable in the PCL AK address 0 status bits EL EL are the active low end limit inputs one for the
16. 7 4 7 2 9 R1 R2 D1 D2 Figure 2 1 XP8700 Board Layout 16 Getting Started XP8700 Connecting Expansion Boards to Z World Controller Use the 26 conductor ribbon cable supplied with the XP8700 to connect the XP8700 to the PLCBus on a Z World controller See Figure 2 2 The XP8700 s two 26 PLCBus connectors 2 are used with the ribbon cable Z World recommends using the cable supplied to avoid any connection problems Controller 8888888888888888888 O PLCBus Port 6 1 0 l pini of 2 iF 9000 6088098808660866080 O 8700 Controller With PLCBus Figure 2 2 Connecting XP8700 Expansion Board to Controller PLCBus Be sure power to the controller is disconnected before adding any expansion board to the PLCBus Follow these steps to connect an expansion board to a Z World controller 1 Attach the 26 pin ribbon cable to the expansion board s P2 or H2 PLCBus header 2 Connect the other end of the ribbon cable to the PLCBus port of the controller Be sure pin 1 of the connector cable matches up with pin 1 of both the controller and the expansion board s 3 If additional
17. GND 25 VCC 5 V Multiple expansion boards may 24 23 LCDX o 21 WRX be linked together and con 1 20 0 19 nected to a Z World controller D3X 17 D2X to form an extended system D5X 8 Grex 18 D4X y D7X 13 D6X Figure A 1 shows the pin la GND 12 0 6 11 1 gure shows the p yout GND Sole A2X for the PLCBus connector GND 0 7 GND OO 5 strobe STBX 24 V 3 attention 5 V VCC om GND Figure A 1 PLCBus Pin Diagram 94 PLCBus XP8700 XP8800 Two independent buses the LCD bus and the PLCBus exist on the single connector The LCD bus consists of the following lines LCDX positive going strobe RDX negative going strobe for read WRX negative going strobe for write e 0 4 line for LCD register selection DO0X D7X bidirectional data lines shared with expansion bus The LCD bus is used to connect Z World s OP6000 series interfaces or to drive certain small liquid crystal displays directly Figure A 2 illustrates the connection of an OP6000 interface to a PLCBus header Yellow wire on top PLCBus Header Note position of connector relative to pin 1 From OP6000 KLB Interface Card Header J2 Pin 1 Figure A 2 OP6000 Connection to PLCBus Header The PLCBus consists of the following lines e STBX negative going strobe e AIX A3X three control lines for selecting bus operati
18. be used For example use UART SR to read the channel status register The function returns data from the register XP8700 Software Reference 37 void uart reg wr long uart addr char regnum char data Writes data to the SCC register regnum on the specified XP8700 at PLCBus address uart_addr Does not check to see if the board exists The value regnum represents the intended register and is sent to the board s control register The codes in UART232 LIB be used For example use UART_CR to write to the command register void uartbinaryset void Puts the serial receiver in binary mode This means that all characters received are placed in the receive buffer void uartbinaryreset Places the serial receiver in ASCII mode where the BACKSPACE character 0x08 is parsed out of the receive buffer Character echo also resumes if it was selected int uartmodemstat Returns the status of the modem RETURN VALUE 1 if the modem is in command mode 0 if the modem is in data mode 1 open to communication int uartmodemset Returns information about modem selection RETURN VALUE 1 if the modem option is selected otherwise 0 RS 232 Communication Support These functions from UART232 LIB support RS 232 communication by the XP8700 expansion board Be sure to include the following definition when using these functions in an application define USE UARTEXP This declaration ensures that the comm
19. bits of data from the PLCBus with BUSADRO cycle RETURN VALUE PLCBus data in the lower four bits the upper bits are undefined LIBRARY DRIVERS LIB XP8700 XP8800 PLCBus 101 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 BUSADRO cycle PARAMETER adr bits 8 11 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 LIB EZIOMGPL LIB void writel2data int adr char dat Sets the current PLCBus address then writes four bits of data to the PLCBus PARAMETER adr is the 12 bit address to which the PLCBus is set dat bits 0 3 specifies the data to write to the PLCBus LIBRARY DRIVERS LIB void write4data int address char data Sets the last four bits of the current PLCBus address then writes four bits of data to the PLCBus PARAMETER adr contains the last four bits of the physical address bits 8 11 dat bits 0 3 specifies the data to write to the PLCBus LIBRARY DRIVERS LIB The 8 bit drivers employ the following calls void set24adr long address Sets a 24 bit address three 8 bit nibbles on the PLCBus read and write operations
20. errors break detection and generation and echo There are two diagnos tic modes The chip also has a multifunction 16 bit counter time The SCC2691 chip generates interrupts under seven maskable conditions It has low power mode and a wake up mode Receiver data are quadruple buffered FIFO The SCC2691 is controlled by reading or writing its internal registers A counter or timer may be set up RS 232 communication may be initiated or control interrupts may be initiated Options include setting baud rates parity and ot Figure 3 2 shows a block diagram of the SCC2691 architecture 8 Communication D0 D74 7 Bus Buffer TL 7 Transmit Holding L gt TxD Register READ f 1 4 Receiver Holding Operation Control Registers 3 lt RxD 0 2 SS Address Decode MRi 8 MR2 RESET gt Read Write Control CR ENABLE gt 1 SR Interrupt Control IINTR IMR Timing ISR Baud Rate Generator Clock Selectors Pins Counter Timer x2 Change of State MPI gt Detector CSR MPO Function Select Logic ACR CTUR CTLR Figure 3 5 SCC2691 Architectural Block Diagram XP8700 Configurations 21 There are 14 internal registers 7 of which be read and 9 of which be written as shown in Table
21. 1 set to enable the LT1180 chip To reset the UART call uart reset Examples The following examples suppose that there is one XP8700 on the bus and that its addresses are 0x040018 control register and 0x040019 data register The examples show the basics Higher level functions are available XP8700 Configurations 27 Table 3 6 XP8700 Control Register Constants to Select UART Internal Register Internal Register Usage 2 0 Control Value UART_MR1 Mode reg 1 R W 000 0x02 00 0010 UART_MR2 Mode reg 2 R W 000 0x02 00 0010 vanr sR Channel status reg 001 0 12 010010 UART_CSR Clock select reg W 001 0x12 01 0010 varT Commandreg w 00 0x06 000110 Receive holding R 011 0x16 01 0110 reg UART_THR Transmit holding W 011 0x16 01 0110 reg Auxcontrolreg w 100 0x03 000011 UART_ISR Interrupt status R 101 0x13 01 0011 reg UART_IMR Interrupt mask reg W 101 0x13 01 0011 UART CTU Counter timer R 110 0x07 00 0111 upper UART CTUR C T reload upper W 110 0x07 2 00 0111 UART CTL Counter timer R 111 0x17 201 0111 lower C T reload lower W C T reload lower W 111 0x17 201 0111 Example 1 Write the clock select register CSR to set the UART to 9600 bps 1 0 04 156 address byte 5x3 mode outO BUSADRO a 1
22. 3 1 Table 3 1 SCC2691 UART Internal Registers Address Write 0 0 MRI MR2 MRI MR2 1 SR CSR 0 Reserved CR 1 RHR THR 0 Reserved ACR 1 ISR IMR 0 CTU CTUR 1 The address bits 2 0 specify register only partially The full determi nation of which register is accessed depends on the state of the UART If the UART is being read one set of registers is addressed If it is being written the other set is addressed Furthermore MR1 mode register 1 is selected when the UART is reset When is read or written the UART switches to MR2 and thereafter uses MR2 MRI can be reselected by a command The registers are described below MR1 MR2 are mode registers 1 and 2 The mode registers control much of the serial communication to and from the UART RxRTS Rxint error parity control select mode parity mode type bits per char channel mode E stop bit length 9 16 2 bits 22 Configurations XP8700 SR is the channel status register The upper half of this register repre sents communication conditions The lower half represents the condition of the receive and transmit buffers MRI bit 6 controls whether FIFO full FFULL or Receiver ready RxRDY is reported overrun tena TxRDY FIFO received framing parity RxRDY error full break error error CR is the RS 232 command register disable
23. 37 38 40 41 Writing esee 40 KPIS teilte 50 ttes 57 58 57 58 IDRVOE 56 57 JEL 57 JORG inso acinar 57 57 IPULSE 62 66 67 IRESET docu 63 ISD zoe 57 nat etre RR 57 addresses 74 75 ADR ones 65 57 aternate USES 62 BIN enhn ee 57 block diagram 62 board layout 52 control register 60 70 74 XP8700 XP8800 XP8800 end limits 2 2 2 2 62 features 50 Blot EE 65 GND sre 56 58 hardware reset 61 headers eset aie et 74 HS tite ete 56 57 HSTEP 56 57 input POWEF 54 Interrupts eee 71 78 jumper settings JJ aime 61 tates ec 58 LEDS ade 74 see 65 optically isolated inputs 59 Ost PR 62 56 2 56 66 60 sample connections 58 71 SEE1 71 slow 62 software 77 79 81 watchdog 22222422221 57 56 57 8900 94 Y c bles usse Re 111 Index 119 Blank 120 Index XP8700 XP8800 Z WORLD Z World Inc 2900
24. PLCBus that respond to the search The 8800 table consists of these four arrays sm addr a board s physical PLCBus address sm stat holds the last status address 0 read from the board s PCL AK sm flag when non zero indicates the XP8800 has requested an interrupt and is awaiting service sm shadow holds the last value written to the board s control register This function is among the first to call when operating XP8800 expansion boards After the table is initialized function calls will generally refer to XP8800s by their table index void sm hitwd int index Resets the watchdog timer on the XP8800 specified by index It does this by reading the quadrature counter The quadrature chip does not have to be present 82 Software Reference XP8800 void sm_int This is a general purpose XP8800 function that can be called by the PLCBus interrupt service routine ISR This function checks the status at PCL AK address 0 of all boards updating the sm_stat array When an interrupt request is detected the appropriate sm_flag value is set and the function issues a software reset to the PCL AK to deactivate the interrupt request The application must then monitor the interrupt service flags to deter mine when an operation has been completed To use this function do the following 1 Call sm_find_boards at the beginning of the application to initialize the XP8800 table 2 Add the following statement early in the
25. RS 232 Communication Support essere 38 XMODEM 444202 eene nenne ennt etienne tne 40 Miscellaneous Functions 41 Sample 1000 42 XP8700 XP8800 Table of Contents XP8800 Chapter 5 Overview 49 XP8800 Overview i detecte e ertt D edite GS 50 Features e UR 50 Chapter 6 Getting Started 51 8800 Components 52 Connecting Expansion Boards to Z World Controller 53 Setting Expansion Board Addresses 54 XP8800 Addresses e eaten A ten ee 54 ed ea eed 54 Chapter 7 Configurations 55 56 7 56 Screw Terminal Block Signals 1 57 58 Optional Optical Isolation esse 59 Using Expansion Boards 60 Resetting XP8800 Expansion 60 8800 Operation 31 c re eg ca e HE 62 PCL AK Pulse Generator essere 62 Communicating with the PCL AK 63 Iu 64 Acceleration Deceleration Rate ADR Register 65 Status Bits M M 66 UCNS5804 Motor Driver 67 Driver Powerom nnne ioo eet PI ERIS 68 Quadrature Decoder Counter essere 69 Control Register x ELATI e i Ue es 70 ere te rem rt re
26. Steps the motor on the XP8800 specified by index until the quadra ture decoder counter reaches the specified dest accuracy The movement is done at the slow rate specified the FL register of the PCL AK pulse generator The movement continues until the quadra ture counter reaches the zone of acceptance and then stops The parameter dir is Boolean if non zero motion is in the direction Otherwise motion is in the direction The function returns the reading of the quadrature counter when the function finally stops motion Inertia and step locations may make this value different from the final resting place of the motor s encoder The function issues a software reset to the PCL AK following the operation Example init init master sm find boards init all XP8800s smc setspeed 0 100 200 move at 200 pps smcq moveto 0 5000 1 25 to location 5000425 delay to allow time for motor to stop fully loc smq 268616 0 check final pos if loc gt 5025 overshot smc setspeed 0 100 20 move back 20 pps smcq moveto 0 5000 0 25 to location 5 86 Software Reference XP8800 The function smcq_moveto is not a PID loop It is the appli cation s responsibility to manage the final position of the mo tor The move speed encoder resolution and motor degrees phase will affect how precise you can get It is possible to miss a stop point if you s
27. accomplish this INT_VEC 0x18 plcbus_isr isr now at 2018 nodebug relocate_int1 4nt 0x2000 0x2017 jump addr vector char 0x2017 0xC3 jump instr in 2017 Do not use the above function when generating code to download to ROM or to RAM Simply make the following declaration INT_VEC INT1 VEC plcbus isr Delays Delays in the software are implemented with calls to suspend if the real time kernel is in use that is when RUNKERNEL is defined XP8700 Configurations 31 Blank 32 Configurations 8700 4 CHAPTER 4 SOFTWARE REFERENCE Chapter 4 describes the Dynamic functions used to initialize the XP8700 expansion boards and to control the resulting outputs The following major sections are included Expansion Board Addresses Dynamic C Libraries e XP8700 Software XP8700 Software Reference 33 Expansion Board Addresses There are two registers on an XP8700 the control register and the data register Each is addressable on the PLCBus The 15 bit address is determined by jumpers across header J1 J1 can be set four different ways giving four boards per bus Each register s address has the following format 00100 00000 xy00R where 0 for the control register 1 for the data register x 0 when pins 3 4 on are connected and 0 when pins 1 2 on are connected The 15 bit address can be placed on the bus using the functions set
28. application to link sm_int to the PLCBus ISR define USE STEPPER activate sm int 3 Add the following statement early in the application to ensure that the PLCBus interrupt line is activated outport ITC inport ITC amp OxFD enable If all motor processing 15 to be done in the background that is as part of the interrupt service open and edit STEP LIB Find sm int and replace the code between the labels mirq and fin with your own code void sm led int index int onoff Turns the LED D1 on the XP8800 specified by index on or off The value ono is Boolean when zero the function turns the LED off Otherwise it turns the LED on int sm poll unsigned int address Returns 0 if the XP8800 specified by address is present and respond ing on the PLCBus The parameter address must be a physical board address such as that returned by sm bdaddr jumpers PLCBus expansion boards respond to 8 BUSRDI cycle by sinking data line 0 normally high The board is not present if a 1 is returned void sm 100 int index Sets the select lines to 00 on the XP8800 specified by index void sm 56101 int index Sets the select lines to 01 on the XP8800 specified by index XP8800 Software Reference 83 void sm sellO int index Sets the select lines to 10 on the XP8800 specified by index void sm selll int index Sets the select lines to 11 on the XP8800 specified by index void smc cm
29. boards No action is necessary as long as the digital voltage VCC 18 greater than 4 9 V on the last board VCC be measured at pin 2 on header and GND is pin 1 on header 110 Connecting and Mounting Multiple Boards XP8700 XP8800 There are two ways to compensate for the voltage dropoff The easiest way is to connect 5 V DC and ground from the host controller to pins 2 and 1 of header on the last expansion board Another solution which can approximately double the number of boards that could otherwise be connected to a single controller is a Y cable available from Z World Figure C 2 illustrates the use of the Y cable O Jo RES P1 af eas 8 ae H Bn H 4 H 3 Asf 8 EB BB Enc gt BB Ec oo zii BP 0 But Q 5 2
30. byte Set shadow variable OR shadow variable 0x08 then outO BUSWR shadow control bits inO low BUSRDO get low byte Return counter value high lt lt 8 4 low In general there is no need to program the 8800 at these low levels Software in the Dynamic C STEP LIB library takes care of these details Logical Addresses Software in the Dynamic C STEP LIB library keeps information for all XP8800s on the PLCBus in a table sorted by XP8800 address Thus XP8800s have logical addresses that are simply indexes in the table For example suppose there are three XP8800s on the PLCBus with addresses of 3 0011 8 1000 and 13 1101 Table 8 1 shows the table used by the software The logical addresses for these 3 boards would be 0 1 and 2 The physical addresses are stored in the table The function sm ind boards sets up this table XP8800 Software Reference 75 Table 8 1 Example of STEP LIB Table for XP8800 Logical Addresses Index Address 0 0011 1 1000 2 1101 marker Dynamic Libraries Several Dynamic C function libraries contain the software functions described in this chapter The chart in Table 8 2 identifies which libraries must be used with particular Z World controllers Table 8 2 Dynamic C Libraries Required by Z World Controllers for XP8800 Expansion Boards Library Needed Controller DRIVERS LIB BL1200 1 1600 2100 2200
31. connected Each of the two registers on the XP8700 board is addressable on the PLCBus with the jumper connections on pins 1 4 of header J1 determining the address of the register as explained in Chapter 4 See Chapter 4 Software Reference for further details on Gv how to determine the physical address for XP8700 expansion boards Power Z World s expansion boards receive power from the controller over the 24 V and VCC lines of the PLCBus XP8700 expansion boards use VCC which is 5 V The XP8700 typically draws about 80 mA at 5 V 18 Getting Started XP8700 3 CONFIGURATIONS Chapter 3 describes the built in flexibility of the XP8700 expansion boards and describes how to configure the available inputs outputs The following sections are included XP8700 Pin Assignments Using D A Converter Boards XP8700 Configurations 19 XP8700 Pin Assignments There are two RS 232 connectors on the XP8700 expansion board One is a 10 pin header H1 and the other is a 6 wire RJ 12 phone jack H2 Either one can be used Figure 3 1 shows the pin assignments for header H1 and RJ 12 jack H2 OUT RTS 1 GND 2 TXD RXD 4 CTS 5 1 2 6 4 CTS RXD 5 6 OUT RTS pee WII GND 9 10 Header H1 RJ 12 Jack H2 Figure 3 1 XP8700 Header H1 and RJ 12 Jack H2 Using Expansion Boards The following steps summarize how to use the XP8700 exp
32. deceleration characteristics When started in a high speed mode the PCL AK pulse generator starts with the speed set in the FL register and accelerates to reach the speed set in the FH register The Z World reference clock frequency is 6 MHz Thus a clock period is 1 6 The time it takes to accelerate or decelerate is Tramp FH FL x rate in ADR 6 us The relationship between acceleration and the rate in ADR is acceleration QE pulses s ratein ADR The stepper motor might not operate if the ADR rate 1 too small because the acceleration will then be too fast The relationship between the value of a speed register FL or FH varies from 1 to 8191 and the actual output frequency of PCK AL is V a x pulses s HIGH 7 192 MUL x pulses s 19 78192 MUL The term MUL is the value ramp down point of the multiplier register and can be from 2 to 1023 With Z World s 6 MHz ref erence clock MUL 732 lt Frequency 732 421875 rounded off Referring to Figure 7 6 the number of pulses output dur Time ing is represented by lt the area of the shaded trap PES ezoid Figure 7 6 Calculating the Number of Pulses VL ow X Topec Numberof pulses pulses _ FI2 x ADR pulses 16384xMUL XP8800 Configurations 65 Status Bits Status bits are available at PCL AK address 0 and 3 The status bits for addres
33. direction the other for the direction These signals go directly to PCL AK pulse generator where they are typically used to indicate end of travel usually to stop pulse generation These signals are readable in the PCL AK address 0 status bits 150 SD are the active low slowdown inputs one for the direction the other for the direction These signals go directly to PCL AK pulse generator where they are typically used to force the PCL AK to decelerate to its slower speed These signals are readable in the PCL AK address 3 status bits XP8800 Configurations 57 K is protection for the driver chip is connected to the motor control voltage source through protective diodes can occur or performance can degrade if this connection is not made sure to connect to the motor s voltage source Damage 5 V is the regulated PLCBus 5 V digital power supply This supply should not be used for motor power but can be used to power external logic 24 V is the unregulated PLCBus 24 V supply Though nominally 24 V this can be anywhere from 9 V to 30 V DC This supply may be used to drive the motor if the controller s power supply can handle the current requirements GND is the PLCBus ground common to the entire system The motor s power supply ground should be connected here only There are two GND connections on H6 Sample XP8800 Connections Figure 7 2 shows an example of a
34. established an addressing scheme for the PLCBus on its controllers to allow multiple expansion boards to be connected to a controller Remember that each expansion board must have a unique PLCBus address if multiple boards are to be connected If two boards have the same address communication problems will occur that may go undetected by the controller XP8800 Addresses XP8800 expansion boards are shipped from the factory with no pins on header H4 connected An XP8800 expansion board may be assigned any one of 16 addresses using jumpers on the pins of header H4 The LED at D2 lights up whenever the XP8800 is addressed on the PLCBus See Chapter 8 Software Reference for further details on eo how to determine the physical address for XP8800 expansion boards Power Z World s expansion boards receive power from the controller over the 424 V and VCC lines of the PLCBus The XP8800 expansion boards use VCC which is 5 V The XP8700 draws from 40 mA quiescent to a maximum of 105 mA 54 Getting Started XP8800 7 I O CONFIGURATIONS Chapter 7 describes the built in flexibility of the XP8800 expansion boards and describes how to configure the available inputs outputs The following sections are included e XP8800 Series Pin Assignments Using D A Converter Boards XP8800 Configurations 55 XP8800 Pin Assignments External connections are made to the XP8800 expansion board using 5 a 14 pin
35. s data register has been addressed BUSRESET 0xC6 Resets all expansion cards on the PLCBus How ever an XP8700 does not respond to this The UART is reset with the RESET bit of the control register 26 Configurations XP8700 Controlling the UART To control the UART on the XP8700 data are sent to or read data from one of its internal registers This uses the XP8700 s control and data registers The control register looks like this m AO 41 2 Table 3 5 explains the meaning of the control bits Table 3 5 Explanation of XP8700 Control Register Bits Bit Meaning Enables the UART chip when low The UART must be enabled to read from it or write to it 0 2 Select one of the UART s internal registers The register selection depends also on whether you are reading or writing and on whether or MR2 has been selected RESET Resets the UART LT1180 on When set enables the LT1180 RS 232 driver When clear reduces power consumption Place one of the constants in Table 3 6 into the XP8700 s control register to select a UART internal register These constants are defined in UART232 LIB When the UART is reset it uses MR1 mode register 1 The UART automatically switches to MR2 whenever 15 read or written to and thereafter uses MR2 You can switch back to MRI with a command to the command register CR of the constants in Table 3 6 have bit
36. speed 100 pps int ADR 500 accel decel rate 500 int MUL 732 mekes FL ard units pos int ID 0 board index int i uplc init assume PK2200 or 2100 Reset PBus reset PLCBus with delay Reset PBus Wait Search PLCBus Build table if sm find boards 0 printf No XP8800s exit 0 Use first board Set up operation sm board reset ID sm drvoe ID 1 motor driver on sm led ID 1 LED on smc setmove ID OL FL FH ADR O0 MUL registers 88 Software Reference XP8800 find origin smc_seek_origin ID CCW 1 high speed wait_origin ID smc_softreset ID back amp forth for 0 i lt 3 i move till EL slowing down upon SD 0x42 01 0010 Qpmode pos dir not preset SD yes ro smc cmd ID 0x42 0x15 00x 10 101 Start High speed FH register smc cmd ID 0 15 wait EL ID CW wait for EL signal smc softreset ID move till EL slowing down upon SD Ox4A 01 1010 Q neg dir not preset SD yes smc cmd ID Ox4A 0x15 00x 10 101 Start High speed FH register smc cmd ID 0x15 wait EL ID CCW wait for EL signal smc softreset ID sm board reset ID cleanup end XP8800 Software Reference 89 Blank 90 Software Reference XP8800 APPENDICES Blank ArPENDIX A PLCBus Appendix A provides t
37. stepper motor connected to an XP8800 expansion board PLCBus Z World Controller Motor Power Supply INTO 5 IEL SD SD EL Mechanical Switches and Optical sensors Quadrature Encoder Stepper Motor Figure 7 2 Sample Stepper Motor Connection to XP8800 58 I O Configurations XP8800 Optional Optical Isolation The quadrature and sense inputs AIN BIN ORG EL EL SD and SD may be optically isolated as shown in Figure 7 3 The XP8810 version of the XP8800 expansion board features this optical isolation 4702 r OUT 4N26 Figure 3 4 XP8810 Optical Isolation Circuit Note that there is common ground for the board and the inputs so that the optical isolation is not absolute XP8800 Configurations 59 Using Expansion Boards The following steps summarize how to use the XP8800 boards 1 Send a reset command to the PLCBus 2 Place the address of the XP8800 registers on the PLCBus The address will actually be the address of one of the components the PCL AK pulse generator or the quadrature decoder counter 3 Operate the XP8800 The following operations are the ones done most frequently Set XP8800 control register Issue command to PCL AK pulse generator Set PCL AK parameters or read PCL AK registers or status Reset the quadrature counter or read
38. the interrupt vector Data Structures The XP8800 driver software uses a table to represent all the XP8800s in a system There can be up to four XP8800s and other PLCBus expansion boards may also be used subject to power constraints Table 4 2 shows how the Dynamic C STEP LIB library assigns and sorts the XP8800 logical addresses These XP8800 logical addresses simply indexes in the table For example the logical addresses for the three boards in Table 8 1 are 0 1 and 2 The physical addresses are stored in the table Call sm find boards before doing anything else This function searches the PLCBus and initializes the table to represent the state of the XP8800s These four arrays define the table int sm addr 17 char sm stat 16 char sm flag 16 char sm shadow 16 XP8800 Software Reference 77 The array sm_addr holds the PLCBus address of each XP8800 existing on the PLCBus This array has one extra element because the software places a marker address 1 or OXFFFF following the last real board address in the array The array sm_stat contains copies of the address 0 status bits of the PCL AK pulse generator for each XP8800 on the PLCBus The array is updated by the motor control interrupt service routine ISR every time a PLCBus interrupt is generated The array sm_flag is updated at the same time as sm_stat and repre sents whether a board is awaiting service its interrupt line asserted Th
39. transmit buffer is full void Duartsend prompt Sends CR LF and gt to the transmit buffer The assumption here is that the receiver is a dumb terminal The function fails without warning if the transmit buffer is full void Dkill uart Resets the XP8700 The library assumes there is only one board the bus with an address of 0x040018 void Dreset_uartrbuf void Dreset_uarttbuf These functions reset the circular receive and transmit buffers respec tively Be sure to call Dinit_uart at least once before one of these calls Otherwise the reset functions will use uninitialized pointers XMODEM Support These two functions use the XMODEM protocol int Dxmodem uartdown char buf int count Sends downloads count 128 byte blocks from buf RETURN VALUE 0 timed out no transfer successful transfer 2 transfer canceled by receiver 40 SoftwareReference XP8700 int Dxmodem uartup unsigned long address int pages int dest int handler Receives uploads a file using the XMODEM protocol PARAMETERS address is the physical address in RAM where the received characters are to be stored If the receive buffer is created using xdata the base name of the array may be used for the base address Otherwise the logical address of the buffer must be con verted to a physical address using the library function phy adr pages is a pointer to an integer storing the number of 4K blocks that
40. will access this address until a new address is set PARAMETER address 15 24 bit physical address for 8 bit bus with the first and third bytes swapped low byte most significant LIBRARY DRIVERS LIB 102 PLCBus XP8700 XP8800 void set8adr long address Sets the current address 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 16 23 24 bit address may be passed to this func tion 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 e int read24data0 long address Sets the current PLCBus address using the 24 bit address then reads eight bits of data from the PLCBus with a BUSRDO cycle RETURN VALUE PLCBus data in lower eight bits upper bits 0 LIBRARY DRIVERS LIB int read8data0 long address Sets the last eight bits of the current PLCBus address using address bits 16 23 then reads eight bits of data from the PLCBus with a BUSRDO cycle PARAMETER address bits 16 23 are read RETURN VALUE PLCBus data in lower eight bits upper bits 0 LIBRARY DRIVERS LIB void write24data long address char data Sets the current PLCBus address using the 24 bit address then writes eight bits of data to the PLCBus PARAMETERS address is 2
41. 0 71 77 78 1Smodem 29 std datore 25 J jumper settings XP8700 board address 34 K T 58 L LCD edet 95 7 95 enne nee 95 LEDs 8800 sss 74 libraries function 222 4 96 liquid crystal display See LCD logical addresses XP8 TOU ehe ntn 34 8800 25 M memory mapped register 96 78 mode addressing 2 22 2222 97 mode register 2 27 eee 29 42 communication 36 41 42 motor driver 50 62 67 mode Smeeni unninn 67 mounting expansion baords 112 DIN 112 end CAPS isses 112 Index 115 usata nnd 22 27 multiplier register 8800 65 N null byte aem 39 null 10661 29 0 outport 100 101 103 eITOIS 2 2 22 21 overview utet etes 14 XP8800 5 cete 50 P Pls ose eques 110 P2 sesto nerd 110 parity errors 2 22 2222 21 PBUS LG LIB 35 76 PBUS 35 76 PCL AK pulse generator chip 0 62 3 commands 4 control registers 63 Todes ENS 63 modes of operation 63 speed registers 65 66 e RESO 56 67 56 57 67
42. 0 boards for most controllers with 8 bit PLCBus addressing AASCURT2 LIB Operates up to four XP8700 boards for controllers with 16 bit PLCBus addressing e g BL1700 XP8700 addresses are 15 bit addresses encoded in the lower 5 bits of three bytes When using these functions interchange the first and third byte of the address For example if the bus address is 0x040018 pass 0x180004 General Functions in DRIVERS LIB void set24adr long address Places the 3 byte address on the PLCBus void set8adr long address Places the third byte of the address on the PLCBus This function assumes that the first two bytes of the address have already been sent void write24data long address byte value Writes value at the specified bus address The address will be either that of the XP8700 s control register or data register void write8data long address byte value This is an abbreviated form of write24data and is used when only the third byte of the address needs to be sent 36 Software Reference XP8700 int read24data0 long address Returns a value read using the BUSRDO cycle from the specified bus address The address must be that of the control register Bit 0 of the returned value when 0 indicates that the addressed board actually exists Bit 1 when set indicates that the UART on the board is interrupting int read8data0 long address This is an abbreviated form of read24data0 and is used w
43. 00 300 0101 600 600 0110 1 200 1 200 0111 1 050 1 050 1000 2 400 2 400 1001 4 800 4 800 1010 7 200 1 800 1011 9 600 9 600 10 38 400 19 200 1101 timer timer 1110 MPI 16X MPI 16X 1111 MPI 1X MPI 1X 24 Configurations XP8700 CTU CTL CTLR are the counter timer registers Register pairs CTUR CTLR and CTU CTL are the upper and lower halves of 16 bit counter timer values The counter timer value is set through CTUR CTLR and is read through CTU CTL THR is the transmitter holding register It holds one character RHR is the receiver holding register RHR is actually the frontmost entry in a 3 character FIFO queue A receiver shift register constitutes the fourth buffer in a quadruple buffering scheme IMR ISR are the interrupt mask register and interrupt status registers The interrupt mask register selectively enables or disables interrupts counter delta RxRDY change level 7 FFULL TXRDY The interrupt status register be read to determine what caused the interrupt MPI pin MPI pin counter delta RxRDY TxEMT change state ready break FFULL TxRDY The upper halves of both the IMR and the ISR reflect the I O pins and the counter The lower halves represent the state of RS 232 communication MRI bit 6 con
44. 12 MHz The counter can operate at up to one quarter of this frequency Thus the maximum reliable counting frequency is 3 MHz The counter can be read as two successive bytes Control Register The control register is an 8 bit write only latch that controls the operation of the XP8800 Table 7 5 explains the meaning of each bit in the register bit 0 is the least significant bit Table 7 5 Control Register Bits Bit Name Meaning 0 Reset quadrature decoder counter Low means reset 1 RESCTL Reset the PCL AK Low means reset 2 LED LED Low means ON 3 SELO Local address line 4 SEL1 Local address line 5 DRVOE Enable motor driver IC output Low means ON 6 HSTEP Half step mode for motor driver IC when this bit is 1 and bit 7 is 0 7 Single phase mode for motor driver IC when this bit is 1 and bit 6 is 0 Two phase mode when this bit is 0 and bit 6 is 0 70 Configurations XP8800 The select lines SELO have a specific meaning They are connected to the two address lines of the PCL AK pulse generator SELO is also connected to the quadrature decoder counter Coupled with PAL logic these select lines allow you to read and write to the PCL AK and to read the 16 bit counter value The function library STEP LIB takes care of the details PLCBus Interrupts Be careful when processing interrupts from the PLCBus Inter
45. 24adr read24datax and write24data in DRIVERS LIB Logical Addresses PLCBus expansion boards have logical addresses RS 232 specific software defines four integer board addresses 0 3 The following formula maps the physical address to the logical address logical address xy where x and y jumper bits are defined above For example consider an XP8700 with pins 1 2 11 connected This is the physical address of its control register 00100 00000 xy000 00100 00000 10000 The XP8700 s logical address is 10 2 Table 4 1 shows how to address the registers on the four XP8700s that can exist on a single PLCBus Table 4 1 XP8700 Register Addresses Header J1 Logical Control Data pins 1 2 pins 3 4 Address Register Register connected connected 0 0x040000 0x040001 unconnected connected 1 0x040008 0x040009 connected unconnected 2 0x040010 0x040011 unconnected unconnected 3 0x040018 0x040019 The 15 bit addresses are placed on the bus as 3 bytes using the lower 5 bits of each byte In each case data address control address 1 34 Software Reference XP8700 Dynamic Libraries Several Dynamic C function libraries contain the software functions described in this chapter The chart in Table 4 2 identifies which libraries must be used with particular Z World controllers Table 4 2 Dynamic C Libraries Required by Z World Controllers for XP8700 Expansion Boards Lib
46. 4 bit address to write to data 15 data to write to the PLCBus LIBRARY DRIVERS LIB void write8data long address char data Sets the last eight bits of the current PLCBus address using address bits 16 23 then writes eight bits of data to the PLCBus PARAMETERS address bits 16 23 are the address of the PLCBus to write data is data to write to the PLCBus LIBRARY DRIVERS LIB XP8700 XP8800 PLCBus 103 Blank 104 PLCBus XP8700 XP8800 SPECIFICATIONS 8700 8800 Specifications 105 XP8700 Hardware Specifications Table B 1 summarizes the specifications for the XP8700 expansion board Table B 1 XP8700 Specifications Parameter Specification 2 835 x 22 x 0 58 Bonds 72 mm x 56 mm x 15 mm Operating Temperature Range 40 C to 70 C Humidity 5 to 95 noncondensing One full duplex asynchronous RS 232 HO port baud rate up to 57 600 bps Power quiescent no output 80 mA 5 VDC Figure B 1 shows the dimensions of the XP8700 expansion board 72 0 125 typ 3 2 2 835 0 187 dia 4x 4 7 0 45 12 0 58 15 Figure B 1 XP8700 Board Dimensions 106 Specifications XP8700 XP8800 XP8800 Hardware Specifications Table B 2 summarizes the specifications for the XP8800 expansion board Table B 2 XP8800 Series Specifications Parameter Specification Board Size 12 mm x 102 mm x 15 mm Oper
47. 400 BL1500 EZIOPLC LIB BL1200 BL1600 PK2100 PK2200 ZB4100 EZIOPLC2 LIB BL1700 EZIOBL17 LIB 0 PBUS_TG LIB BL1000 PBUS LG LIB BL1100 BL1300 PLC EXP LIB BL1200 BL1600 2100 2200 XP8700 XP8800 PLCBus 99 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 BUSADRO BUSADRI and BUSADR2 PARAMETER addr is broken into three nibbles and one nibble is written in each BUSADRx cycle LIBRARY EZIOPLC LIB EZIOPLC2 LIB EZIOMGPL LIB e void setl6adr int adr Sets the current address for the PLCBus All read and write operations access this address until a new address is set PARAMETER adr is a 16 bit physical address The high order nibble contains the value for the expansion register and the remaining three 4 bit nibbles form a 12 bit address the first and last nibbles must be swapped LIBRARY DRIVERS LIB void setl2adr int adr Sets the current address for the PLCBus All read and write operations access this address until a new address is set PARAMETER adr is a 12 bit physical address three 4 bit nibbl
48. 5 UCNS5804 typical specifications 69 uploading XP8700 teet 36 41 USE STEPBER TT 78 using XP8700 and XP8800 boards MOL Sete ee teet 20 60 watchdog timer 8800 60 1 57 writel2data 102 write24data 34 36 103 write4data 102 write8data 36 103 writing data on the PLCBus 7 96 2 X xda t soon 41 XMODEM protocol 40 41 8200 sss 94 P8300 iue 94 8400 94 XP8600 94 XP8700 14 54 94 95 addresses 34 38 baud rates 21 connections 20 control register 14 21 34 data register 14 21 28 29 34 pin layout 20 H2 pin layout 20 headers 20 20 8700 8800 8700 input power 18 Initialization 39 Interrupts 2222 2 30 42 INT Vi 30 31 jumper settings JE La eee 34 logical addresses 34 multiple boards 38 reading 22222222 39 40 40 sample projgram 42 onere 29 36
49. 600 bps ismodem if 1 modem communication is supported Otherwise is 0 isecho if 1 every character is echoed Otherwise is 0 If CTS RTS handshaking is selected the software negates RTS when the receive buffer is 80 full It will reassert RTS when the receive buffer falls below 20 capacity RETURN VALUE 1 when the XP8700 is found and initialized 1 otherwise int Dread uart char buf char terminate Copies the contents of the receive buffer to buf until the specified terminating character 1 reached or until the buffer is empty The terminating character is replaced with a null byte in buf RETURN VALUE 1 if it is successful 0 if the buffer is empty or becomes empty before the terminating character can be found XP8700 Software Reference 39 int Dread_uartlch char data Reads one character from the receive buffer and stores it in location pointed to by data RETURN VALUE 1 if successful 0 if the receive buffer is empty int Dwrite uart char buf int count Copies count characters from bu to the transmit buffer If the transmitter 18 not already transmitting the function initiates transmis sion RETURN VALUE 1 if successful 0 if the transmit buffer does not have enough space for count bytes int Dwrite uartlch char data Writes one character data into the transmit buffer The function initiates transmission if the transmit interrupt was off RETURN VALUE 1 if successful 0 if the
50. 7 4 lists typical ratings for the UCN5804 motor driver chip Table 7 4 Typical Ratings UCN5804 Motor Driver IC ID VCE 0 7A 10 1 0A 1 1 V 1 25 1 2 V For example consider 5 V 1 A motor Vp Vcg Vg 5V 4 1 1V 0 7 6 8 You would need a 6 8 V 2 A power supply for 2 phase drive in addition to the power required by the logic Remember to connect the K line on the screw connector block H6 to the high side of the drive voltage Quadrature Decoder Counter The HCTL 2016 is a 16 bit quadrature decoder and counter Its two lines A and B accept two quadrature encoded signals that is two square waves 90 out of phase The order in which these signals make transitions deter mines the direction that is counted Figure 7 10 illustrates this counting operation Forward Quadrature Counting Up Time Reverse Quadrature Counting Down Figure 7 10 HCTL 2016 Quadrature Counting Operation XP8800 Configurations 69 There are four states of lines and as shown in Figure 7 11 The counter counts up or down depending on the state transition COUNT Up CHA CHB STATE Valid 1 0 L State 1 1 2 Transitions 0 1 3 0 0 4 Sula e Count pow Figure 7 11 HCTL 2016 Quadrature Counting Operation The speed at which the counter can operate is limited by the reference clock
51. 700 XP8800 set4adr usns sume 101 5668186 74 81 5668286 74 1 566886 36 3 shadow registers 98 shadow variables 800 connie 77 78 single phase mode 57 slow down 8800 66 sm _ 78 sm 81 sm_board_reset 81 sm 516 snes 82 SM 1 77 SM DEMO2 C T SM 77 82 sm_find_boards 60 75 77 82 78 sm 60 82 sm int 77 78 83 sm 83 Sm p ll ccna 83 sm 100 83 sm sell bnini 83 sm 110 84 sm selli 84 sm 78 Sis tat cect nS 78 smc cmd 84 smc hardreset 61 84 smc manual move 84 smc seek origin 84 smc 5600076 85 setspeed 85 86 smc_softreset 61 85 sme 0 85 sme 55803 86 smcq moveto 86 smq hardreset 61 87 smq readl6 87 smq
52. A null modem between the XP8700 and the modem takes care of this When programming the UART to communicate with a modem set ismodem 1 when calling Dinit uart The baud rate must be 2400 bps or 1200 bps The library software will then handle modem communi cation commands transparently and pass data directly to the application Refer to Chapter 4 Software Reference for details XP8700 Configurations 29 Interrupts The XP8700 has the capability of interrupting the controller through the line whenever a character has been received RXRDY or the transmit buffer is empty TXEMT When such an interrupt occurs the application may check for errors parity framing and overrun errors The AT line of the PLCBus is connected to INT1 ofthe Z180 Since there may be more than one interrupting device on the PLCBus Z World provides a framework for handling more than one device through the same INTI line The following function from DRIVERS LIB illustrates the framework SINT VEC 1 VEC plcbus isr asm root plcbus_isr push af protect general registers 0 a CBR save CBR push af push hl push bc push de 0 ITC disable prevents bus 11111101b interrupts on AT outO ITC a Trap Control 0x34 ifdef USE_UARTEXP call Duart_circ_int service UART interrupt insert calls to other service routines her
53. Spafford Street Davis California 95616 6800 USA Telephone 530 757 3737 Facsimile 530 753 5141 Web Site http www zworld com E Mail zworld zworld com Part No 019 0056 000921 D Printed in U S A
54. Z WORLD XP8700 and XP8800 RS 232 and Motion Control Expansion Boards User s Manual 000921 D XP8700 and 8800 User s Manual Part Number 019 0056 000921 D Printed in U S A Copyright 1999 Z World Inc All rights reserved Z World reserves the right to make changes and improvements to its products without providing notice Trademarks Dynamic C isa registered trademark of Z World Inc Windows isa registered trademark of Microsoft Corporation PLCBus isa trademark of Z World Inc B 5 Hayes Smart Modem is a registered trademark of Hayes Microcom puter Products Inc Notice to Users When a system failure may cause serious consequences protecting life and property against such consequences with a backup system or safety device is essential The buyer agrees that protection against consequences resulting from system failure is the buyer s responsibility This device is not approved for life support or medical systems All Z World products are 100 percent functionally tested Additional testing may include visual quality control inspections or mechanical defects analyzer inspections Specifications are based on characterization of tested sample units rather than testing over temperature and voltage of each unit Z World may qualify components to operate within a range of parameters that is different from the manufacturer s recommended range This strategy is believed to be more eco
55. ake action while Dread uart buf ENTER 0 interpret buf void crlf Dwrite uartlch ENTER Dwrite uartlch LINEFEED Dwrite uartlch SPACE 44 Software Reference XP8700 void interpret char buf struct tm x tmc rd crlf if strcmp buf help 0 Dwrite uart Commands are Dwrite uartlch Dwrite uartlch Dwrite uartlch Dwrite uartlch Dwrite uartlich Dwrite uartlich Dwrite uartlich Dwrite uartlch Dwrite uartlch Dwrite uartlich Dwrite uartlch Dwrite_uart1ch Dwrite uartlich Dwrite uartlch Dwrite_uart1ch Dwrite uartlch Jelse Dwrite uart buf help 1 if strcmp buf time 0 Dwrite_uart Time x tm_hour 10 0 x tm_hour 10 0 time amp 6 10 0 x tm_min 10 70 UO x tm sec 10 70 x tm sec 10 70 1 if strcmp buf date 0 Dwrite uart Date x tm mday 10 70 x tm_mday 10 70 6 ren iha x tm_mon 10 70 x tm mon 10 70 7 x tm_year 10 70 x tm_year 10 70 strlen buf date 36 MM MM put buf More elaborate sample programs may be found in CUARTREM C in the Dynamic C SAMPLES NETWORK subdirectory XP8700 Software Reference 45 Blank 46 Software Refe
56. ansion boards 1 Senda reset command to the PLCBus 2 Place the address of the XP8700 registers on the PLCBus Write a reset command to a CTRL register 3 Write to the XP8700 registers as needed to control the XP8700 Read the internal registers to monitor what 15 happening 4 Read the receive holding register RHR or write to the transmit holding register to communicate These steps are done using software drivers in Dynamic C function librar ies Refer to Chapter 4 Software Reference for the applicable libraries and where they are used 20 I O Configurations XP8700 XP8700 Operation The XP8700 can be connected on the PLCBus with other expansion boards Up to four XP8700s can be addressed on a single PLCBus XP8700 expansion boards have 15 bit addresses placed on the PLCBus five bits at a time The XP8700 uses a Signetics SCC2691 UART which is described briefly below Two registers on the XP8700 the control register and the data register are used to read and write to the UART The XP8700 can also raise a processor interrupt INT1 Methods for dealing with many inter rupting devices are discussed Signetics SCC2691 UART The SCC2691 UART is a full duplex asynchronous receiver transmitter It supports 18 baud rates from 50 bps to 38 400 bps Data may be framed with 5 to 8 data bits four parity modes and 1 1 5 or 2 stop bits The UART provides error detection framing errors parity errors and overrun
57. ating Temperature Range 40 C to 70 C NEM ON 2 835 x 4 0 x 0 58 Humidity 5 to 95 noncondensing Power quiescent output 40 mA 5 V DC Output One axis stepper motor control rated at 35 V 1 25 A per phase in full step mode 1 0 A per phase in half step mode Figure B 2 shows the dimensions of the XP8800 Series expansion boards 2 835 72 gt 0 1625 0 187 dia 4x 4 7 0 45 12 0 58 15 Figure B 2 XP8800 Board Dimensions XP8700 XP8800 Specifications 107 Blank 108 Specifications XP8700 XP8800 C CONNECTING AND Mountinc MULTIPLE BOARDS XP8700 XP880 Connecting and Mounting Multiple Boards 109 Connecting Multiple Boards Eight or more expansion boards can be connected daisy chained at one time The actual number of expansion boards may be limited by capacita tive loading on the PLCBus Be sure that each expansion board has a unique address to prevent commu nication problems between the controller and the expansion board Follow these steps to install several expansion boards on a single PLCBus 1 Place all expansion boards right side up 2 Use the ribbon cable supplied with the boards 3 Connect one board to the main controller 4
58. ations known as shadow registers The 4 byte shadow registers which are saved at predefined memory addresses are as follows SHBUSI SHBUS1 1 SHBUSO SHBUSO 1 SHBUS042 SHBUS0 3 Bus expansion BUSADRO BUSADRI BUSADR2 Before the new addresses or expansion register values are output to the bus their values are stored in the shadow registers All interrupts that use the bus save the four shadow registers on the stack Then when exiting the interrupt routine they restore the shadow registers and output the three address registers and the expansion registers to the bus This allows an interrupt routine to access the bus without disturbing the activity of a background routine that also accesses the bus To work reliably bus devices must be designed according to the following tules 1 The device must not rely on critical timing such as a minimum delay between two successive register accesses 2 The device must be capable of being selected and deselected without adversely affecting the internal operation of the controller Allocation of Devices on the Bus 4 Bit Devices Table A 4 provides the address allocations for the registers of 4 bit devices Table A 4 Allocation of Registers 1 2 Meaning digital output registers 64 registers 000 000 XXX 64 x 8 512 1 bit registers 000j 001j xxxj analog output modules 64 registers digital input registers 128 registers 000j O1xj XXXJ 128 x 4 512 in
59. ay reset until the application hits the watchdog again Connecting the jumper on header enables the watchdog The watchdog is disabled if this jumper is not connected 4 PCL AK Reset In addition to the watchdog reset and the power up reset there are two other ways to reset the PCL AK pulse generator To achieve a hardware reset drive the PCL AK reset line low This line is connected to the control register bit 1 A hardware reset halts all activity of the controller and resets all internal counters and registers The function smc_hardreset will pulse this line and generate the reset To achieve a software reset write a reset command to the controller A software reset immediately stops pulse generation and deactivates the PCL AK s interrupt request line if it is active The contents of PCL AK registers are not affected A software reset is typically used at the end of a programmed operation that generates an interrupt when it finishes The function smc_softreset is used to generate a software reset 5 Quadrature Counter Reset The quadrature counter is reset to zero on power up Use the function smq_hardreset at any time to reset the quadrature counter XP8800 VO Configurations 61 XP8800 Operation The XP8800 has these three major components 1 PCL AK pulse generator 2 UCN5804 motor driver 3 HCTL 2016 quadrature decoder counter These components are coupled with a control register U3 and control logic U2 U4 a
60. ber 1 A black square indicates pin 1 of all headers 1 o J1 Measurements All diagram and graphic measurements are in inches followed by millime ters enclosed in parenthesis XP8700 XP8800 About This Manual ix Blank x About This Manual XP8700 XP8800 XP8700 Blank CHAPTER 1 OVERVIEW Chapter provides an overview and description of the XP8700 RS 232 expansion board XP8700 Overview 13 Z World s 8700 expansion board provides a simple way to add UART to a control system built around a Z World controller The XP8700 connects directly to a PLCBus port The XP8700 does not have the software drivers to enable it to be used with other Z World controllers The XP8700 may be connected on the PLCBus with other expansion boards Up to four XP8700s can be addressed on a single bus Unlike most other expansion boards which take 12 bit addresses 4 bits at a time XP8700s have 15 bit addresses placed on the bus five bits at a time The XP8700 features a Signetics SCC2691 UART which is described briefly The UART is operated by reading and writing to two registers on the XP8700 the control register CTRL and data register DATA In addition the 8700 may be used as an additional programming board for controllers with a PLCBus port This frees up the existing RS 232 ports on the controller The XP8700 also can raise a processor interrupt INT1 The manual discusses methods for dea
61. d int index int data Writes data to the command register of the PCL AK pulse generator on the XP8800 specified by index void smc hardreset int index Causes a hardware reset of the PCL AK on the XP8800 specified by index This stops any pulse output that is motor movement and clears the internal registers of the PCL AK It does this by giving a negative pulse on bit 1 of the control register void smc manual move int index int dir int speed Starts a manual or continuous move operation on the XP8800 speci fied by index The motor will move until the application issues a decelerating stop command a software or hardware reset or until the application detects an end limit or origin signal 1f these are enabled The terms dir and speed are Boolean If dir is non zero movement is in the direction Otherwise movement is in the direction If speed is zero the PCL AK pulse generator operates at low speed Pulses are generated at the rate in the FL register Otherwise the PCL AK pulse generator operates at high speed Pulses are gener ated at the rate in the FH register It is important to note that this function starts the movement and does not wait for the movement to complete The application may then perform other tasks while the movement takes place void smc seek origin int index int dir int speed Starts an origin mode operation on the XP8800 specified by index The PCL AK w
62. dress Coding First Byte Mode Addresses Full Address Encoding 0000 4bitsx3 256 0000 xxxx xxxx 0001 256 0001 0010 256 0010 0011 256 0011 0 10 0 Sbitsx3 2 048 0100 0101 2 048 0101 x0110 2 048 0110 x0111 2 048 0111 x 000 6bitsx3 16 384 1000 XXXXXX 10 01 16 384 1001 10 1 0 61 4 xx1010 1011 4bitsx1 1 1011 expansion register XXxx1100 8 bits x 2 4 096 xxxx1100 1101 8 bits x 3 1101 XXXXXXXX 11 1 0 Sbitsxl 16 1110 1111 8 bits x 1 16 xxxx1111 This scheme uses less than the full addressing space The mode notation indicates how many bus address cycles must take place and how many bits are placed on the bus during each cycle For example the 5 x 3 mode means three bus cycles with five address bits each time to yield 15 bit addresses not 24 bit addresses since the bus uses only the lower five bits of the three address bytes XP8700 XP8800 PLCBus 97 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 loc
63. e array sm_shadow holds shadow variables for the XP8800 control registers Control registers are write only If software fails to remember how control lines are set chances are good that control lines will become set incorrectly The shadow variables provide the memory Interrupts Since the PLCBus has a single shared interrupt line special care must be taken when servicing interrupts across it During PLCBus interrupt service all possible interrupt sources must be checked to see if they are currently awaiting service These include other PLCBus expansion boards The interrupt function sm_int polls all XP8800s on the PLCBus and updates the arrays sm_stat and sm_flag for each It also sends a software reset to each XP8800 that is asserting an interrupt request The software reset clears the interrupt request If this reset is not issued the system would lock up since the interrupt line would never go inactive By including the statement define USE_STEPPER early in the main program the PLCBus interrupt service routine will call sm_int Your application should periodically check the status of the interrupt request flags in the sm_flag array to determine when to service the XP8800 Although the function sm_int does what it is supposed to do it probably does not do what you would want it to do Z World has provided sm_int to demonstrate how to use the XP8800 in an interrupt driven system Since sm_int requires polling flags to provide serv
64. e as nedd 0 ITC enable or 00000010b outO ITC a ei enable interrupts pop de restore general registers pop bc pop hl pop af outO CBR a and CBR pop af ret endasm 30 I O Configurations XP8700 The framework consists of a single interrupt service routine plcbus_isr that responds to the interrupt It then checks all devices that could possibly have caused the interrupt and services the devices that need service It is also possible to determine whether an XP8700 expansion board is responding to interrupts by executing a BUSRDO cycle Use the following sample program with a control register address of 0x040018 1 0 04 156 address byte 5x3 mode outO0 BUSADRO a 1 0 00 2nd address byte outO0 BUSADR1 a 1 0 18 3rd address byte outO0 BUSADR2 a of CTRL reg 0 BUSRDO a get condition bits and 00000010b test for interrupt requests 2 done process interrupts here done ret Z World supports Dynamic C programming of a controller through the XP8700 expansion board Since all expansion boards share the same interrupt the following protocol maintains control of the INT1 interrupt 1 Load the address of the interrupt service routine into vector location 0x18 2 Place a jump opcode 0xC3 in location 0x17 3 Place the location of the jump instruction in the INT1 vector location The following function and declaration will
65. enable disable enable miscellan mman scellaneous commands ix Tx Rx Rx The upper half of the CR register represents the commands listed in Table 3 2 that can be given to the RS 232 channel Table 3 2 CR Register Commands for RS 232 Channel CR 7 4 Command 0000 No command 0001 Reset mode register pointer to 0010 Reset receiver FIFO is flushed 0011 Reset transmitter 0100 Reset error status 0101 Reset break change interrupt 0110 Start break Forces TxD output low spacing 0111 Stop break 1000 Start counter timer Counter timer registers must have been loaded 1001 Stop counter 1010 Assert RTS on the MPO pin 1011 Negate RTS on the MPO pin 1100 Reset MPI change interrupt 1101 Reserved 111 Reserved The lower half of the command register disables or enables the receiver and transmitter XP8700 Configurations 23 CSR is the clock select register receiver clock select transmitter clock select The upper half of the CSR register selects the baud rate of the receiver while the lower half selects the baud rate of the transmitter The two sets of baud rates selectable by ACR bit 7 on the auxiliary control register are listed in Table 3 3 Table 3 3 CSR Baud Rates Selected by ACR Bit 7 CSR Code ACR 7 0 ACR 7 1 0000 50 50 0001 110 110 0 134 5 134 5 200 150 0100 3
66. es with the first and third nibbles swapped LIBRARY DRIVERS LIB void eioPlcAdr4 unsigned addr Specifies the address to be written to the PLCBus using only cycle BUSADR2 PARAMETER addr is the nibble corresponding to BUSADR2 LIBRARY EZIOPLC LIB EZIOPLC2 LIB EZIOMGPL LIB 100 PLCBus XP8700 XP8800 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 the same as the address in the previous call to set12adr PARAMETER adr contains the last four bits bits 8 11 of the physical address LIBRARY DRIVERS LIB e char _eioReadDO Reads the data on the PLCBus in the BUSADRO cycle RETURN VALUE the byte read on the PLCBus in the BUSADRO cycle LIBRARY EZIOPLC LIB EZIOPLC2 LIB EZIOMGPL LIB e char _eioReadD1 Reads the data on the PLCBus in the BUSADRI cycle RETURN VALUE the byte read on the PLCBus in the BUSADRI cycle LIBRARY EZIOPLC LIB EZIOPLC2 LIB EZIOMGPL LIB e char _eioReadD2 Reads the data on the PLCBus in the BUSADR2 cycle RETURN VALUE the byte read on the PLCBus in the BUSADR2 cycle LIBRARY EZIOPLC LIB EZIOPLC2 LIB EZIOMGPL LIB e char readl2data int adr Sets the current PLCBus address using the 12 bit adr then reads four
67. es 95 operations 4 bit sess 95 96 98 1 95 99 BUSADRO 74 96 97 BUSADRI 74 96 97 BUSADR2 96 97 BUSADRG3 102 103 31 m 37 99 100 101 103 BUSRDI 37 99 100 BUSRESET 37 BUSWR 100 Index 113 cabling specialise 17 53 channel status register 37 circular buffer 36 clock select register 24 COM eee 29 connectors 26 pin pin assignments 94 control register 99 8700 14 21 34 8800 60 70 74 77 78 counter 8800 66 counter timer registers 25 CR 23 27 38 CSR uA 24 25 25 CTS RTS 8700 39 25 CTUR ore 25 CUARTREM C 45 D DOX D7X 95 daisy chaining 18 54 110 data register XP8700 28 29 34 Ddelay 1 42 1 _5 42 deceleration 880025 65 delay 31 Dget modem command 41 digital inputs sss 99 d
68. expansion boards are to be added connect header P2 H2 on the new board to header P1 H1 of the board that is already con nected Lay the expansion boards side by side with headers P1 H1 and P2 H2 on adjacent boards close together and make sure that all expansion boards are facing right side up See Appendix C Connecting and Mounting Multiple eo Boards for more information on connecting multiple expan sion boards XP8700 Getting Started 17 4 Each expansion board comes with factory default board address If more than one expansion board of each type is to be used be sure to set a unique address for each board The following section on Setting Expansion Board Ad dresses and Chapter 4 Software Reference provide details on how to set and use expansion board addresses 5 Power may be applied to the controller once the controller and the expansion boards are properly connected using the PLCBus ribbon cable Setting Expansion Board Addresses Z World has established an addressing scheme for the PLCBus on its controllers to allow multiple expansion boards to be connected to a controller Remember that each expansion board must have a unique PLCBus address if multiple boards to be connected If two boards have the same address communication problems will occur that may go undetected by the controller XP8700 Addresses XP8700 expansion boards are shipped from the factory with no pins on header J1
69. gineer the target system that the controller used with the XP8700 or XP8800 expansion boards will control Understanding of the basics of operating a software program and editing files under Windows on a PC Knowledge of the basics of C programming zi Fora full treatment of C refer to the following texts The Programming Language by Kernighan and Ritchie C A Reference Manual by Harbison and Steel Knowledge of basic Z80 assembly language and architecture for controllers with a Z180 microprocessor A For documentation from Zilog refer to the following texts Z180 MPU User s Manual Z180 Serial Communication Controllers 780 Microprocessor Family User s Manual Knowledge of basic Intel assembly language and architecture for controllers with an Intel 386 EX processor For documentation from Intel refer to the following texts Inte M386 EX Embedded Microprocessor User s Manual Intel M386 SX Microprocessor Programmer 5 Reference Manual XP8700 XP8800 About This Manual vii Acronyms Table 1 lists and defines the acronyms that may be used in this manual Table 1 Acronyms Meaning Erasable Programmable Read Only Memory 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
70. h the device Then read or write from to the register The register is selected by placing its address on the bus Each device recog nizes its own address and latches itself internally A typical device has three internal latches corresponding to the three address bytes The first is latched when a matching BUSADRO is de tected The second is latched when the first is latched and a matching BUSADRI is detected The third is latched if the first two are latched and a matching BUSADR2 is detected If 4 bit addressing is used then there are three 4 bit address nibbles giving 12 bit addresses In addition a special register address is reserved for address expansion This address if ever used would provide an additional four bits of addressing when using the 4 bit convention If eight data lines are used then the addressing possibilities of the bus become much greater more than 256 million addresses according to the conventions established for the bus 96 PLCBus XP8700 XP8800 Place an address the bus by writing bytes to BUSADRO BUSADRI and BUSADRQ2 in succession Since 4 bit and 8 bit addressing modes must coexist the lower four bits of the first address byte written to BUSADRO identify addressing categories and distinguish 4 bit and 8 bit modes from each other There are 16 address categories as listed in Table A 3 An x indicates that the address bit may be 1 or a 0 Table A 3 First Level PLCBus Ad
71. have been transferred dest is the destination of the transfer when a RS 485 master slave network has been set up If dest 0 the destination is the network master If dest 15 from 1 to 9 the upload is intended for a network slave handler is a pointer to a function that handles the uploaded data It is the nature of the data that determines what sort of handler is needed If a handler is not needed build a handler that does nothing and use it E Examine Dxmodem uartup in the UART232 LIB library for further details RETURN VALUE 0 timed out no transfer successful transfer 2 transfer canceled by sender Miscellaneous Functions These functions are found in UART232 LIB and MODEM232 LIB int Dget modem command char buffer Scans buffer for a Hayes compatible modem command RETURN VALUE 1 command present 5 CONNECT 1200 0 6 NO DIALTONE 1 CONNECT 7 BUSY 2 RING 8 NO ANSWER 3 NO CARRIER 9 2400 4 ERROR 10 n justa new line XP8700 Software Reference 41 A Hayes SmartModem compatible modem is recommended A null modem cable is needed between the XP8700 expansion board and the modem Some modems require that the RTS CTS and DTR lines be tied together The XP8700 does not support DTR void Drestart uartmodem Restarts a modem during startup or because of abnormal operation int Duartmode
72. he pin assignments for the PLCBus describes the registers and lists the software drivers XP8700 XP8800 PLCBus 93 Overview PLCBus is general purpose expansion bus for Z World controllers The PLCBus is available on the BL1200 BL1600 BL1700 PK2100 and PK2200 controllers The BL1000 BL1100 BL1300 BL1400 and BL1500 controllers support the XP8300 XP8400 XP8600 and XP8900 expansion boards using the controller s parallel input output port The BL1400 and BL1500 also support the XP8200 and XP8500 expansion boards The ZB4100 s PLCBus supports most expansion boards except for the XP8700 and the XP8800 The SE1100 adds expansion capability to boards with or without a PLCBus interface Table A 1 lists Z World s expansion devices that are supported on the PLCBus Table A 1 Z World PLCBus Expansion Devices Device Description Exp A D12 Eight channels of 12 bit A D converters SE1100 Four SPDT relays for use with all Z World controllers 8100 5 32 digital inputs outputs XP8200 Universal Input Output Board 16 universal inputs 6 high current digital outputs XP8300 Two high power SPDT and four high power SPST relays XP8400 Eight low power SPST DIP relays XP8600 Two channels of 12 bit D A converters 8700 One full duplex asynchronous RS 232 port 8800 One axis stepper motor control 8900 Eight channels of 12 bit D A converters
73. header and H6 a 16 screw terminal block Figure 7 1 shows the pin assignments GND 14 e e 13 GND IWDO 12 e 11 PULSE 10 e e 9 Header H5 DRVOE 5V 6 e 5 HSTEP 4 3 WAVE 2 8 1 24 p Motor Drive Quadrature Sense Input Power He 2 90 9 0 900020520 Y PHB PHD AIN ORG IEL SD 5V 24 Figure 7 1 XP8800 Output Header 5 and Terminal Block 6 Header H5 Signals H5 provides connection points for motor control signals power and ground power failure and watchdog signals The motor control signals are usually used with an amplifier to drive the motor IDRVOE A low signal enables output from the TTL motor driver IC is the PLCBus ground common to the entire system Connect the motor power supply ground only to GND on the screw terminal block H6 HSTEP Together with the WAVE signal HSTEP determines the opera tion of the TTL motor driver IC single phase two phase or half step PDIR This signal indicates in which direction the TTL motor driver IC is to move A high level means movement in the direction A low level means movement in the direction PFl is an analog signal input to the power fail comparator The PFO line becomes active when PFI drops below 1 25 V 0 05 V 56 I O Configurations XP8800 the open collector power failure indicator PFO goes low when PFI goes below 1 25 V 0 05 V
74. hen only the third byte of the address needs to be sent int read24datal long address Returns a value read using the BUSRDI cycle from the specified bus address The address must be that of the data register The data to be read is one of the UART s internal registers such as the channel status register SR or the receiver holding register RHR Specify which register with a prior write to the board s control register int read8datal long address This is an abbreviated form of read24data1 and is used when only the third byte of the address needs to be sent UART Support Functions void uart reset long uart addr Resets the addressed XP8700 at uart_addr Unlike other PLCBus boards which can be reset by reading BUSRESET the XP8700 must be reset by pulsing the RESET bit of the board s control register The minimum reset pulse time is 100 ns long uart addr int logical board Returns the PLCBus address of the control register of the XP8700 whose logical address is 1061081 board int find uart long uart addr Returns 1 if an XP8700 exists at the specified address uart addr Otherwise the function returns 0 int uart reg rd long uart addr char regnum Reads the UART register regnum from the SCC on the XP8700 at PLCBus address uart_addr Does not check to see if the board exists The value regnum represents the intended register and is sent to the board s control register The codes in UART232 LIB
75. ice it is not as efficient as a true interrupt controlled driver would be What this function does is guarantee that interrupts generated by a motor controller are serviced so that the PLCBus interrupt is not held active by the controller locking up the system If you wish to do all motor processing in the background replace the code in the function sm int between the labels mirq and fin with your own code 78 Software Reference XP8800 XP8800 Driver Functions Tables 8 3 8 4 8 5 8 6 and 8 7 list the various XP8800 software drivers in the Dynamic C STEP LIB library Function int sm_bdaddr void int void void int XP8800 sm_board_reset sm_find_boards sm_hitwd sm_int sm_poll Table 8 3 XP8800 General and Initialization Functions Description Generates address from jumper value Issues full board reset Finds and initialize all XP8800s Hits watchdog timer General ISR for XP8800s Polls specified XP8800 Table 8 4 XP8800 Control Register Functions sm 19 sm_drvoe sm_led sm 5 100 sm selO1 sm sellO sm selll Description Writes control register and updates shadow variable Turns motor driver IC output on or off Turns LED D1 on or off Sets select lines to 00 Sets select lines to 01 Sets select lines to 10 Sets select lines to 11 Software Reference 79 Table 8 5 XP8800 Motor Controller Functions Type Function Description
76. ill generate pulses expecting an origin pulse to occur The motor will move until the application issues a decelerating stop command a software or hardware reset or until the application detects an end limit or origin signal if these are enabled The terms dir and speed are Boolean If dir is non zero movement is in the direction Otherwise movement is in the direction If speed is zero the PCL AK pulse generator operates at low speed 84 Software Reference XP8800 Pulses generated at the rate in the FL register Otherwise the PCL AK pulse generator operates at high speed Pulses are gener ated at the rate in the FH register It is important to note that this function starts the movement and does not wait for the movement to complete The application may then perform other tasks while the movement takes place The function issues a software reset to the board before proceeding void smc setmove int index long CTR int FL int FH int ADR int RD int MUL Sets up the registers of the PCL AK pulse generator on the XP8800 specified by index The meaning of the registers listed in Table 7 2 and their interaction is complex See Z World Technical Note 101 Operating the PLC AK High Speed Pulse Generator for more information on the PCL AK chip When the value of the MUL register is 732 the values of the FL and FH registers approximate pulses per second that is when MUL 732 the actual
77. imensions XP8600 cise chien nus 106 XP8900 107 112 114 Index Dinit uart 29 38 40 DIP relays 2 2202 94 display liquid crystal 95 Dkill wart 40 downloading XP8700 Ateius 36 40 Dread uart 39 Dread uartlch 40 Dreset uartrbuf 40 Dreset uarttbuf 40 Drestart uartmodem 42 drivers expansion bus 99 Ae bibet eei 100 8 1 102 relay x cett eine 99 DRIVERS LIB 35 36 76 99 Duart circ 1 38 42 Duartmodem_chk 42 Duartsend 40 dumb terminal 29 40 42 44 Dwrite uart 40 Dwrite uartlch 40 Dxmodem 40 Dxmodem uartup 41 1 12 100 101 1 101 2 101 eioResetPlcBus 100 eioWriteWR 102 Exp A D12 mete 94 expansion boards connection to PLCBus 17 53 100 expansion bus 94 e 95 96 97 98 99 4 bit drivers 100 8 bit drivers
78. its value Wait for interrupt requests 4 Once the XP8800 operation is done issue a soft reset to the PCL AK pulse generator The Dynamic C STEP LIB library handles the details of operating the XP8800 Resetting XP8800 Expansion Boards There are many ways to reset the XP8800 and its components 1 Power Up Reset On power up both the PCL AK pulse generator chip and the quadrature decoder counter undergo a hardware reset The control register powers up to an unknown state making it necessary for the application to initialize the control register before using anything else on the board Use the function sm_find_boards to do this 2 PLCBus Reset PLCBus reset command strobes both the PCL AK and quadrature decoder counter reset lines forcing hardware resets for both The control register and motor driver IC are not affected by a PLCBus reset 3 Watchdog Reset The watchdog timer is a safety feature that halts the PCL AK and there fore motion in the event of a system crash When the watchdog is turned on the application must hit the watchdog at least every 1 5 seconds The watchdog is hit every time the application reads the quadrature counter the actual chip need not be present writes the control register or calls the function sm_hitwd The quadrature counter is not reset in the event of a watchdog timeout 60 I O Configurations XP8800 Once reset this way the PCL AK pulse generator chip will st
79. ling with several interrupting devices Like other Z World expansion boards the XP8700 can be installed in modular plastic circuit board holders attached to a DIN rail The XP8700 can also be mounted with plastic standoffs on any surface that will accept screws The XP8700 expansion board cannot be used as a Dynamic C interface to program the BL1700 controller Such an interface is not supported by the BIOS The Serial Interface Board 2 is available to program the BL1700 if there is a need to have all the BL1700 communi cation ports used by the application The XP8700 expansion board may still be used on the BL1700 s PLCBus to provide another RS 232 port 14 Overview XP8700 CuaPrER 2 GETTING STARTED Chapter 2 provides instructions for connecting XP8700 expansion boards to a Z World controller The following sections are included e XP8700 Components Connecting Expansion Boards to a Z World Controller Setting Expansion Board Addresses XP8700 Getting Started 15 XP8700 Components The XP8700 boards offer a modular RJ 12 jack H2 and a standard 10 pin header to interface with other devices Figure 2 1 illustrates the basic layout and orientation of components headers and connectors PAL U4 PAL U1 5 2691 UART 3 686 MHz LO 79 RN1 U2 RS 232 Driver 0 0 0 0
80. m chk char buf Checks the buffer buf for a valid modem command buf points to a stream terminated by CR that was copied from the receive buffer RETURN VALUE 0 ifa valid modem command is present 1 otherwise e void Ddelay 1 void Ddelay 100ms void Ddelay 5sec Produces a delay of approximately 1 second 100 ms or 5 seconds respectively The function Ddelay 1sec uses suspend 50 if RUNKERNEL is defined The function Ddelay 5sec calls Ddelay_1sec five times e interrupt Duart circ int This is the interrupt service routine for the XP8700 The interrupt service routine plcbus isr in DRIVERS LIB responds to the interrupt and calls Duart circ int Sample Project The sample project presented here demonstrates the use of the XP8700 expansion board in communicating with a dumb terminal The program solicits commands from the dumb terminal If the command is recogniz able the program performs the command Otherwise it simply writes back the input line Connecting a dumb terminal to Z World controller and being able to issue commands or make inquiries to the controller has obvious advan tages Remember that this is only one of many tasks to which an XP8700 can be applied Setting up this demo requires some care and requires that you make your PC operate like a dumb terminal There is a terminal emulation program in Windows TERMINAL that does this Other programs such as PROCOM will work t
81. m the control register Their meanings are summarized in Table 7 3 The Os in the table indicate that the driver line is ON that is it is sinking current Table 7 3 Motor Driver Chip Modes Bit 7 Bit 6 Mode 0 0 Two phase 0 1 Half step 1 0 Single phase 1 1 Undefined Do not use The motor driver chip generates phase signals A B C and D to produce these modes according to the chart in Figure 7 7 The top line of each sequence indicates the state of the driver at power up Single Phase Two Phase Half Step ABCD ABCD ABCD 0111 0110 0111 S 1011 0011 0011 1101 1001 1011 E 1110 1100 1001 1101 1100 1110 0110 Figure 7 7 Illustration of Phase Signals A B C and D Produced by Motor Driver Chip Reverse XP8800 Configurations 67 Figure 7 8 shows how the phase lines are connected to the motor s windings Motor Driver Figure 7 8 Connection of Phase Lines to Motor Driver Power To select a voltage for the motor driver chip be sure to consider the vari ous losses in the drive circuit including the collector emitter voltage and the voltage of the blocking diode Figure 7 9 illustrates these voltages Vp Drive voltage Vm Motor specific voltage v Vr Diode forward voltage typically 0 7 V UCN5804 Vcg Collector emitter voltage V Figure 7 9 Voltage Drops Associated with UCN5804 Motor Driver Chip 68 I O Configurations XP8800 Table
82. nomical and effective Additional testing or burn in of an individual unit is available by special arrangement Company Address AZ 7 Y Z World Inc Telephone 530 757 3737 2900 Spafford Street Facsimile 530 753 5141 Davis California 95616 6800 WebSite http www zworld com USA E Mail zworld zworld com 5 About This Manual vii XP8700 Chapter 1 Overview 13 Chapter 2 Getting Started 15 XP8700 Components temere rite 16 Connecting Expansion Boards to a Z World Controller 17 Setting Expansion Board Addresses 18 XP8700 Addresses eee 18 ho yc 18 Chapter 3 Configurations 19 XP8700 Pin Assignments 20 20 KPS8 700 Operations ie e tee 21 SCC2691 21 Reading and Writing to the UART 26 Controlling the 27 COMMUNICA 29 Interrupts eie ave eerie od tel ea RUE 30 Delays t epe eed ens 31 Chapter 4 Software Reference 33 Expansion Board Addresses 34 Logical Addresses 34 Dynamic C Libraries ed S oe e Bi ee AS 35 XP8700 Software ccna GAM de ala ea 36 General Functions in 36 UART Support Functions esses 37
83. ntroller is disconnected before adding any expansion board to the PLCBus Follow these steps to connect an expansion board to a Z World controller 1 Attach the 26 pin ribbon cable to the expansion board s P2 or H2 PLCBus header 2 Connect the other end of the ribbon cable to the PLCBus port of the controller Be sure pin 1 of the connector cable matches up with pin 1 of both the controller and the expansion board s 3 If additional expansion boards are to be added connect header P2 H2 on the new board to header P1 H1 of the board that is already con nected Lay the expansion boards side by side with headers and P2 H2 on adjacent boards close together and make sure that all expansion boards are facing right side up See Appendix C Connecting and Mounting Multiple Boards for more information on connecting multiple expansion boards XP8800 Getting Started 53 4 Each expansion board comes with factory default board address If more than one expansion board of each type is to be used be sure to set a unique address for each board The following section on Setting Expansion Board Ad dresses and Chapter 8 Software Reference provide details on how to set and use expansion board addresses 5 Power may be applied to the controller once the controller and the expansion boards are properly connected using the PLCBus ribbon cable Setting Expansion Board Addresses Z World has
84. on D0OX D3X four bidirectional data lines used for 4 bit operations D4X D7X four additional data lines for 8 bit operations e AT attention line open drain that may be pulled low by any device causing an interrupt The PLCBus may be used as 4 bit bus DOX D3X or as 8 bit bus DOX D7X Whether it is used as a 4 bit bus or an 8 bit bus depends on the encoding of the address placed on the bus Some PLCBus expansion cards require 4 bit addressing and others such as the XP8700 require 8 bit addressing These devices may be mixed on a single bus XP8700 XP8800 PLCBus 95 There are eight registers corresponding to the modes determined by bus lines 2 and A3X The registers are listed in Table A 2 Table A 2 PLCBus Registers Register Address A3 A2 Al Meaning BUSRDO CO 0 0 0 Read data one way BUSRDI C2 0 0 1 Read data another way BUSRD2 C4 0 1 0 Spare or read data Read this register to BUSRESET 6 0 l reset the PLCBus BUSADRO C8 1 0 0 First address nibble or byte BUSADRI CA 1 0 poa oe nibble or byte BUSADR2 ce 1 1 nibble or byte BUSWR CE 1 1 1 Write data Writing or reading one of these registers takes care of all the bus details Functions are available in Z World s software libraries to read from or write to expansion bus devices To communicate with a device on the expansion bus first select a register associated wit
85. oo The instructions that follow are detailed and assume that you are using TERMINAL in Windows to emulate a dumb terminal 42 Software Reference XP8700 Instructions 1 Power up your controller and make sure it is working properly If you encounter problems consult the controller s user s manual Now disconnect power from the controller 2 Connect the XP8700 to the controller 2 See Chapter 2 Getting Started for more information on installing expansion boards 3 Check header J1 on the XP8700 Leave it unjumpered 4 Power up the controller and bring up Dynamic C on your PC If you encounter problems re establishing communications between your PC and the controller consult the controller s user s manual 5 Open and run the sample program UARTDEMO C that appears below After a few seconds the word Running will appear in the upper right hand corner of the screen 6 Exit from Dynamic C The sample program will continue to run on the controller Disconnect the cable from the RS 232 connector on the controller and plug it into the RS 232 jack on the XP8700 expansion board Use the 10 pin connector or RJ 12 jack whichever matches the cable you have 7 Run Windows and start up TERMINAL the terminal emulation program Make sure that you are communicating at 9600 bps with one stop bit and no parity If you do not have Windows use another terminal emulation program such as PROCOM 8 Type something any
86. pecify too much precision Read the quadrature counter after the operation allowing time for the motor to come to a stop to obtain its correct location void smq_hardreset int index Sends a hardware reset command to the quadrature counter on the XP8800 specified by index The function resets the counter to zero unsigned int smq readl6 int index Returns the entire 16 bit value of the quadrature counter on the XP8800 specified by index char smq read8 int index Returns the lower 8 bits of the quadrature counter on the XP8800 specified by index a number from 0 to 15 as in read16 Sample Program The sample program simulates a single axis system with end limit and slowdown sensors in both directions After initialization the XP8800 first seeks the origin Then the motor goes back and forth a few times moving in one direction until an end limit signal occurs then switches direction As the motor moves it responds to any slowdown signal it receives The following items are needed to run this program stepper motor connected to an XP8800 connected via the PLCBus to a Z World PK2200 or PK2100 controller A length of wire or a test probe to connect various signals to ground This simulates the occurrence of end limit slowdown or origin conditions The sample program prompts you to make the appropriate connections XP8800 Software Reference 87 KK e
87. per motor to stop immediately or decelerate to a stop 62 Configurations XP8800 PCL AK has the following three basic modes of operation 1 Continuous Mode The PCL AK continues to generate pulses until instructed to stop or an external signal arrives 2 Preset Mode The PCL AK generates pulses until its preset counter decrements to 0 or an external signal arrives 3 Origin Mode The PCL AK generates pulses until an origin pulse arrives 4 Stop Mode The PCL AK either generates pulses for the stepper motor chip to bring the stepper motor to an immediate stop or it generates pulses leading to a deceleration to a stop Figure 7 5 shows a block diagram of the PCL AK command amp PULSE data in status and data PDIR out address ORG JEL EL SD SD Figure 7 5 Block Diagram of PCL AK Pulse Generator Chip Communicating with the PCL AK The PCL AK is controlled by writing to its command buffer and by writing values to its control registers The chip can be monitored to find out what it is doing by reading the status register or a control register Only the counter and ramp down point registers are readable The internal registers of the PCL AK can be reset by pulsing the RESET line A software reset does not reset the internal registers XP8800 Configurations 63 Table 7 1 provides the meanings for commands used with the PCL AK Table 7 1 PCL AK Commands
88. pulse frequency is freq FH x 1 000576331967 pulses per second freq FL x 1 000576331967 pulses per second void smc setspeed int index int fast int slow Sets the high FH and low FL speed registers of PCL AK pulse generator on the XP8800 specified by index The parameter fast is for the FH register and the parameter slow is for the FL register Both must be in the range 1 8191 void smc_softreset int index Sends a software reset command to the PCL AK pulse generator on the XP8800 specified by index This stops pulse output and therefore motion without clearing the internal registers e char smc_stat0 int index Reads the 8 bit status register at address 0 Al 0 0 on the PCL AK pulse generator on the XP8800 specified by index The function returns the status bits 120 127 explained in Chapter 7 Status Bits XP8800 Software Reference 85 char smc stat3 int index Reads the 8 bit status register at address 3 Al 0 1 of the PCL AK pulse generator on the XP8800 specified by index If the RD register ramp down point is selected before reading the status with address 3 bits 0 and 1 are status bits If any other register is selected bits 0 and 1 represent bits 16 and 17 respectively of the counter register The function returns the status bits 00 07 explained in Chapter 7 Status Bits unsigned int smcq moveto int index unsigned dest int dir unsigned accuracy
89. put bits 000j 10xj analog input modules 128 registers 000 11 128 spare registers customer 001 512 spare registers Z World j controlled by board jumper x controlled by PAL 98 PLCBus XP8700 XP8800 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 bit 2 bit 1 bit 0 A2 Al AO 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 For digital input each register BUSRDO returns four bits The read register BUSRDI drives bit 0 low if the device exists on the bus 8 Bit Devices Z World s XP8700 and XP8800 expansion boards use 8 bit addressing Expansion Bus Software The expansion bus provides a convenient way to interface Z World s controllers with expansion boards or other specially designed boards The expansion bus may be accessed by using input functions Follow the suggested protocol The software drivers are easier to use but are less efficient in some cases Table A 5 lists the libraries Table A 5 Dynamic C PLCBus Libraries DRIVERS LIB All controllers EZIOTGPL LIB BL1000 EZIOLGPL LIB BL1100 EZIOMGPL LIB BL1
90. rary Needed Controller DRIVERS LIB BL1200 BL1600 PK2100 PK2200 EZIOCMMN LIB BL1200 BL1600 PK2100 PK2200 EZIOPBDV LIB BL1200 BL1600 PK2100 PK2200 EZIOPLC LIB BL1200 BL1600 PK2100 PK2200 EZIOPLC2 LIB BL1700 EZIOBL17 LIB BL1700 PLC EXP LIB BL1200 BL1600 PK2100 PK2200 8700 expansion board cannot be used Dynamic interface to program the BL1700 controller because the interface is not supported by the BIOS Before using one of these libraries in an application first include the library name in a use command For example to use functions in the library PLC_EXP LIB be sure there is a line at the beginning of the program in the following format duse plc exp lib XP8700 Software Reference 35 XP8700 Software There are several levels of software for operating the XP8700 The basic functions may be found in DRIVERS LIB Other functions are more specific The highest level functions relate to serial communication They support circular buffering modem communication and uploading and downloading data Table 4 3 lists these other libraries Table 4 3 XP8700 Related Libraries Library Use UART232 LIB Used with first XP8700 board connected to BL1200 PK2100 and PK2200 controllers UART2 LIB Used with second XP8700 board connected to BL1200 PK2100 and PK2200 controllers MODEM232 LIB Support library for other communication libraries AASCUART LIB Operates up to four XP870
91. rence XP8700 8800 Blank CHAPTER 5 OVERVIEW Chapter 5 provides an overview and description of the 8800 motion control expansion boards XP8800 Overview 49 XP8800 Overview Z World s XP8800 expansion board may be attached to a Z World controller with a PLCBus port The XP8800 does not have the software drivers to enable it to be used with other Z World controllers The XP8800 controls a single axis of motion Multiple XP8800s may be connected to provide up to four axes of control The benefit of the XP8800 is that it can handle motor control operations leaving the master controller free to perform other tasks The onboard motor driver IC UCN5804 is capable of driving 1 A per phase and motor voltages up to 35 V The driver automatically generates the sequencing for 1 phase 2 phase and half step operations The XP8800 includes a 16 bit quadrature decoder counter HCTL 2016 that can count at speeds up to 3 MHz An 8810 version of the XP8800 expansion board is available The XP8810 offers optical isolation for the quadrature and sense inputs Note that there is common ground for the board and the inputs Therefore the optical isolation is not absolute Like other Z World expansion boards the XP8800 can be installed in modular plastic circuit board holders attached to a DIN rail The XP8800 can also be mounted with plastic standoffs on any surface that will accept screws Features Continuo
92. rst byte 1100 identify the address as being 8x2 format The address is placed on the bus using the functions set82adr and set81ladr The LED D2 will light up on the XP8800 that matches the address the software placed on the PLCBus Examples 1 Write the control register on the XP8800 whose address jumpers are 3 abcd 0011 BUSADRO 00111100 1st addr byte 0 6 BUSADR1 04h 00000100 2nd addr byte 0 6 Set shadow variable control register value then 60 BUSWR lt shadow gt control bits 74 Software Reference XP8800 2 Write command to the PCL AK on XP8800 whose address jumpers are 8 abcd 1000 first make select lines 00 outO0 BUSADRO 3Ch 00111100 1st addr byte 60 BUSADR1 04h 00000100 2nd addr byte Set shadow variable AND shadow variable OxE7 then outO BUSWR shadow control bits now address the PCL AK and send command 60 BUSADR1 00h 00000000 2nd addr byte out0 BUSWR command command 3 Read the 16 bit quadrature counter on the XP8800 whose address jumpers 13 abcd 1101 first make select lines 00 to get high byte 60 BUSADRO 3Ch 00111100 1st addr byte 60 BUSADR1 04h 00000100 2nd addr byte Set shadow variable AND shadow variable OxE7 then outO BUSWR shadow control bits 0 high BUSRDO get high byte next make select lines 01 to get low
93. rupts can come from any source including other expansion boards A PLCBus interrupt service routine must determine where the interrupt originated and what to do XP8800 Configurations 71 Blank 72 Configurations XP8800 CHAPTER 8 SOFTWARE REFERENCE Chapter 8 describes the Dynamic functions used to initialize the XP8800 Series expansion boards and to control the resulting outputs The follow ing major sections are included Expansion Board Addresses Dynamic C Libraries e XP8800 Software XP8800 Software Reference 73 Expansion Board Addresses Up to 16 XP8800 addresses are possible on the PLCBus Power con straints usually limit the number of XP8800 expansion boards to four allowing four axes of control Each XP8800 has three addressable components the PCL AK pulse generator the quadrature decoder counter and the control register The address of a particular XP8800 is determined by jumpers on header H4 as shown here abcd1100 x0000Rxx where 0 if H4 pins 1 2 are connected and 1 if not b 0 if H4 pins 3 4 are connected and 1 if not c 0 if H4 pins 5 6 are connected and 1 if not 6 0 11 H4 pins 7 8 are connected and 1 if not X does not matter 0 to read or write PCL AK pulse generator to read the quadrature counter to write the control register The address is placed on the PLCBus as 2 bytes using two bus cycles BUSADRO and BUSADRI The lower four bits of the fi
94. s 0 are explained below for os os ce on DO 1 EL end limit signal D1 1 EL signal D2 1 ORG origin signal D3 1 counter output 0 D4 1 ramp down point register RD selected 0 other register selected D5 1 frequency stabilized after ramp down or ramp up D6 1 operation in progress D7 0 interrupt request active Bits 0 and of the address 3 status depend on whether the RD ramp down point register was selected prior to reading the status The status bits for address 3 are explained below DO D1 D2 D3 D4 D5 D6 D7 If RD register is selected 0 stop interrupt signal is being output else bit 16 of counter is output If RD register is selected 0 ramp down point interrupt signal is being output else bit 17 of counter is output 1 SD slow down signal 1 SD signal Ramp up in progress Ramp down in progress counter ramp down point O PULSE signal is not active 1 PULSE signal is active See Z World Technical Note 101 Operating the PLC AK High Speed Pulse Generator for more information on the PCL AK chip 66 I O Configurations XP8800 UCN5804 Motor Driver IC The motor driver chip UCN5804 receives two pulse signals from the PCL AK pulse generator One signal PULSE steps the motor The other signal PDIR specifies the motor rotation high forward low reverse The driver receives two mode signals fro
95. s shown in Figure 7 4 One or more of these components may be left unused For example the XP8800 can be used solely as a quadrature counter by ignoring the PCL AK and the motor driver ICs The XP8800 can even be used as a timer by ignoring or disabling its outputs i A interrupt request Pulse amp Dir data Pulse Generator C Reset D Phase Output mode 1 phase 2 phase half step control byte PLCBus Watchdog Expansion Header Quadrature Decoder Counter SD slow down EL end limit AB ORG 0 EL ORG origin from external SD Positive direction quadrature encoder from external sensors Negative direction Figure 7 4 XP8800 Block Diagram PCL AK Pulse Generator The PCL AK pulse generator at the heart of the XP8800 controls the motor driver IC The bidirectional PULSE output signal steps a motor If PDIR is 1 the move is in the direction 0 means the move is in the direction The PCL AK can generate thousands of different pulse rates 99 The PCL AK can sense external signals such as slow down end limit and origin and can accelerate and decelerate the motor driver IC between high speed and low speed settings The PCL AK is able to generate interrupt requests in response to certain conditions such as the end of the operation The PCL AK chip can signal the step
96. thing The sample program will respond If you type one of these commands the controller will execute the command help deliver a short help message time print the time according to the controller date print the date according to the controller If you type anything else the controller will simply repeat what you typed Press ALT F4 to get out of the Windows TERMINAL program The controller will continue to run the sample program indefinitely until the controller 18 reset XP8700 Software Reference 43 Sample Program This sample program demonstrates the use of the XP8700 expansion board in communicating with a dumb terminal The program solicits com mands from the dumb terminal If the command is recognizable the program performs the command Otherwise it simply writes back the input line UARTDEMO C globals define USE UARTEXP enable uart interrupts byte baud 9600 1200 9600 baud byte mode 0x04 1 stop no parity 1 data no cts rts byte modem 0 no modem is connected byte echo 1 chars are echoed char tbuf 100 transmit buffer char rbuf 100 receive buffer prototypes void interpret cmd char void crlf main char buf 100 dif BOARD TYPE CPLC BOARD uplc init Reset PBus Reset PBus Wait relocate int1 Dinit uart rbuf tbuf 100 100 mode baud modem echo while 1 Duartsend prompt CR LF read command amp t
97. tion 0 and so on void set82adr int addr Places the specified address on the PLCBus in 8 2 addressing mode The term addr is a physical board address Its upper byte must be xxxx1100 binary and the lower byte should be 0 to read or write the PCL AK pulse generator or 1 to read the quadrature counter or to write the control register The upper 4 bits of the address correspond to the jumpers on the intended XP8800 The execution time for this function is 87 cycles assuming 0 wait states that is 14 16 us at 6 144 MHz 71 kHz 9 44 us at 9 216 MHz 109 kHz void set8ladr int addr Places the specified address on the PLCBus in 8 2 addressing mode The term addr is the lower byte a physical board address This function assumes that the upper byte has already been placed on the bus The lower byte should be 0 to read or write the PCL AK pulse generator or to read the quadrature counter or to write the control register The main purpose of this function is to save PLCBus cycles The execution time for this function is 60 cycles assuming 0 wait states that is 9 77 us at 6 144 MHz 102 kHz 6 50 us at 9 216 MHz 154 kHz int sm_bdaddr int jumpers Returns the physical PLCBus address for an XP8800 that has the specified jumper settings on header H4 The term jumpers must be an integer from 0 to 15 The function returns the physical PLCBus address in a form directly passable to set82adr void sm_board_reset int index
98. trols whether FIFO full FFULL or Receiver Ready RxRDY is reported ACR is the auxiliary control register BRG set low select power counter timer mode source MPO pin function select ACR bit 7 controls which set of baud rates is selected The CSR clock select register specifies one rate from the selected set for the receiver and a separate rate from the selected set for the transmitter Aye Refer to the Signetics SCC2691 product description for a description of other bits in this register and in other registers XP8700 Configurations 25 Reading and Writing to the UART The PLCBus cycles have special meaning when addressing an XP8700 Reading or writing to one of the bus registers causes the bus cycle to occur according to Table 3 4 Table 3 4 XP8700 Bus Cycles Register Address Usage BUSADRO OxC8 First address byte BUSADRI OxCA Second address byte BUSADR2 OxCC Third address byte BUSWR OxCE Write data to control or data register whichever was addressed BUSRDO 0xCO Read 8700 information Bit 0 when 0 indicates the presence of a properly addressed XP8700 Bit 1 when set indicates that the UART needs servicing This read is valid only when the board s control register has been addressed BUSRDI 0xC2 Read the UART internal register selected by the board s control register This read is valid only when the board
99. uit board holders Z World s expansion boards can also be mounted with plastic standoffs to any flat surface that accepts screws The mounting holes are 0 125 inches 1 8 inch in from the edge of a board and have a diameter of 0 190 inches Figure C 2 Mounting Expansion Boards on DIN Rail information on ordering DIN rail mounts call your Z World Sales Representative at 530 757 3737 112 Connecting and Mounting Multiple Boards XP8700 XP8800 Symbols 4 bit bus operations 5 3 addressing mode 8 bit bus operations A1X A2X A3X acceleration addresses encoding 2 22 0 logical 700 rne XP8700 XP8800 65 25 97 34 97 34 74 97 34 74 59 attention line 95 auxiliary control register 24 25 B background routine 98 baud rates XP8700 s Rh 21 bidirectional data lines 95 BIN 57 59 block diagram XP8800 nnt 62 board layout 6700 iiie test 16 XPS8800 52 bus control registers 99 EXPANSION 2 94 e ees 95 96 97 98 99 4 bit drivers 100 8 bit drivers 102 addresses 98 devices 98 99 functions 100 101 102 103 rules for devices 98 software drivers 99 LCD 552 et
100. unication service routine Duart circ int is called within p1cbus isr which responds to PLCBus interrupts UART232 LIB library assumes that there is only one XP8700 in the system Its address is defined as shown here define UARTADDR 0x040018 no jumpers at 91 This constant must be changed 1f the XP8700 uses a different address If there is more than one XP8700 some of the UART232 LIB library may have to be rewritten to handle multiple boards Call Dinit uart before using any of the other functions described here 38 Software Reference XP8700 e int Dinit_uart char rbuf char tbuf int rsize int tsize char mode char baud char ismodem char isecho Initializes the XP8700 and software for RS 232 communication This library uses circular receive and transmit buffers which are allocated by the programmer This function tells the software what the setup is PARAMETERS rbuf is a pointer to the receive buffer tbufpointer to the transmit buffer rsize is the size in bytes of the receive buffer tsize is the size in bytes of the transmit buffer mode selects communication criteria as follows bit 0 0 1 stop bit 1 2 stop bits bit 1 0 no parity 1 with parity bit 2 0 7 data bits 1 8 data bits bit 3 0 even parity 1 odd parity bit 4 0 no CTS RTS control 1 CTS RTS enabled baud selects the baud rate in multiples of 1200 bps Valid multipliers are 1 2 4 8 16 24 32 48 and 64 Pass a value of 8 to get 9
101. us manual preset counted or origin seeking modes of operation Switching between high speed and low speed operation with or without acceleration and deceleration e Bidirectional pulse output modes Sensing of origin end limit and slowdown signals Interrupt generation e 13 bit 8 191 step rate resolution 18 bit 256K counter e User definable output speed range up to 16 kHz e Single phase dual phase and half step modes 16 bit quadrature decoder counter e Watchdog reset Optional optical isolation for quadrature and sense inputs 50 Overview XP8800 CuaPrER 6 GETTING STARTED Chapter 6 provides instructions for connecting XP8800 expansion boards to a Z World controller The following sections are included 8800 Series Components Connecting Expansion Boards to a Z World Controller Setting Expansion Board Addresses XP8800 Getting Started 51 XP8800 Components The XP8800 stepper motor control expansion board controls a single axis of motion Figure 6 1 shows the basic layout and orientation of compo nents headers and connectors Quadrature Decoder amp Counter ae 2 RN1 O O U1
102. void smc_cmd Writes to PCL AK command register void smc_hardreset Pulses PCL AK reset line registers are reset void smc_manual_move Starts continuous movement movement continues until told to stop void smc_seek_origin Starts continuous movement movement continues until origin pulse ORG void smc_setmove Sets PCL AK registers for a move operation void smc_setspeed Sets PCL AK s two speed registers void smc_softreset Sends reset command to PCL AK registers are not reset char 0 Reads PCL AK status register at address 0 char smc_stat3 Reads PCL AK status register at address 3 Table 8 6 XP8800 Quadrature Counter Functions Function Description void unsigned int char Type void void unsigned int smq_hardreset Pulses quadrature counter reset line smq_read16 Reads entire 16 bit counter value smq_read8 Reads counter s lower 8 bits Table 8 7 Miscellaneous XP8800 Functions Function Description set81adr Places XP8800 address on bus shortcut set82adr Places XP8800 address on bus Uses the motor s quadrature decoder to smcq_moveto move to location 80 Software Reference XP8800 Miscellaneous XP8800 Function Descriptions In all the following function descriptions the parameter index is a number from 0 to 15 that represents the sequence of boards found by sm_find_boards The board with the lowest jumper setting is at posi
Download Pdf Manuals
Related Search
Related Contents
PhosphoQUANTI SolidBlue GelDye Kit Progress Lighting P5768-46 Installation Guide 一般撮影用カセッテ EC-A、EC-AWU Roger と人工内耳 アドバンスト・バイオニクス社 オーリア / ハーモニー Manuale Utente STAR 8 - 10 - 12 - Pelletkachel Consumer and Consommation ` Corporale Bedienungsanleitung Mode d`emploi Istruzioni per l`uso 8 - Domyos Copyright © All rights reserved.
Failed to retrieve file