SAIA-Burgess PCD2 H110 Universal counting and measuring module User's Guide
Below you will find brief information for Universal counting and measuring module PCD2 H110. The PCD2 H110 module extends the frequency range to 100 kHz, allowing accurate measurement of frequencies up to 100 kHz and the length of periods or pulses up to one hour. It is also capable of axis control with incremental shaft encoders. It can be used for fast pulse counting proportional to quantities, unregulated axis control of any drives, and quartz accuracy in determining velocity, rotary frequency, and flow rate for applications such as automatic handling- and assembly machines, pick and place functions, palletising equipment, and automatic angle control.
Advertisement
Advertisement
SAIA PCD Process Control Devices English edition 26/755 E2 PCD2.H110 Universal counting and measuring module SAIA-Burgess Electronics Ltd. Bahnhofstrasse 18 CH-3280 Murten (Switzerland) http;//www.saia-burgess.com BA: Electronic Controllers Telephone Telefax 026 / 672 71 11 026 / 670 44 43 ___________________________________________________________________________________________________________________________ SAIA-Burgess Companies Switzerland SAIA-Burgess Electronics AG Freiburgstrasse 33 CH-3280 Murten 026 672 77 77, Fax 026 670 19 83 France SAIA-Burgess Electronics Sàrl. 10, Bld. Louise Michel F-92230 Gennevilliers 01 46 88 07 70, Fax 01 46 88 07 99 Germany SAIA-Burgess Electronics GmbH Daimlerstrasse 1k D-63303 Dreieich 06103 89 060, Fax 06103 89 06 66 Nederlands SAIA-Burgess Electronics B.V. Hanzeweg 12c NL-2803 MC Gouda 0182 54 31 54, Fax 0182 54 31 51 Austria SAIA-Burgess Electronics Ges.m.b.H. Schallmooser Hauptstrasse 38 A-5020 Salzburg 0662 88 49 10, Fax 0662 88 49 10 11 Belgium SAIA-Burgess Electronics Belgium Avenue Roi Albert 1er, 50 B-1780 Wemmel 02 456 06 20, Fax 02 460 50 44 Italy SAIA-Burgess Electronics S.r.l. Via Cadamosto 3 I-20094 Corsico MI 02 48 69 21, Fax 02 48 60 06 92 Hungary SAIA-Burgess Electronics Automation Kft. Liget utca 1. H-2040 Budaörs 23 501 170, Fax 23 501 180 Representatives Great Britain Canham Controls Ltd. 25 Fenlake Business Centre, Fengate Peterborough PE1 5BQ UK 01733 89 44 89, Fax 01733 89 44 88 Portugal INFOCONTROL Electronica e Automatismo LDA. Praceta Cesário Verde, No 10 s/cv, Massamá P-2745 Queluz 21 430 08 24, Fax 21 430 08 04 Denmark Malthe Winje Automation AS Håndværkerbyen 57 B DK-2670 Greve 70 20 52 01, Fax 70 20 52 02 Spain Tecnosistemas Medioambientales, S.L. Poligono Industrial El Cabril, 9 E-28864 Ajalvir, Madrid 91 884 47 93, Fax 91 884 40 72 Norway Malthe Winje Automasjon AS Haukelivn 48 N-1415 Oppegård 66 99 61 00, Fax 66 99 61 01 Czech Republic ICS Industrie Control Service, s.r.o. Modranská 43 CZ-14700 Praha 4 2 44 06 22 79, Fax 2 44 46 08 57 Sweden Malthe Winje Automation AB Truckvägen 14A S-194 52 Upplands Våsby 08 795 59 10, Fax 08 795 59 20 Poland SABUR Ltd. ul. Druzynowa 3A PL-02-590 Warszawa 22 844 63 70, Fax 22 844 75 20 Suomi/ Finland ENERGEL OY Atomitie 1 FIN-00370 Helsinki 09 586 2066, Fax 09 586 2046 Australia Siemens Building Technologies Pty. Ltd. Landis & Staefa Division 411 Ferntree Gully Road AUS-Mount Waverley, 3149 Victoria 3 9544 2322, Fax 3 9543 8106 Argentina MURTEN S.r.l. Av. del Libertador 184, 4° “A” RA-1001 Buenos Aires 054 11 4312 0172, Fax 054 11 4312 0172 After sales service USA SAIA-Burgess Electronics Inc. 1335 Barclay Boulevard Buffalo Grove, IL 60089, USA 847 215 96 00, Fax 847 215 96 06 ___________________________________________________________________________________________________________________________ Issue : 22.11.2000 Subjet to change without notice SAIA® Process Control Devices Universal counting and measuring module PCD2.H110 SAIA-Burgess Electronics Ltd. 1999 all rights reserved Edition 26/755 E2 - 04.99 Subject to technical changes SAIA-Burgess Electronics Ltd. Updates Manual : Date PCD2.H110 - Universal counting and measuring module - Edition E2 Chapter Page Description SAIA-Burgess Electronics Ltd. PCD2.H110 Table of contents Table of contents Page 1. Introduction 1.1 1.2 1.3 1.4 1.5 General Function and application Main characteristics Typical areas of application Programming 2. Technical data 2.1 2.2 2.3 Technical data of the hardware Electrical specification Function specific data 3. Presentation 4. Terminals, cable and meaning of the LED's 5. Brief introduction 5.1 5.2 Getting started with programming in IL Getting started with programming in FUPLA 6. Programming 6.1 Programming in IL with FBs 6.1.1 6.1.2 The IL package (Installation of the FBs) The individual FBs 6.2 6.3 Programming in FUPLA with FBoxes Programming in GRAFTEC with FBoxes 7. Error handling and diagnostics 7.1 7.2 Definition errors checked by the assembler Error handling in run 26/755 E2 (2H1-00-E.DOC) SAIA-Burgess Electronics Ltd. 1-1 1-2 1-3 1-4 1-5 2-1 2-3 2-4 5-2 5-5 6-2 6-2 6-5 7-1 7-2 Page 1 Table of contents PCD2.H110 Page 8. PCD2.H110 for counting and motion control tasks 8.1 8.2 8.3 Block diagram of counter Description of counter Configuration of inputs 'EnableC', 'CCO', 'A', 'B' and the count mode 8.3.1 8.3.2 8.3.3 8.3.4 8.4 8.5 8.6 8.7 8.8 9.1 Frequency measurement 9.1.1 9.1.2 9.1.3 9.1.4 9.1.5 8-13 8-18 8-26 Block diagram Description of frequency measurement Configuration of frequency measurement Programming principle Combination of counting and frequency measuring Block diagram Description of period length measurement Configuration of period length measurement Programming priciple 9-7 9-8 9-9 9-10 9-13 Block diagram Description of pulse length measurement Configuration of pulse length measurement Programming principle SAIA-Burgess Electronics Ltd. 9-1 9-2 9-3 9-4 9-6 9-7 Pulse length measurement 9.3.1 9.3.2 9.3.3 9.3.4 8-8 8-9 9-1 Period length measurement 9.2.1 9.2.2 9.2.3 9.2.4 Page 2 8-3 8-4 8-5 8-6 Programmable counter functions Programming principle Application example no. 1: Counter in GRAFTEC Application example no. 2: Motion control with incremental shaft encoder Application example no.3: Measurement with counting PCD2.H110 for measuring tasks 9.3 8-3 Configuration of the 'EnableC' input Configuration of the 'CCO' output Configuration of the inputs 'A' and 'B' Configuration of count mode 9. 9.2 8-1 8-2 (2H1-00-E.DOC) 9-13 9-14 9-15 9-16 26/755 E2 PCD2.H110 Table of contents Page Appendix A: Summary of all software elements for programming in IL (FBs) INIT EXEC LdCtPres LdRegPres ModMsConf LdMsVal RdCt RdMsImp RdMsUnit StartCt StartMs StopMs RdIdent Appendix B: Initialisation FB Execution FB Load counter preset Load register preset Measure mode configuration Load measure value Read counter Read measure in impulsion Read measure in unit Start counter Start measure Stop measure Read module identification A-1 A-3 A-4 A-5 A-6 A-7 A-9 A-10 A-11 A-12 A-13 A-14 A-15 Summary of all software elements for programming in FUPLA (FBoxes) in preparation 26/755 E2 (2H1-00-E.DOC) SAIA-Burgess Electronics Ltd. Page 3 Table of contents PCD2.H110 Notes Page 4 SAIA-Burgess Electronics Ltd. (2H1-00-E.DOC) 26/755 E2 PCD2.H110 Table of contents Please note: A number of detailed manuals are available to aid installation and operation of the SAIA PCD. These are for use by technically qualified staff, who may also have successfully completed one of our workshops. To obtain the best performance from your SAIA PCD, closely follow the guidelines for assembly, wiring, programming and commissioning given in these manuals. In this way, you will also become one of the many enthusiastic SAIA PCD users. If you have any technical suggestions or recommendations for improvements to the manuals, please let us know. A form is provided on the last page of this manual for your comments. Summary PCD1/2 series Ha rdw ar e P CD 1 P CD 2 S erie x x7 PCD4 series PCD6 series H a rd w are PC D 4 H a rdw a re PC D 6 PC D4. H1.. *) PCD2.M220 PCD2.H110 PCD2.H150 PCD2.H210 PCD2.H31x General Manuals PC D4.H2.. *) PCD4.H 3.. *) PCD4 .H 4.. *) Adapter modu le 4'717'4828 '0 allow s H m odules to be us ed w ith the PCD 6. U s e r's G u id e R efe re nce G uide (PG 3) P C D 8 .P 1.. PC D7.D 1.. PC A2.D1.. PC D7.D 2.. - S-Bus - PROFIBUS - Remote I/O I n sta llat io n C om p on e nts for RS 485N etw o rk s - PG4 - Modem FUPLA/ KOPLA function families 26/755 E2 (2H1-00-E.DOC) SAIA-Burgess Electronics Ltd. Page 5 Table of contents PCD2.H110 Reliability and safety of electronic controllers SAIA-Burgess Electronics Ltd. is a company which devotes the greatest care to the design, development and manufacture of its products: • • • • • • • • state-of-the-art technology compliance with standards ISO 9001 certification international approvals: e.g. Germanischer Lloyd, UL, Det Norske Veritas, CE mark ... choice of high-quality components quality control checks at various stages of production in-circuit tests run-in (burn-in at 85°C for 48h) Despite every care, the excellent quality which results from this does have its limits. It is therefore necessary, for example, to reckon with the natural failure of components. For this reason SAIA-Burgess Electronics Ltd. provides a guarantee according to the "General terms and conditions of supply". The plant engineer must in turn also contribute his share to the reliable operation of an installation. He is therefore responsible for ensuring that controller use conforms to the technical data and that no excessive stresses are placed on it, e.g. with regard to temperature ranges, overvoltages and noise fields or mechanical stresses. In addition, the plant engineer is also responsible for ensuring that a faulty product in no case leads to personal injury or even death, nor to the damage or destruction of property. The relevant safety regulations should always be observed. Dangerous faults must be recognized by additional measures and any consequences prevented. For example, outputs which are important for safety should lead back to inputs and be monitored from software. Consistent use should be made of the diagnostic elements of the PCD, such as the watchdog, exception organization blocks (XOB) and test or diagnostic instructions. If all these points are taken into consideration, the SAIA PCD will provide you with a modern, safe programmable controller to control, regulate and monitor your installation with reliability for many years. Page 6 SAIA-Burgess Electronics Ltd. (2H1-00-E.DOC) 26/755 E2 PCD2.H110 Introduction 1. Introduction 1.1 General The standard equipment of SAIA PCD process control devices already offers 1600 counting registers of 31 bits, although they can only capture frequencies up to approx. 20 Hz. Via the interrupt inputs, 1 kHz can be achieved and, with the ..H100 counting module, up to 20 kHz are possible. The new ..H110 counting module not only extends the frequency range to 100 kHz, but also allows accurate measurement of frequencies up to 100 kHz and the length of periods or pulses up to one hour. Its two counting inputs, A and B, enable it to recognize the rotatiorial direction of incremental shaft encoders, thus making the ..H110 module also capable of axis control, as long as regulated motion is not required from the module. For the regulated control of servo-motors with starting and braking ramps, we recommend the PCD2.H3.. motion control module. The new ..H110 counting and measuring module uses a modern FPGA component (field programmable gate array), which can also be programmed for other specific OEM tasks by means of plug-in PROM. For this purpose, 4 inputs, 4 outputs and 2 x 4 LEDs are provided to the outside. Function blocks and a comprehensive manual are available to the user for standard ..H110 functions. 26/755 E2 (2H1-10-E.DOC) SAIA-Burgess Electronics Ltd. Page 1-1 Introduction PCD2.H110 1.2 Function and application This low-cost module can be plugged into any I/O socket on a PCD1 or PCD2. The module can be used in different modes: BUS PCD1/2 PROCESSOR PCD1/2 BUS PCD1/2 PROCESSOR PCD1/2 Block diagram as counting module IN-A IN-B COUNTER 24 BITS COUNTER MODE x1, x2, x4 ENABLE START UP/DOWN AND I/O LOGIC CCO CCO BUS INTERFACE PRESET REGISTER LATCH REGISTER CLK 1kHz COUNTER 16 BITS IN-A MEASURE TIME COUNTER 16 BITS START I/O LOGIC ENABLE TCO TACHOMETER ENABLE TCO BUS INTERFACE Block diagram for frequency measurement LATCH REGISTER ON OFF IN-A COUNTER 16 BITS START I/O LOGIC TACHOMETER ENABLE TCO ENABLE TCO PROCESSOR PCD1/2 MULTIPLICATOR (n × 1 µ s) BUS PCD1/2 CLK 1 MHz BUS INTERFACE Block diagram for measuring period or pulse length LATCH REGISTER Page 1-2 O O O O 0 1 2 3 PROM WITH SPECIAL APPLICATION I/O LOGIC FPGA SAIA-Burgess Electronics Ltd. PROCESSOR PCD1/2 0 1 2 3 BUS PCD1/2 I I I I BUS INTERFACE Block diagram for special OEM versions (2H1-10-E.DOC) 26/755 E2 PCD2.H110 Introduction 1.3 Main characteristics • • Up to 16 PCD2.H110 modules in parallel operation can be inserted in one PCD2, or up to 4 in one PCD1. Counting and measuring functions can be utilized simultaneously in the same module. As a counting module • • • • • • • Counting frequency up to 100 kHz Counting range 0 ... 16 777 215 (24 bit) Preset value 0... 16 777 215 (24 bit) Up or down counting to preset value 2 digital inputs A and B with recognition of rotational direction 1 direct counter output CCO Selectable counting modes For frequency measurement • • • • Frequency range 500 Hz to 100 kHz Measurement range 0 ... 65 535 (16 bit) Accuracy ≥1‰. (depending on measurement time) The fast TCO output can be used at the end of a measurement, e. g. to trigger an interrupt To measure period or pulse length • • • 26/755 E2 (2H1-10-E.DOC) Frequency range 0.27 mHz to 500 Hz Period or pulse lengths from 2 ms to 1h The fast TCO output can be used at the end of a measurement, e. g. to trigger an interrupt. SAIA-Burgess Electronics Ltd. Page 1-3 Introduction PCD2.H110 1.4 Typical areas of application For small, basic PCD1 and PCD2 controllers, use of the new ..H-modules considerably extends the area of application. In particular, the ..H110 enables: • fast pulse counting proportional to quantities (items, units of energy, etc.), placing little load on the basic CPU • unregulated axis control of any drives with incremental shaft encoders • quartz accuracy in determining velocity, rotary frequency, flow rate, etc. Applications: • • • • • Page 1-4 Automatic handling- and assembly machines Pick and place functions Palletising equipment Automatic angle control, e.g. of cameras, headlamps, aerials, etc. Motion control of static axes (set-up) SAIA-Burgess Electronics Ltd. (2H1-10-E.DOC) 26/755 E2 PCD2.H110 Introduction 1.5 Programming Pre-programmed functional blocks make it possible to simply enter the parameters necessary for the desired count or measuring mode. These FBs (IL) and FBoxes (FUPLA) are used by the PG4 (Windows programming software). The present manual includes detailed descriptions of each function block, with associated practical examples. The use of the older programming tool "PG3" is possible only with special FBs) lnitialization command INIT - Select the module number - Counter configuration - Counter preset - Register preset - Enable counter configuration - CCO configuration - IN-A configuration - IN-B configuration - Measuring configuration - Measuring value - Enable measuring configuration - TCO configuration Execution command EXEC - Select the module number - command - Register for load value or result The commands: - LdCtPres - LdRegPres - ModMsConf - LdMsVal - RdCt - RdMsImp - RdMsUnit - StartCt - StartMs - StopMs - RdIdent 26/755 E2 (2H1-10-E.DOC) Load counter preset Load register preset Measure mode configuration Load measure value Read counter Read measure in impulsion Read measure in unit (Hz or ms) Start counter Start measure Stop measure Read module identification SAIA-Burgess Electronics Ltd. Page 1-5 Introduction PCD2.H110 Notes Page 1-6 SAIA-Burgess Electronics Ltd. (2H1-10-E.DOC) 26/755 E2 PCD2.H110 Technical data 2. Technical data 2.1 Technical data for the hardware Digital inputs Total 4 Nominal voltage: 24 V Low range: - 30 ... +5 V High range: +15 ... +30 V Source mode only (positive logic) Input current (typical) 6.5 mA Inputfilter 150 kHz Switching type galvanically connected Digital outputs: Total Current range Short-circuit protection Frequency Voltage range Switching type Potential drop (typically) Output delay 2 5 to 500 mA (Leakage current max.: 1 mA) (Load resistance min.: 48 Ω in the voltage range from 5 to 24 V) no ≤ 100 kHz 5 to 32 V (external supply) galvanically connected < 0.5 V by 500 mA less than 1 µs with inductive loads, the delay is longer due to the protective diode Power supply Internal supply from PCD1/2 bus External by user for all outputs 5 VDC, max. 90 mA 24 VDC (10 ... 32 VDC), max. 2 A smoothed ripple max. 10% Operating conditions Ambient temperature Interference immunity 26/755 E2 (2H1-20-E.DOC) operation: 0 ... +50°C without forced ventilation storage: -20 ... +85°C CE mark according to EN 50081-1 and EN 50082-2 SAIA-Burgess Electronics Ltd. Page 2-1 Technical data PCD2.H110 LED displays Total 6 LED 0: LED 1: LED 2: LED 3: LED 4: LED 5: Status of input "A" Status of input "B" Status of input "EnableC" Status of input "EnableM" Status of "CCO" output Status of "TCO" output Programming Based on PCD user program (PG4) and pre-programmed functional blocks. Ordering details PCD2.H110 PCD9.H11E Page 2-2 Universal counting and measuring module Software library with function blocks SAIA-Burgess Electronics Ltd. (2H1-20-E.DOC) 26/755 E2 PCD2.H110 Technical data 2.2 Electrical specification Internal power consumption +5V: Uext: max. 90 mA 0 ... 10 mA (without load current) External power supply Terminals +/-: 10 ... 32 VDC smoothed, residial ripple max. 10% TVS diode 39 V ±10% max. 2 A for outputs not protected against wrong polarity! Digital inputs 4 digital inputs (E0 ... E3) (see chapter 2.1) Digital outputs 2 digital outputs (A0 and A1) (see chapter 2.1) 26/755 E2 (2H1-20-E.DOC) SAIA-Burgess Electronics Ltd. Page 2-3 Technical data PCD2.H110 2.3 Function specific data Page 2-4 Number of systems 1 Counting range 0 ... 16 777 215 (24 bit) Counting frequency up to 100 kHz Data protection All data in this module is volatile (non-volatile registers in the PCD can be used) SAIA-Burgess Electronics Ltd. (2H1-20-E.DOC) 26/755 E2 PCD2.H110 Presentation 3. Presentation Equipped module Bus connector FPGA PROM in socket Oscillator Input filter Output transistors LEDs Terminals 9 8 7 6 5 4 3 2 1 0 A1 A0 E3 E2 E1 E0 Block diagram Input "A" E0 Input "B" E1 EnableC E2 EnableM E3 CCO A0 TCO A1 Oscillator FPGA (Field Programmable Gate Array) PCD1/2 bus User PROM Input filter and adjustment 24V to 5V Output amplifier 5 .. 32 VDC (Uext) 26/755 E2 (2H1-30-E.DOC) SAIA-Burgess Electronics Ltd. Page 3-1 Presentation PCD2.H110 Notes Page 3-2 SAIA-Burgess Electronics Ltd. (2H1-30-E.DOC) 26/755 E2 PCD2.H110 Terminals 4. Terminals, cable and meaning of the LED's Screw terminals This picture shows the text on the print. The I/O connector is standard from 0 ... 9 (from right to left) TCO CCO En"M" En"C" In"B" In"A" A1 A0 E3 E2 E1 E0 Terminal no. 9 8 7 6 5 4 3 2 1 0 See also the block diagrams in chapter 1.2. Inputs : Total 4 Terminal 0 = E0 : Terminal 1 = Terminal 2 = Terminal 3 = E1 : E2 : E3 : Input "A" for counting and as measuring input Input "B" for counting only Input "Enable C" by use as counting module Input "Enable M" by use as measuring module Outputs : Total 2 Terminal 4 = Terminal 5 = A0 : A1 : Output "CCO" for counter Output "TCO" for measuring functions + – + 24 VDC GND Supply: Terminal 8 = Terminal 9 = 26/755 E2 (2H1-40-E.DOC) SAIA-Burgess Electronics Ltd. Page 4-1 Terminals PCD2.H110 LED displays Total Page 4-2 6 LED 0: Status of input "A" LED 1: Status of input "B" LED 2: Status of input "EnableC" LED 3: Status of input "EnableM" LED 4: Status of outputs "CCO" LED 5: Status of output "TCO" SAIA-Burgess Electronics Ltd. (2H1-40-E.DOC) 26/755 E2 PCD2.H110 Brief introduction 5. Brief introduction E110 0 A400 16 32 48 PCD2 0V +24V 112 96 80 64 H110 9 8 7 6 5 4 3 2 1 0 A2 A0 E3 E2 E1 E0 "CCO" L -> disabled H -> enabled "EnableC" L -> down "B" H -> up "A" Minimum arrangement to operate a PCD2.H110 as up/down counter. The individual elements are: PCD2 (or PCD1) equipped with at least 1 PCD2.H110 (1 PCD2.F510/530) (1 PCD2.E110) (1 PCD2.A400) No-bounce impulse contact Supply device 24 VDC smoothed An incremental shaft encoder (24V) can be connected to the input terminals "A" and "B". Depending from the rotation direction, pulses are counted automatically "up" or "down". 26/755 E2 (2H1-50-E.DOC) SAIA-Burgess Electronics Ltd. Page 5-1 Brief introduction PCD2.H110 5.1 Getting started with programming in IL The following minimal program is suggested to commission a PCD2.H110 module as up/down counter in the easiest way. A proper user program should not contain wait loops. However, for the purposes of demonstrating the main instructions which drive a PCD2.H110, this example has been constructed with wait loops. In practice, a GRAFTEC or for the future a FUPLA structure should always be chosen for programs of this type. Example task: After power-up of PCD, the counter of the counting module is to set on 1000. Signals on input "A" should increment (+) the counter, signals on input "B" should decrement (-) the counter. The actual counter value is to show on the display module or in the debugger. Individual parameters and base address settings should be as in section 6.1 below. The user program can then take the following form: (Detailed and well structured programs are shown in the individual chapters and are also located on the diskette PCD9.H11E). The FBs (IL for PG4) are located on the diskette PCD9.H11E. To install the FBs on the PC follow the indications on the README.TXT on this diskette. The number of modules (1) and the address of the PCD2.H110 module (64) is to indicate in the file 2D2H110_B.MBA: NbrModules EQU 1 ; No. of H110 modules used (0...16) BA_1 ; Base address of module 1 EQU 64 This file (2D2H110_B.MBA) must be located in project directory of this example, i.e. the file is to copy manually from the diskette to the actual project directory. Page 5-2 SAIA-Burgess Electronics Ltd. (2H1-50-E.DOC) 26/755 E2 PCD2.H110 Brief introduction $include d2h110_b.equ $group h110 xob 16 ld r 999 1000 r 998 0 ; PCD register with ; start value for counter ; PCD register with value ; for compare register cfb init k 1 0 r 999 r 998 0 0 0 0 0 0 0 0 ; initialisation H110 ; par 1 module number ; par 2 count mode "x1" ; par 3 start value for counter ; par 4 value for compare register ; par 5 EnableC "static-normal" ; par 6 CCO "static-normal" ; par 7 input A "normal" ; par 8 input B "normal" ; par 9 not used for counter ; par 10 not used for counter ; par 11 not used for counter ; par 12 not used for counter cfb exec k 1 StartCt r 0 ; start counter ; module number ; command: start counter ; empty register ld exob ; -----------------------------------------cob 0 0 ; real user program r exec 1 RdCt 777 ; read counter ; module number ; command: read counter ; register 777 r 777 ; display on display module cfb k dsp $endgroup ecob 26/755 E2 (2H1-50-E.DOC) SAIA-Burgess Electronics Ltd. Page 5-3 Brief introduction PCD2.H110 The program is named "count.src" and is located in the project "h110". With 'Project' - 'Build' the program will be assembled, linked, downloaded in the PCD and put in 'Run'. The actual counter value will immediately be displayed on the display module. If no display module is disposable the value of the counter in the PCD register R 777 can be viewed in the Debugger: (Display Register 777 <Space> Refresh <CR>). Page 5-4 SAIA-Burgess Electronics Ltd. (2H1-50-E.DOC) 26/755 E2 PCD2.H110 Brief introduction 5.2 Getting started with programming in FUPLA in preparation 26/755 E2 (2H1-50-E.DOC) SAIA-Burgess Electronics Ltd. Page 5-5 Brief introduction PCD2.H110 Notes Page 5-6 SAIA-Burgess Electronics Ltd. (2H1-50-E.DOC) 26/755 E2 PCD2.H110 Programming 6. Programming The standard PG4 programming tools are used to create a user program to manage the PCD2.H.. counting and motion control modules. (To use the older programming tool "PG3", special FBs are available). Programming is either in IL (instruction list) with FBs (function blocks) or in FUPLA with FBoxes (in preparation). The FBs can be obtained on diskette using reference PCD9.H11E. Since motion control tasks always concern sequential processes, it is preferable if user programs are written in GRAFTEC, while individual steps and transitions can be edited either in IL with FBs or in FUPLA with FBoxes. User programs, however, can also be written purely in BLOCTEC or FUPLA. 26/755 E2 (2H1-60-E.DOC) SAIA-Burgess Electronics Ltd. Page 6-1 Programming PCD2.H110 6.1 Programming in IL with FBs 6.1.1 The IL package (Installation of the FBs) The ordering code of the diskette is PCD9.H11E. The diskette contains the following directories: • • • • • • APPSDIR FB FBOX PG3_FB PG4_FB Readme : contains all helps : contains the .SRC and .EQU files of the H110 : contains the FBoxes for the H110 : contains all files for the FBs of PG3 : contains examples and the .MBA file : contains general information The package is provided for the SAIA PG4 from version V2.0.70. For all other versions of PG4 consult the 'Readme' file. (The package also contains FBs for use with the older PG3, see 'Readme'). FBoxes for FUPLA are not yet available. Installation of package for PG4 The simplest method of installation is with the PG4 program 'Setup Extra Files': Insert the diskette PCD9.H11E into drive A: <Start> <Programs> <SAIA PG4> <Setup Extra Files>. The FBs and 'Help' file are installed on the hard disk in the 'PG4' directory. The following files are installed: D2H110_B.SRC D2H110_B.EQU FB source code FB definitions read-only file read-only file These 2 files are copied from the diskette and located in the PG4 directory ...\PG4\FB. FB_LIB.HLP D2H110_B.HLP FB library data FB help These 2 files are located in the directory A:\APPSDIR and are copied into the PG4 directory ...\PG4. The file D2H110_B.MBA (module base addresses) must be copied by hand from the diskette into the current project directory. Page 6-2 SAIA-Burgess Electronics Ltd. (2H1-60-E.DOC) 26/755 E2 PCD2.H110 Programming For the user the file 'D2H110_B.MBA' is important and is shown here: File: D2H110_b.mba (mba = module base address) ; ; This file can be modified by the user ; ; Base addresses defined by the user ; ----------------------------------$group H110 NbrModules EQU 1 ; No. of H110 modules used (0...16) ; ; Module base addresses (only the used modules must be defined) BA_1 BA_2 BA_3 BA_4 BA_5 BA_6 BA_7 BA_8 BA_9 BA_10 BA_11 BA_12 BA_13 BA_14 BA_15 BA_16 $endgroup EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU EQU 32 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base ;Base address address address address address address address address address address address address address address address address of of of of of of of of of of of of of of of of module module module module module module module module module module module module module module module module 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 The number of PCD2.H110 modules must be specified and the hardware base addresses of PCD2.H110 modules used should then be entered. Since the '.mba' file does not appear in Project Manager’s file list, a text editor (e.g. SEDIT32) must be used for modification. The modules are to be numbered successively beginning with 'BA_1'. For example, if three H110 modules are used in a project, 'BA_1', 'BA_2' and 'BA_3' should be used. The places in the PCD can be freely chosen. Example: NbrModules EQU 3 ; No. of H110 modules used (0...16) ; ; Module base addresses (only the used modules must be defined) BA_1 BA_2 BA_3 BA_4 BA_5 EQU EQU EQU EQU EQU 64 208 112 0 0 ;Base ;Base ;Base ;Base ;Base address address address address address of of of of of module module module module module 1 2 3 4 5 The base addresses of registers, flags and FBs are assigned automatically and can be viewed in the resource list under 'View' - 'Resource List'. 26/755 E2 (2H1-60-E.DOC) SAIA-Burgess Electronics Ltd. Page 6-3 Programming PCD2.H110 The project to be created should have project name "TEST-H11" and the actual user program module should be entitled "count-01.sfc". The files are arranged like this: C:\PG4 \FB \D2H110_b.equ \D2H110_b.src \... \FBOX \GALEP3 \PROJECTS \... \... \FUP_E \GRAF_E \TEST-H11 (Demo example PG4) (Demo example PG4) \D2H110_b.mba \count-01.sfc \... \D2H110_b.hlp The user program for the H110 part is structured as follows: $include D2H110_b.equ $group H110 XOB 16 PCD code ecob $endgroup If the program is written in GRAFTEC, the assembler directives "$include" and "$group" are placed in the first step (ST), normally the initial step (IST). "$endgroup" comes at the end of the last transition (TR). If everything has been correctly installed, the user program edited and all parameters defined, the program can be processed and downloaded to the PCD with the 'Project' - 'Build' command. Page 6-4 SAIA-Burgess Electronics Ltd. (2H1-60-E.DOC) 26/755 E2 PCD2.H110 Programming 6.1.2 The individual FBs The complete package consists of two main FBs with parameters: • INIT Initialisation FB with 12 parameters • EXEC Execution FB with 3 parameters The call of the FB 'INIT' is as follows (as example): CFB k r r init 1 0 100 101 0 0 0 0 0 0 0 0 ; ; ; ; ; ; ; ; ; ; ; ; par. 1: par. 2: par. 3: par. 4: par. 5: par. 6: par. 7: par. 8: par. 9: par. 10: par. 11: par. 12: Module number (k 1 - k 16) Counter configuration (0 - 4) Counter preset (0 - 16777215) Register preset (0 - 16777215) Enable counter config. (0 - 3) CCO configuration (0 - 3) Input A configuration (0 - 3) Input B configuration (0, 1) Measure configuration (0 - 5) Measure value (0 - 65535) Enable measure config (0 - 3) TCO configuration (0 - 3) The call of the FB 'EXEC' for some examples is as follow: CFB k r CFB k r exec 1 RdCt 555 ; par. 1: ; par. 2: ; par. 3: Module number (k 1 – k 16) Command: read counter Target register exec 1 ; par. 1: LdCtPres ; par. 2: 0 ; par. 3: Module number (k 1 - k 16 ) Command: load counter not used (empty register) Three parameters must always be defined, even if only two are required for a function. The third parameter can be defined as 'rNotUsed' or as any register. A list of all command follows on the next page. 26/755 E2 (2H1-60-E.DOC) SAIA-Burgess Electronics Ltd. Page 6-5 Programming PCD2.H110 Commands (functions) for FB 'Exec' (parameter 2): LdCtPres LdRegPres ModMsConf LdMsVal RdCt RdMsImp RdMsUnit StartCt StartMs StopMs RdIdent ; ; ; ; ; ; ; ; ; ; ; Load counter preset Load register preset Measure mode configuration Load measure value Read counter Read measure in impulsion Read measure in unit (Hz or ms) Start counter Start measure Stop measure Read module identification Readable elements for the user Element Cstart_x Address 8 + BA_x CCO_x 9 + BA_x UpDown_x EnableM_x TCO_x 10 + BA_x 12 + BA_x 13 + BA_x OverFlow_x 14 + BA_x EndMes_x 15 + BA_x fPar_Err fError_x rDiag '_x' see resourcelist see resource list see resource list Description If counter runs, element = H. ('EnableC' = H and 'Start-Counter' executed) Image of the output 'CCO' (in dynamic modes not visible, too short) If counter counts up, element = H. Image of the input 'EnableM' Image of the output 'TCO' (in dynamic modes not visible, too short) If overflow in measuring mode, element = H. If measuring is ended, element = H. The element is reset at the end of a read command (RdMsImp or RdMsUnit) H, if parameter in the FB 'Init' is outside the range H, by a division by zero in the conversion of a measuring result see chapter 7: Error handling and diagnosis. corresponds to the module number The effective addresses of the elements are shown in the resource list (for debug purposes). Page 6-6 SAIA-Burgess Electronics Ltd. (2H1-60-E.DOC) 26/755 E2 PCD2.H110 Programming 6.2 Programming in FUPLA with FBoxes in preparation 26/755 E2 (2H1-60-E.DOC) SAIA-Burgess Electronics Ltd. Page 6-7 Programming PCD2.H110 Notes Page 6-8 SAIA-Burgess Electronics Ltd. (2H1-60-E.DOC) 26/755 E2 PCD2.H110 Programming 6.3 Programming in GRAFTEC with FBoxes in preparation 26/755 E2 (2H1-60-E.DOC) SAIA-Burgess Electronics Ltd. Page 6-9 Programming PCD2.H110 Notes Page 6-10 SAIA-Burgess Electronics Ltd. (2H1-60-E.DOC) 26/755 E2 PCD2.H110 Error handling and diagnosis 7. Error handling and diagnosis 7.1 Definition errors checked by the assembler The following definition errors in file D2H110_b.MBA are checked during assembly: • If the number of modules (NbrModules) is lower than 1, no code is assembled and the following warning is displayed in the 'Make' window: "Remark : No H110 used (NbrModules = 0 in D2H110_B.MBA)" • If the number of modules (NbrModules) is greater than 16, no code is assembled and the following error message is displayed in the 'Make' window: "Error : more than 16 Modules H110 defined (NbrModules = 0...16)" • If an incorrect instruction code is used for FB 'Exec' (e.g. RdIdenti instead of RdIdent), the assembler reports an error: "Symbol not defined 'H110.RdIdenti'" (generating the printout 'H110' from $group h110) • If the definition $group H110 is absent, then for each instruction and each register/flag used in the program the assembler reports: "Symbol not defined" 26/755 E2 (2H1-70-E.DOC) SAIA-Burgess Electronics Ltd. Page 7-1 Error handling and diagnosis PCD2.H110 7.2 Error handling in run Wrong parameter In FB 'Exec' only the command code is checked. Parameter 1 (module no.) and parameter 3 (source/destination register) are not checked, to avoid making execution times longer. In FBs 'Init' and 'Home' the values of all parameters are checked to verify whether they fall within the permitted range (e.g. counter mode = 0, 1, 2, 3, 4). If a parameter is outside a range, it is set to the minimum value, the error flag 'fPar_Err' is set and diagnostic register 'rDiag' is loaded with the corresponding error code. Flag 'fPar_Err' is not reset inside the FB. This should take place in XOB 16 or in the initial step (IST). The error code is composed as follows: rDiag bit 31 . . . . . . . 24 23 . . . . . . . 16 15 . . . . . . . 8 7 . . . . . . . 0 \ Reserve / \ FB No. / \ Par. No. / \ Mod. No./ (Init = FB 1) (Exec = FB 2) Example : If the configuration of the CCO output (parameter 6) in FB 'Init' of module 2 is incorrect, register 'rDiag' is set to 00 01 06 02 hex. The diagnostic register is overwritten with each incorrect parameter and always contains the last error. It should therefore be evaluated as soon as flag 'fPar_Err' signals an error. The absolute addresses of 'rDiag' and 'fPar_Err' can be viewed in file 'project.MAP'. This can be useful during commissioning with the debugger to locate an error : - Run until flag 'fPar_Err' = H - Display register 'rDiag' hex - Delete flag 'fPar_Err' Page 7-2 SAIA-Burgess Electronics Ltd. (2H1-70-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks 8. PCD2.H110 for counting and motion control tasks 8.1 Block diagram of counter Config (CTR2) A/B - Mode A Input A B Input B UpDown Count Preset Counter StartC COUNTER 24 bit Register CCO Output CCO EnableC Input EnableC CStart Compare Config (CTR0) Enable - CCO UpDown PCD1/2 bus Count Mode Latch Counter Value CCO 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-1 Counting and motion control tasks PCD2.H110 8.2 Description of counter The core of the circuit is a 24 bit counter. This counter is loaded from the preset counter. The preset counter itself is loaded by the user program from a PCD register as three 8-bit values. The 'StartCt' command loads the preset counter value into the counter and starts it. The register is loaded in a similar way. The user program loads the 24-bit value from a PCD register into the H110's register as three 8-bit values. When inputs 'A' and 'B', the 'CCO' direct counter output and the 'EnableC' input have all been configured (this is described in a later section), and if register and counter match, the 'CCO' can be switched according to its configuration so that the process and the user program can be controlled. The status of 'CCO' (CCO_x), 'EnableC' (CStart_x) and 'UpDown' (UpDown_x) can be read by the user program. Page 8-2 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks 8.3 Configuration of inputs 'EnableC', 'CCO', 'A', 'B' and the count mode 8.3.1 Configuration of the 'EnableC' input Standard: "static / normal" Init parameter 5 = 0 While the 'EnableC' input is 'H', counting is allowed. While the 'EnableC' input is 'L', counting is stopped. Additional possibilities: "static / inverted" Init parameter 5 = 1 While the 'EnableC' input is 'L', counting is allowed. While the 'EnableC' input is 'H', counting is stopped. "dynamic / normal" Init parameter 5 = 2 The 'EnableC' input is 'L'. The first positive edge (H) switches 'EnableC' on, the next switches it off again, etc. "dynamic / inverted" Init parameter 5 = 3 The 'EnableC' input is 'H'. The first negative edge (L) switches 'EnableC' on, the next switches it off again, etc. Standard Mode static/normal dynamic/normal static/inverted dynamic/inverted Enable Counter 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-3 Counting and motion control tasks 8.3.2 PCD2.H110 Configuration of the 'CCO' output "static / normal" Init parameter 6 = 0 The 'CCO' is activated by the user program and becomes or remains L. If the register and counter are equal, the 'CCO' is switched 'H' and remains 'H' until a new activate command is received from the user program. "static / inverted" Init parameter 6 = 1 The 'CCO' is switched on by the user program and becomes 'H'. If the register and counter are equal, the 'CCO' is switched 'L' and remains 'L' until a new command to switch on is received from the user program. "dynamic / normal" Init parameter 6 =2 The 'CCO' is activated by the user program and becomes or remains 'L'. If the register and counter are equal, the 'CCO' becomes 'H' *) for 25 .. 100 µs. At each subsequent agreement of register and counter, the behaviour of the 'CCO' is repeated, without any new instructions from the user program. "dynamic / inverted" Init parameter 6 = 3 The 'CCO' is switched on by the user program and becomes 'H. If the register and counter are equal, the 'CCO' becomes 'L' *) for 25 .. 100 µs. At each subsequent agreement of register and counter, the behaviour of the 'CCO' is repeated, without any new instructions from the user program. Mode static/inverted static/normal dynamic/inverted dynamic/normal Register Counter CCO Set CCO Set CCO *) Page 8-4 *) *) Evaluation of this short pulse is via the PCD1/2 interrupt inputs and XOB 20 or 25. SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks 8.3.3 The configuration of the inputs 'A' and 'B' Inputs 'A' and 'B' can be inverted individually. Input 'A' Input 'A' Input 'A' Input 'A' Counter normal inverted normal inverted Input 'B' Input 'B' Counter normal inverted Measure normal normal inverted inverted Parameter 7 0 1 2 3 - Parameter 8 0 1 If a module is used as counter, inversion of a single input ('A' or 'B') results in the physical reversal of a drive's rotational direction. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-5 Counting and motion control tasks 8.3.4 PCD2.H110 Configuration of count mode Mode 'x1' Init parameter 2 = 0 or 1 Use for simple counting tasks (without incremental shaft encoder): • The signals to be counted are at input 'A' • If input 'B' is 'L', count direction is downwards, if parameter 8 = 0. If input 'B' is 'H', count direction is upwards, if parameter 8 = 0. If parameter 8 = 1, counting direction is inverted. 16'777'215 0 1 down up Counting range is 0 ... 16'777'215 (0 ... 224 - 1) → → If up-counting from 0 If down-counting from 0 0, 1, 2 ... 0, 16'777'215, 16'777'214 ... There are no negative values and no overflow Mode 'x1' Init parameter 2 = 0 or 1 Input A Input B Enable Counter x x+1 x x-1 Only the rising edge of signal A is evaluated. Signal B in quadrature (phase shifted by 90°) defines the count direction. Important: Page 8-6 In mode 'x1' incremental shaft encoders should not be used because counting may be incorrect in some situations. SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks If 2-phase incremental shaft encoders are used, the following modes are available: Mode 'x2' Init parameter 2 = 2 The rising and falling edges of signal 'A' are evaluated. Signal 'B' in quadrature defines the count direction. Input A Input B Enable Counter x x+1 x+2 x+3 x+2 Mode x4 x+1 x x-1 x-2 Init parameter 2 = 4 The rising and falling edges of both signals 'A' and 'B' are evaluated. Signal 'B' in quadrature again defines count direction. Input A Input B Enable Counter x x+1 x+2 x+3 x+4 x+5 x+4 x+3 x+2 x+1 x x-1 x-2 x-3 x-4 A mode 'x3' can also be selected (Init parameter 2 = 3), but has no practical uses and is not described here. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-7 Counting and motion control tasks PCD2.H110 8.4 Programmable counter functions • • • • • • • • • • Definition of 'EnableC' and 'CCO'. Definition of counting mode. Definitions of inputs 'A' and 'B'. Counter initialization, i.e. adoption of definitions for EnableC', 'CCO' and counting mode. Loading counter values into a PCD register. Transfer of counter values from a PCD register into preset counter. Transfer of value from preset counter into counter. Loading the preset value into a PCD register Transfer of preset value from PCD register into preset register Starting the counter and activating 'CCO'. • • • • Reading counter value. Reading status of 'CCO' output (H = on, L = off) Reading status of 'EnableC' input (H = on, L = off) Reading count direction (H = up, L = down) Programming is explained on the following pages, using a few examples. Instead of several pages of description, the programming principle is illustrated using an unstructured example. This is a functional program which can, for example, be used to test a PCD2.H110. Since counting tasks always have a sequential program flow: • define module characteristics and counting task • await end of counting • evaluate counting User programs should be consistently programmed in GRAFTEC. The 3 typical examples which follow the demonstration of principle have therefore been edited in GRAFTEC. The programs were written using "PG4" (GRAFTEC and IL). Page 8-8 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks 8.5 Programming principle A simple example demonstrates the methodology for programming the counter of the PCD2.H110 module. Task: The counter should be loaded with a start value of 500 and the preset register should be loaded with 900. The 'CCO' output should be defined as "static-normal" and the 'EnableC' input as "static-inverted". The count mode should be configured as 'x1' and the inputs 'A' and 'B' as "normal". After applying pulses to input 'A', the counter should count up to the value in the preset register (900). When the value is reached a digital PCD output should be complemented and the counter should be reloaded with its start value (500), and so on. The circuit can be seen as a frequency divider. The program's name is "prinzip.src" and it is located in project "D2-H110". The file .MBA should also be copied into this project and the number of H110 modules (1) and the base address (64) should be indicated. Arrangement for the use of the PCD2.H110 as counter in the defined example. E110 0 16 32 48 PCD2.M120 0V 112 +24V 96 80 64 H110 A4xx 9 8 7 6 5 4 3 2 1 0 A2 A0 E3 E2 E1 E0 "EnableC" +24V für "up" "B" "A" The elements are: PCD1/2.M1x0 at least equipped with 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. 1 PCD2.H110 1 PCD2.A4xx 1 PCD2.F510/530 Page 8-9 Counting and motion control tasks ; ; ; ; PCD2.H110 ********************************************************* Basic user program for PCD2.H110 module as counter: prinzip.src ********************************************************* $include d2h110_b.equ $group h110 xob 16 ld r 999 500 r 998 900 r 0 0 ; PCD register with ; start value for counter ; PCD register with ; value for compare register ; scratch register ; empty cfb init k 1 1 r 999 r 998 1 0 0 0 0 0 0 0 ; initialisation H110 ; par 1 module number ; par 2 count mode 'x1' ; par 3 start value for counter ; par 4 value for compare register ; par 5 EnableC "static-inverted" ; par 6 CCO "static-normal" ; par 7 input A "normal" ; par 8 input B "normal" ; par 9 not used for counter ; par 10 not used for counter ; par 11 not used for counter ; par 12 not used for counter cfb exec k 1 StartCt r 0 ; start counter, set CCO ; module number ; command: start counter ; empty register ld ld exob ; --------------------------------------------------------cob 0 0 ; real user program cfb exec k 1 RdCt r 777 ; read Counter ; module number ; command: read counter ; read value -> R 777 dsp r 777 ; display on display module sth cpb cco_1 h 25 ; polling CCO ; if CCO = H, call PB 25 ecob ; --------------------------------------------------------- Page 8-10 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks pb 25 ; PB for new-start of counter com o 100 ; inverts on each R = C cfb exec k 1 LdCtPres r 999 ; load counter with preset value ; module number ; command: load preset value ; with value from register 999 cfb exec k 1 StartCt r 0 ; start counter, set CCO ; module number ; command: start counter ; empty register epb $endgroup ; --------------------------------------------------------- Description of program The file 'd2h110_b.equ' should be included at the beginning of the user program. The program between the directives '$group' and '$endgroup' is declared as code for PCD2.H110. In the cold start routine 'XOB 16' a PCD register is loaded with the start value for the counter, e.g. R 999. If the start value is = 0, the register is loaded with 0. The next PCD register is loaded with the compare value of the H110, e.g. R 998. This register must be defined even if the value is not to be used in the program. An empty scratch register can also be prepared here, e.g. R 0. The real configuration of the PCD2.H110 is done by calling the FB 'Init'. The call has 12 parameters. The meaning of these parameters is shown in the program example and in Appendix A of this manual. Parameter 5: 'EnableC' should be defined as "static-inverted" and parameter 6: 'CCO' should be defined as "static-normal". If counter and preset register are equal, the 'CCO' output goes = H. After execution of the FB 'Init' the counter is started by the FB 'Exec' with parameter 2 as 'StartCt'. The 'CCO' will also be activated. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-11 Counting and motion control tasks PCD2.H110 In the COB the counter value is read and transmitted to the display module and the 'CCO' is continuously polled. If CCO = H, i.e. "counter = register" PB 25 is called, a digital PCD output is complemented and the counter is loaded with the intial value and started again. The program can now be processed with 'Project' - 'Build', loaded to the PCD and put in 'Run'. The function of the system can be followed on the display and on the activated PCD output. It would also be imaginable to process the CCO dynamically, i.e. the CCO would be = H for approx. 100 µs on each "counter = register". This impulsion could be brought to the interrupt input 'INB1'. On each pulse (counter = register) the XOB 20 would be called. In the XOB 20 the counter could be loaded and restarted again. This dynamic method should be used only be specialists, because conflicts between H110 FBs used in the COB and in XOB 20 may occur. Other (more realistic) applications are presented in the following examples. Page 8-12 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks 8.6 Application example no. 1: Counter in GRAFTEC After switching on the "Start" input, the counter should be loaded at 0 and the register should be loaded at the value from the 2-digit BCD switch which has been wired to inputs 16 to 23. The CCO output should be defined so that, at the start of each new count, it is switched H. When the counter reaches the preset register value, the CCO should switch to L and remain L until a new count is loaded. Counter status should be displayed in the display window at every point in the program. It should also be possible to see the course of the program online, with register and counter values, on the programming unit screen. The user program is edited in GRAFTEC. Within the "D2-H110" project, the program is entitled "COUNT-01.SFC". The finished program will resemble the following: 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-13 Counting and motion control tasks PCD2.H110 Program code in "count-01.sfc" (To obtain this representation, the file "count-01.sfc" should be renamed "count-01.src"). SB 0 ;------------------------------IST 10 ;initialisation O 50 $include d2h110_b.equ $group h110 ld ld ld cfb EST r 999 0 r 998 0 r 0 0 ; start value for counter init k 1 1 r 999 r 999 1 1 0 0 0 0 0 0 ; initialisation H110 ; par 1 module number ; par 2 count mode 'x1' ; par 3 start value for counter ; par 4 value for preset register ; par 5 enable "static-inverted" ; par 6 CCO "static-inverted" ; par 7 input A "normal" ; par 8 input B "normal" ; par 9 not used for counter ; par 10 not used for counter ; par 11 not used for counter ; par 12 not used for counter ; value for compare register ; empty scratch register ; 10 ;------------------------------ST 11 I 50 I 53 ; continue task ? O 51 ; start condition: input "start" = H ? EST Page 8-14 ; 11 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks ;------------------------------ST 12 ; definition of counting task I 51 ; start condition: input "start" = H ? O 52 ; count ended ? digir 2 i 16 r 998 cfb exec ; load preset register k 1 ; module number LdRegPres; command: load preset register r 998 ; register with load value cfb exec k 1 LdCtPres r 998 ; load counter ; module number ; command: load counter ; register with load value cfb exec k 1 StartCt r 0 ; start counters, set CCO ; module number ; command: start counter ; empty register EST ; read BCD value ; 12 ;------------------------------ST 13 ; evaluation of count I 52 ; count ended ? O 53 ; further program sequence ? com o 101 EST ; process ; 13 ;------------------------------TR 50 I 10 ; initialisation O 11 ;; SFUP __TR00050 ETR ; 50 ;------------------------------TR 51 ; start condition: input "start" = H ? I 11 O 12 ; definition of counting task cfb dsp sth ETR 26/755 E2 (2H1-80-E.DOC) exec k 1 RdCt r 777 r 777 i 0 ; read counter ; module number ; command: read counter ; read value in R 777 ; display on display module ; PCD input "start" ; 51 SAIA-Burgess Electronics Ltd. Page 8-15 Counting and motion control tasks PCD2.H110 ;------------------------------TR 52 ; count ended ? I 12 ; definition of counting task O 13 ; evaluation of count cfb dsp stl exec k 1 RdCt r 777 r 777 cco_1 ETR ; read counter ; module number ; command: read counter ; read value in R 777 ; display on display module ; polling CCO ; 52 ;------------------------------TR 53 ; further program sequence ? I 13 ; evaluation of count O 11 cfb dsp stl exec k 1 RdCt r 777 r 777 i 0 ; read counter ; module number ; command: read counter ; read value in R 777 ; display on display module ; PCD input "Start" $endgroup Page 8-16 ETR ; 53 ESB ; 0 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks Explanatory notes Knowledge of the PG4 in general and of GRAFTEC in particular is required. A call to sequential block SB 0 from a COB is generated automatically. The course of the GRAFTEC program can be viewed online. Initialization of the H110 module is done in IST 10. This IST is only processed when the SB is called for the first time, as with XOB 16. It is logical to carry out initialization of the H110 module in the IST belonging to the SB which handles that module, so that all the program for the module is in one place. XOB 16 is preferred for carrying out initializations which apply to the entire PCD. Transition TR 50 is empty, but it could be edited in FUPLA so that the online values of the counter stand and the BCD preset value can be viewed. FUPLA's instruction list code is generated automatically by the PG4 and should not be modified. In ST 12 the actual BCD value is loaded in the preset register, the counter is reset (set to zero), then the counter is started and with the same command the CCO is activated. TR 52 queries whether counting is complete so that further program sequences can be triggered. The process itself is directly controlled from hardware with the CCO output. Before polling the switching condition (stl cco_1), the counter contents are read and displayed. This also applies to TR 51 and TR 53. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-17 Counting and motion control tasks PCD2.H110 8.7 Application example no. 2: Motion control with incremental shaft encoder The carriage of a working model (DC motor, spindle, sliding carriage, incremental shaft encoder and appropriate drive electronics) is to travel from a start position to another position and, after a pause, back to the start position. It should run at maximum acceleration to a preset speed, and continue at reducing speed to the destination position. Some details of the working model (V-PCX 10): DC motor with gears: approx. 1200 rpm. at 24 VDC Incremental shaft encoder: 500 pulses/rev., 2-phase, in quadrature Spindle gradient 1.0 mm Inputs for electronics: (V-PCX 11) forward/backward (F/B): H = forward; L = backward slow/fast (S/F): L = slow; H = fast on/off : L = motor off, short-circuited H = Motor on, accordingly forward/backward, slow/fast Outputs for electronics: Motor (note polarity) Supply for electronics: 24 VDC smoothed Arrangement and wiring of devices: IN-A IN-B O 97 S/F O 98 F/B CCO H/L Drive electronics Shaft encoder DC motor Carriage Page 8-18 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks Motion: Start "B" "C" Forward Backward "A" "D" 0 cm 10 mm 90 mm 100 mm Path 0 10'000 90'000 100'000 Pulses (mode x2) The GRAFTEC structure looks like this: 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-19 Counting and motion control tasks PCD2.H110 Program code for "move-01.sfc" (To obtain this representation, the file "move-01.sfc" should be renamed "move-01.src"). SB 0 ;------------------------------IST 10 ; initialisation O 50 $include d2h110_b.equ $group h110 ld ld ld ld ld cfb r 999 0 r 998 0 r 0 0 r 995 16000000 r 996 777215 ; start value for counter init k 1 2 r 999 r 998 1 1 0 0 0 0 0 0 ; initialisation H110 ; par 1 module number ; par 2 count mode "x2" ; par 3 start value for counter ; par 4 value for preset register ; par 5 enable "static-inverted" ; par 6 CCO "static-inverted" ; par 7 input A "normal" ; par 8 input B "normal" ; par 9 not used for counter ; par 10 not used for counter ; par 11 not used for counter ; par 12 not used for counter EST ; value for preset register ; empty scratch register ; scratch register for negative values ; scratch register for negative value ; 10 ;------------------------------ST 11 I 50 I 57 ; pause over? O 51 ; start ok ? EST ; 11 ;------------------------------ST 12 ; motor fast --> pos "B" I 51 ; start ok ? O 52 ; switching point --> reached ? ld cfb cfb set set EST Page 8-20 r 998 ; load value for "B" 8640 exec ; load preset register k 1 ; module number LdRegPres; command: load preset register r 998 ; PCD register with compare value exec ; start counter, set CCO k 1 ; module number StartCt ; command: start counter r 0 ; empty register o 97 o 98 ; motor "fast" ; motor "forward" ; 12 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks ;------------------------------ST 13 ; motor slow --> pos "C" I 52 ; switching point --> reached ? O 53 ; final position --> reached ? ld r 998 9600 cfb exec ; load preset register k 1 ; module number LdRegPres; command: load preset register r 998 ; PCD register with compare value cfb exec k 1 StartCt r 0 ; start counters, set CCO ; module number ; command: start counter ; empty register res set o 97 o 98 ; motor "slow" ; motor "forward" EST ; load value for "C" ;13 ;------------------------------ST 14 ; load pause I 53 ; final position --> reached ? O 54 ; pause over ? ld t 0 50 EST ; pause ; 5 seconds ; 14 ;------------------------------ST 15 ; motor fast <-- pos "D" I 54 ; pause over ? O 55 ; switching point <-- reached ? ld r 998 960 cfb exec ; load preset register k 1 ; module number LdRegPres; command: load preset register r 998 ; PCD register with compare value cfb exec k 1 StartCt r 0 ; start counters, set CCO ; module number ; command: start counter ; empty register set res o 97 o 98 ; motor "fast ; motor "backward" EST 26/755 E2 (2H1-80-E.DOC) ; load value for "C" ; 15 SAIA-Burgess Electronics Ltd. Page 8-21 Counting and motion control tasks PCD2.H110 ;------------------------------ST 16 ; motor slow <-- pos "A" I 55 ; switching point <-- reached ? O 56 ; final position <-- reached ? ld r 998 0 cfb exec ; load preset register k 1 ; module number LdRegPres; command: load preset register r 998 ; PCD register with compare value cfb exec k 1 StartCt r 0 ; start counters, set CCO ; module number ; command: start counter ; empty register res res o 97 o 98 ; motor "slow" ; motor "backward" EST ; load value for "A" ; 16 ;------------------------------ST 17 ; load pause I 56 ; final position <-- reached ? O 57 ; pause over ? ld t 0 50 EST ; pause ; 5 seconds ; 17 ;------------------------------TR 50 I 10 ; initialisation O 11 ETR ; 50 ;------------------------------TR 51 ; start ok ? I 11 O 12 ; motor fast --> pos "B" cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 cmp r r n r r r r r r ; ; ; ; ; ; ; ; ; jr sub sub next: ¦ ¦ test if counter value ¦ ¦ below zero ¦ ¦ if yes display ¦ ¦ negative value ¦ dsp r 777 ; display on display module sth i 0 ; PCD input "start" ETR Page 8-22 777 995 next 777 995 777 777 996 777 ; 51 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks ;------------------------------TR 52 ; switching point --> reached ? I 12 ; motor fast --> pos "B" O 13 ; motor slow --> pos "C" cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 cmp r r n r r r r r r ; ; ; ; ; ; ; ; ; jr sub sub next: dsp stl 777 995 next 777 995 777 777 996 777 r 777 cco_1 ETR ¦ ¦ test if counter value ¦ ¦ below zero ¦ ¦ if yes display ¦ ¦ negative value ¦ ; display on display module ; polling CCO ; 52 ;------------------------------TR 53 ; final position --> reached ? I 13 ; motor slow --> pos "C" O 14 ; load pause cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 dsp r 777 ; display on display module stl cco_1 ETR ; polling CCO ; 53 ;------------------------------TR 54 ; Pause over ? I 14 ; load pause O 15 ; Motor fast <-- pos "D" cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 dsp r 777 ; disply on display module stl t 0 ; polling timer ETR 26/755 E2 (2H1-80-E.DOC) ; 54 SAIA-Burgess Electronics Ltd. Page 8-23 Counting and motion control tasks PCD2.H110 ;------------------------------TR 55 ; switching point <-- reached ? I 15 ; motor fast <-- pos "D" O 16 ; motor slow <-- pos "A" cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 dsp stl r 777 cco_1 ; display on display module ; polling CCO ETR ; 55 ;------------------------------TR 56 ; final position <-- reached ? I 16 ; motor slow <-- pos "A" O 17 ; load pause cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 cmp r r n r r r r r r ; ; ; ; ; ; ; ; ; jr sub sub next: dsp stl 777 995 next 777 995 777 777 996 777 r 777 cco_1 ETR ¦ ¦ test if counter value ¦ ¦ below zero ¦ ¦ if yes display ¦ ¦ negative value ¦ ; display on display module ; polling CCO ; 56 ;------------------------------TR 57 ; pause over ? I 17 ; load pause O 11 cfb exec k 1 RdCt r 777 ; read counter ; module number ; command: read counter ; read value in R 777 cmp r r n r r r r r r ; ; ; ; ; ; ; ; ; jr sub sub next: dsp stl 777 995 next 777 995 777 777 996 777 r 777 t 0 ¦ ¦ test if counter value ¦ ¦ below zero ¦ ¦ if yes display ¦ ¦ negative value ¦ ; display on display module ; polling timer $endgroup Page 8-24 ETR ; 57 ESB ; 0 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks Explanatory notes Knowledge of the PG4 in general and of GRAFTEC in particular is required. A call to sequential block SB 0 from a COB is generated automatically. The course of the GRAFTEC program can be viewed online. Initialization of the H110 module is done in IST 10. This IST is only processed when the SB is called for the first time, as with XOB 16. It is logical to carry out initialization of the H110 module in the IST belonging to the SB which handles that module, so that all the program for the module is in one place. XOB 16 is preferred for carrying out initializations which apply to the entire PCD. The counter is only loaded with zero on start-up, i.e. in the IST, after which it is not accessed by the program. All signals coming from the incremental shaft encoder are then counted. The counter therefore holds the exact carriage position, i.e. even overruns of the end position or manual rotation of the spindle are captured accurately. Software querying of CCO in TR 52, 53, 55 and 56 is only used for GRAFTEC switching. Control of the process itself, in this case control of the carriage, is done directly by the CCO output. The routine "Test if counter value below zero" in most TRs is only used to maintain the display and prevent the error flag being set, since only 6 digits can be displayed. If the counter value falls below zero, this routine subtracts 16,000,000 (R 999) before it is displayed, which makes the value displayable. The zero position could also, for example, be defined at 1000. This would be a way of getting round the problem of values "below zero". The reader may notice that this example has not quite been properly programmed. When switching from "fast" to "slow" the motor is briefly switched off or short-circuited by the drive, since the CCO output is switched when positions "B" or "D" are reached and is only switched on again after the new value has been loaded. Strictly speaking, this switching ought to be bypassed with a normal output. However, this example is just to illustrate the principle. Section 9.1.5 shows how frequency can also be measured parallel to the motion control explained above. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-25 Counting and motion control tasks PCD2.H110 8.8 Application example no. 3: Measurement with counting While a photoelectric barrier is covered by items being transported on a conveyor belt, pulses output in proportion to the speed of the conveyor are counted, thus measuring the size of items for sorting purposes. This simple method has been successfully used in the south of France to sort melons and apricots. The task is therefore to count signals during a certain situation, e.g. photoelectric barrier covered, with the count being controlled directly by the photoelectric barrier using an input on the counting module, not via a digital PCD input. For this purpose, the measurement pulses are carried to input "A" and the photoelectric barrier to the "Enable" input of the counting module, which already largely solves the problem. PCD2.H110 Measuring frequency Input "A" Input "Enable" Photoelectric barrier The GRAFTEC structure looks like this: Page 8-26 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks Program code for "mess-01.sfc" (To obtain this representation, the file "mess-01.sfc" should be renamed "mess-01.src"). SB 0 ;------------------------------IST 10 ; initialisation O 50 $include d2h110_b.equ $group h110 ld ld ld cfb r 999 0 r 998 0 r 0 0 ; start value for counter init k 1 0 r 999 r 998 1 0 0 1 0 0 0 0 ; initialisation H110 ; par 1 module number ; par 2 count mode 'x1' ; par 3 start value for counter ; par 4 value for register (not used.) ; par 5 enable "static-inverted" ; par 6 CCO (not used) ; par 7 input A "normal" ; par 8 input B "inverted" ; par 9 not used for counter ; par 10 not used for counter ; par 11 not used for counter ; par 12 not used for counter EST ; value for preset register ; empty scratch register ; 10 ;------------------------------ST 11 ; set counter = 0 I 50 I 53 O 51 ; enable = H ? cfb exec k 1 LdCtPres r 998 ; load counters (with 0) ; module number ; command: load counter ; PCD register with load value cfb exec k 1 StartCt r 0 ; start counter ; module number ; command: start counter ; empty register EST ; 11 ;------------------------------ST 12 I 51 ; enable = H ? O 52 ; enable = L ? EST ; 12 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-27 Counting and motion control tasks PCD2.H110 ;------------------------------ST 13 ; counter -> PCD register I 52 ; enable = L ? O 53 cfb exec k 1 RdCt r 777 putx r 777 r 2000 k 1000 ini EST ; read counter (for result) ; module number ; command: read counter ; read value in R 777 ; 13 ;------------------------------TR 50 I 10 ; initialisation O 11 ; set counter = 0 ETR ; 50 ;------------------------------TR 51 ; enable = H ? I 11 ; set counter = 0 O 12 cfb exec k 1 RdCt r 777 ; read counter (for display) ; module number ; command: read counter ; read value in R 777 dsp r 777 ; display on display module sth Cstart_1 ; polling 'EnableC' ETR ; 51 ;------------------------------TR 52 ; enable = L ? I 12 O 13 ; counter -> PCD register cfb exec k 1 RdCt r 777 ; read counter (for display) ; module number ; command: read counter ; read value in R 777 dsp r 777 ; display on display module stl Cstart_1 ; polling 'EnableC' ETR ; 52 ;------------------------------TR 53 I 13 ; counter -> PCD register O 11 ; set counter = 0 $endgroup Page 8-28 ETR ; 53 ESB ; 0 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Counting and motion control tasks Explanatory notes Knowledge of the PG4 in general and of GRAFTEC in particular is required. A call to sequential block SB 0 from a COB is generated automatically. The course of the GRAFTEC program can be viewed online. Regarding definition of 'EnableC' and the 'CCO': The photoelectric barrier used in the example supplies a 'H' signal to the 'EnableC' input when it is not covered. The signal should be defined as "static" and "inverted". Count mode is "up/down", i.e. mode 'x1'. With code '0', +24V must be applied to input 'B' for "up" counting. With code '1', input 'B' is inverted. It does not need +24V at the input 'B' terminal for "up" counting. The program is controlled by software polling of the 'EnableC' input with "sth or stl Cstart_1". The counter is controlled directly using the "EnableC" input. In ST 13 evaluation of the result is indicated. Each time the photoelectric barrier is released, the counter value is stored in consecutive PCD registers (from R 2000). Instead of a photoelectric barrier, a bounce-free switch could also be used. 26/755 E2 (2H1-80-E.DOC) SAIA-Burgess Electronics Ltd. Page 8-29 Counting and motion control tasks PCD2.H110 Notes Page 8-30 SAIA-Burgess Electronics Ltd. (2H1-80-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9. PCD2.H110 for measuring tasks 9.1 Frequency measurement 9.1.1 Block diagram Configuration (CTR1) EnableM Input EnableM Configuration (CTR2) 1 kHz m.w.register Counter of measuring wind. StartT EnableT Steuerung der Messung TCO FlagT A Measuring counter 16 Bit Input A PCD1/2 bus TCO Output TCO Overflow Latch measurement 26/755 E2 (2H1-90-E.DOC) SAIA-Burgess Electronics Ltd. Page 9-1 Measuring tasks PCD2.H110 9.1.2 Description of frequency measurement The frequency measurement range is from 500 Hz to 100 kHz. Frequency measurement can be done in parallel with counting. It uses 2 counters of 16 bits each: • One counter from this pair, the counter of measuring window, has a fixed clock of 1 kHz. This provides the time base in 1 ms steps for the programmable measuring window. • The other counter, the measuring counter, counts the signals arriving at input 'A' during the time when the measuring window is open. If the measuring window has been defined as 1s (1000 ms) the result appears in the measuring counter directly in Hz or pulses per second. Frequency measurement runs automatically, i.e. the time defined for the time window is measured, then the signal 'TCO' is activated, the measured value is latched and a new measurement is done, etc. The length of the signal 'TCO' the latch and the reset of the counter takes 1.6 µs. Input A Measuring Meas. window Meas. counter TCO output 1.6 us Page 9-2 1.6 us SAIA-Burgess Electronics Ltd. 1.6 us (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9.1.3 Configuration of frequency measurement The configuration takes place in FB 'Init'. For continuous frequency measurement, parameter 9 should be defined as '5' (frequencyautomatic). A "single shot" frequency measurement is possible but not very useful. To obtain this mode, parameter 9 should be defined as '4'. In this case only one measuring window is measured. Then the whole procedure has to be repeated for a new measurement. Measuring range and time window The measuring range is between 0 and 65 535 (16 bit). To obtain a resolution of 1‰ at least 1000 signals must be captured per measurement. The measurement window’s open time depends on the frequency to be measured. To measure 100 kHz a minimum measurement time of 10 ms should be provided; to measure 500 Hz a measurement time of at least 2s is required. If the frequency to be measured is even smaller, measurement time increases in length, which is not acceptable for every application. For frequencies below approx. 100 Hz, sufficient accuracy within an acceptable measurement time may call for period length measurement as described below, rather than frequency measurement. Parameter 11 defines the behaviour of input 'EnableM', parameter 12 the behaviour of output 'TCO'. =9 = 10 = 11 = 12 Configuration measuring mode Load value for measuring Configuration of input EnableM integer 0–5 integer 0 – 65535 integer 0–3 Configuration of output TCO integer 0–3 4 = frequency-manual 5 = frequency-autom. length of time window for frequency measurement 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted The complete table is shown in the appendix, page A-2. 26/755 E2 (2H1-90-E.DOC) SAIA-Burgess Electronics Ltd. Page 9-3 Measuring tasks PCD2.H110 9.1.4 Programming principle Task: An impulse string is applied to input 'A'. A continuous (automatic) frequency measurement with a time window of 1s (1000 ms) is to be realized. The result is to be shown as counting units (Hz) on the display module. ; *********************************************** ; Basic user program for the PCD2.H110 module ; for frequency measurement: frequ-01.src ; *********************************************** ; $include d2h110_b.equ $group h110 xob 16 ld r 0 0 ; empty scratch register cfb init k 1 0 r 0 r 0 0 0 0 0 5 1000 0 2 ; initialisation H110 ; par 1 module number ; par 2 not used for measurement ; par 3 not used for measurement ; par 4 not used for measurement ; par 5 not used for measurement ; par 6 not used for measurement ; par 7 input A "normal" ; par 8 not used ; par 9 mode: "frequency-auto." ; par 10 length time window in ms ; par 11 EnableM: "static-normal" ; par 12 TCO: "dynamic-normal" cfb exec k 1 StartMs r 0 ; start measure ; module number ; command: start measure ; empty register exob ; --------------------------------------------------------cob wait: 0 0 sth jr EndMes_1 ; measure ended ? l wait ; if not, wait cfb exec k 1 RdMsImp r 777 ; read measure result ; module number ; command: read measure in impulsion ; read value in R 777 dsp r 777 ; display on display module ;(wait:) ecob ; --------------------------------------------------------xob com exob 20 o 101 ; interrupt "INB1" ; inverts after each measure $endgroup Page 9-4 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks Program description In hardware, a signal transmitter supplying the signals to be measured, e.g. a pulse generator, should be wired to input 'A'. Input 'B' remains open. The 'EnableC' input is not used at all for measurement and remains open. The 'EnableM' input ought really to receive +24V, but has been inverted during configuration and therefore remains open. *) The 'TCO' output is wired to the PCD’s interrupt input 'INB1'. At the end of each measurement, XOB 20 is called which, for this example, inverts the PCD output O 101. This is so that program function can be viewed better. In the example, this output is inverted every second. The time base defined for this example is 1000, for a time window of 1000 ms = 1s. See also "Measuring range and time window". The COB waits until the end of each measurement before reading the result from the measuring counter, where it can be displayed by the debugger or on a display module in integer format. The units of measurement are controlled by the time base definition, in this example it is in Hertz. With 'RdMsUnit' instead of 'RdMsImp' the result is always converted into Hertz and can be viewed in the PCD register in floating point format. With the command 'StopMs', a running measure can be broken off. The result is not valid. A new measure can be started again with 'StartMs'. *) 26/755 E2 (2H1-90-E.DOC) After a deactivate of 'EnableM' the result is not valid. A new measure can be started only with the command 'StartMs' SAIA-Burgess Electronics Ltd. Page 9-5 Measuring tasks PCD2.H110 9.1.5 Combination of counting and frequency measuring As already mentioned, frequency measurement can be used in parallel with counting. This is shown very well by a combination of the two examples "Motion control with incremental shaft encoder" (application example no. 2, section 8.7) and the present demonstration of the principle of frequency measurement. It is just necessary to remove the commands for displaying position (read counter) from the motion control example, since only one display is available and it is used to display frequency. Since both functions are executed on the same H110, the initialisation is common for the whole module. In this example the initialisation is performed in the IST of the positioning program. The start of the measurement takes place directly after the initialisation. IST 10 $include d2h110_b.equ $group h110 ld r 0 0 r 999 0 r 998 0 ; empty scratch register cfb init k 1 2 r 999 r 998 1 1 0 0 5 100 0 2 ; initialisation H110 ; par 1 module number ; par 2 count mode: "x2" ; par 3 start value for counter ; par 4 value for preset register ; par 5 enable "static-inverted" ; par 6 CCO "static-inverted" ; par 7 input A "normal" ; par 8 input B "normal" ; par 9 measuring mode: "frequ.-auto." ; par 10 length time window in ms ; par 11 EnableM: "static-normal" ; par 12 TCO: "dynamic-normal" cfb h exec k 1 StartMs r 0 ; start measure ; module number ; command: start measure ; empty register ld ld EST ; start value for counter ; value for preset register ; 10 The project consists therefore of two programs: 'move-02.sfc' with the initialisation of the H110 and 'frequ-02' without XOB 16. The motion control sequence can be viewed online in GRAFTEC with the relevant frequency on the display module. Page 9-6 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9.2 Period length measurement 9.2.1 Block diagram Configuration (CTR1) Input A Configuration (CTR2) 1 MHz Tb register Time base counter StartT EnableT Measurement controller TCO FlagT TCO Output TCO EnableM Input EnableM 26/755 E2 (2H1-90-E.DOC) Measuring counter 16 Bit PCD1/2 bus A Overflow Latch measurement SAIA-Burgess Electronics Ltd. Page 9-7 Measuring tasks PCD2.H110 9.2.2 Description of period length measurement Period length measurement uses 2 counters of 16 bits each: • One of these two counters, the time base counter, has a fixed clock of 1 MHz, producing a fundamental time base of 1 µs. The user-defined time base is generated here. • The other counter, the measurement counter, counts the time base pulses between two rising edges on input 'A'. Therefore, when there are consecutive pulses at input 'A', measurement is always between pairs of pulses, after which there is a pause to restore readiness for the next measurement. Input A Measuring Clock M. counter Output TCO Page 9-8 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9.2.3 Configuration of period length measurement The configuration takes place in FB 'Init'. For continuous period length measurement, parameter 9 should be defined as '3' (period-automatic). A manual period length measurement is possible but not very useful. To obtain this mode, parameter 9 should be defined as '2'. In this case only one period is measured. Then the whole procedure has to be repeated for a new measurement. With parameter 7 the signal on input 'A' can be inverted. Measuring range and time base The measuring range is between 0 and 65 535 (16 bit). The formula shown below can be used to calculate what value to enter for the time base: T * 106 n = ---------------------- - 1 clk where: T clk n = period length in seconds = number of clock signals = value to enter Example: Let period length equal 10s and the number of clock signals equal 10 000 10 * 106 n = --------------------- - 1 = 999 10 000 Parameter 11 defines the behaviour of input 'EnableM', parameter 12 the behaviour of output 'TCO'. =7 Configuration input A integer 0–3 =9 Configuration measuring mode Load value for measuring Configuration of input EnableM integer 0–5 integer 0 – 65535 integer 0–3 Configuration of output TCO integer 0–3 = 10 = 11 = 12 0: C=norm M=normal 1: C=invers M=normal 2: C=norm. M=invers 3: C=invers M=invers 2 = period-manual 3 = period-automatic Timebase for period length measurement 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted The complete table is shown in the appendix, page A-2. 26/755 E2 (2H1-90-E.DOC) SAIA-Burgess Electronics Ltd. Page 9-9 Measuring tasks PCD2.H110 9.2.4 Programming principle Task: A photoelectric barrier (or a no-bounce impulse contact) is to be wired to input 'A'. The time between two 'H' edges should be measured and displayed on the display module. The configuration should be designed so that for a measure time of 1 second, 10000 clock signals are counted. The timebase will be 99 (see formula). ; *********************************************** ; Basic user program for the PCD2.H110 module ; for period length measurement: peri-01.src ; *********************************************** ; $include d2h110_b.equ $group h110 xob 16 ld r 0 0 ; empty scratch register cfb init k 1 0 r 0 r 0 0 0 3 0 3 99 0 2 ; initialisation H110 ; par 1 module number ; par 2 not used for measurement ; par 3 not used for measurement ; par 4 not used for measurement ; par 5 not used for measurement ; par 6 not used for measurement ; par 7 input A "inverted" ; par 8 not used ; par 9 mode: "period-auto." ; par 10 timebase in µs ; par 11 EnableM: "static-normal" ; par 12 TCO: "dynamic-normal" cfb exec k 1 StartMs r 0 ; start measure ; modul number ; command: start measure ; empty register exob ; --------------------------------------------------------cob wait: 0 0 sth jr EndMes_1 ; measure ended ? l wait ; if not, wait cfb exec k 1 RdMsImp r 777 ; read measure result ; module number ; command: read measure in impulsion ; read value in R 777 dsp r 777 ; display on display module ecob ; --------------------------------------------------------xob com exob 20 o 101 ; interrupt "INB1" ; inverts after each measure $endgroup Page 9-10 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks Program description In hardware, a signal transmitter supplying the signals to be measured, e.g. a photoelectric barrier, should be wired to input 'A'. Input 'B' remains open. The 'EnableC' input is not used at all for measurement and remains open. The 'EnableM' input ought really to receive +24V, but has been inverted during configuration and therefore remains open. *) The 'TCO' output is wired to the PCD’s interrupt input 'INB1'. At the end of each measurement, XOB 20 is called which, for this example, inverts the PCD output O 101. This is so that program function can be viewed better. The time base defined for this example is 99 for a result in 10000 ms for 1s measuring time. See also "Measuring range and time base" Input 'A' is inverted (Init parameter 7 = '3'), as the photoelectric barrier supplies an inverted signal. The COB waits until the end of each measurement before reading the result from the measuring counter, where it can be displayed by the debugger or on a display module in integer format. The units of measurement are controlled by the time base definition. In this example it is 1/10000 of seconds. With 'RdMsUnit' instead of 'RdMsImp' the result is always converted into seconds and can be viewed in the PCD register in floating point format. With the command 'StopMs', a running measure can be broken off. The result is not valid. A new measure can be started again with 'StartMs'. *) 26/755 E2 (2H1-90-E.DOC) After a deactivate of 'EnableM' the result is not valid. A new measure can be started only with the command 'StartMs'. SAIA-Burgess Electronics Ltd. Page 9-11 Measuring tasks PCD2.H110 Notes Page 9-12 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9.3 Pulse length measurement 9.3.1 Block diagram Configuration (CTR1) Input A Configuration (CTR2) 1 MHz Tb register Time base counter StartT EnableT Measurement controller TCO FlagT TCO EnableM Measuring counter 16 Bit Output TCO Input EnableM 26/755 E2 (2H1-90-E.DOC) PCD1/2 bus A Overflow Latch measurement SAIA-Burgess Electronics Ltd. Page 9-13 Measuring tasks PCD2.H110 9.3.2 Description of pulse length measurement Pulse length measurement uses 2 counters of 16 bits each: • One of these two counters, the time base counter, has a fixed clock of 1 MHz, producing a fundamental time base of 1 µs. The user-defined time base is generated here. • The other counter, the measurement counter, counts the time base pulses while input 'A' is H (positive or normal pulse length measurement) or while input 'A' is L (negative or inverted pulse length measurement). Remark: Negative or inverted pulse length measurement is achieved by setting 'Init' parameter 7 = '3'. Pos. pulse Pos. pulse Neg. pulse Input A Measuring Clock M. counter Output TCO Page 9-14 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks 9.3.3 Configuration of pulse length measurement The configuration takes place in FB 'Init'. For continuous pulse length measurement, parameter 9 should be defined as '1' (impulse-automatic). A manual pulse length measurement is possible but not very useful. To obtain this mode, parameter 9 should be defined as '0'. In this case only one pulse is measured. Then the whole procedure has to be repeated for a new measurement. Measurement range and time base The measurement range is between 0 and 65 535 (16 bit). The formula shown below can be used to calculate what value to enter for the time base: T * 106 n = ---------------------- - 1 clk where: T clk n = pulse length in seconds = number of clock signals = value to be entered Example: Let the pulse length equal 10s and the number of clock signals be 10 000 10 * 106 n = --------------------- - 1 = 999 10 000 Parameter 11 defines the behaviour of input 'EnableM', parameter 12 the behaviour of output 'TCO'. =7 Configuration input A integer 0–3 =9 Configuration measuring mode Load value for measuring Configuration of input EnableM integer 0-5 integer 0 - 65535 integer 0-3 Configuration of output TCO integer 0-3 = 10 = 11 = 12 0: C=norm M=normal 1: C=invers M=normal 2: C=norm. M=invers 3: C=invers M=invers 0 = impulse-manual 1 = impulse-automatic Timebase for pulse length measurement 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted 0 = static-normal 1 = static-inverted 2 = dynamic-normal 3 = dynamic-inverted The complete table is shown in the appendix, page A-2. 26/755 E2 (2H1-90-E.DOC) SAIA-Burgess Electronics Ltd. Page 9-15 Measuring tasks PCD2.H110 9.3.4 Programming principle Task: A photoelectric barrier (or a no-bounce impulse contact) is to be wired to input 'A'. The time for the length of a pulse (input A = H or input A = L) is to be measured and displayed on the display module. The configuration is to be designed so that for a measure time of 1 second, 1000 clock signals are counted. The timebase will be 999 (see formula). ; *********************************************** ; Basic user program for the PCD2.H110 module ; for pulse length measurement: imp-01.src ; *********************************************** ; $include d2h110_b.equ $group h110 xob 16 ld r 0 0 ; empty scratch register cfb init k 1 0 r 0 r 0 0 0 3 0 1 999 0 2 ; initialisation H110 ; par 1 module number ; par 2 not used for measuring ; par 3 not used for measuring ; par 4 not used for measuring ; par 5 not used for measuring ; par 6 not used for measuring ; par 7 input A "inverted" ; par 8 not used ; par 9 mode: "impulse-auto." ; par 10 timebase in µs ; par 11 EnableM: "static-normal" ; par 12 TCO: "dynamic-normal" cfb exec k 1 StartMs r 0 ; start measure ; module number ; command: start measure ; empty register exob ; --------------------------------------------------------cob wait: 0 0 sth jr EndMes_1 ; measure ended ? l wait ; if not, wait cfb exec k 1 RdMsImp r 777 ; read measure result ; module number ; command: read measure in impulsion ; read value in R 777 dsp r 777 ; display on display module ecob ; --------------------------------------------------------xob com exob 20 o 101 ; interrupt "INB1" ; inverts after each measure $endgroup Page 9-16 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Measuring tasks Program description In hardware, a signal transmitter supplying the signals to be measured, e.g. a photoelectric barrier, should be wired to input 'A'. Input 'B' remains open. The 'EnableC' input is not used at all for measurement and remains open. The 'EnableM' input ought really to receive +24V, but has been inverted during configuration and therefore remains open. The 'TCO' output is wired to the PCD’s interrupt input 'INB1'.At the end of each measurement, XOB 20 is called which, for this example, inverts the PCD output O 101. This is so that program function can be viewed better. The time base defined for this example is 999 for a result in milliseconds. See also "Measuring range and time base" Input 'A' is inverted (Init parameter 7 = '3'), as the photoelectric barrier supplies an inverted signal. The COB waits until the end of each measurement before reading the result from the measuring counter, where it can be displayed by the debugger or on a display module in integer format. The units of measurement are controlled by the time base definition. In the present example it is milliseconds. With 'RdMsUnit' instead of 'RdMsImp' the result is always converted into seconds and can be viewed in the PCD register in floating point format. With the command 'StopMs', a running measure can be broken off. The result is not valid. A new measure can be started again with 'StartMs'. *) 26/755 E2 (2H1-90-E.DOC) After a deactivate of 'EnableM' the result is not valid. A new measure can be started only with the command 'StartMs'. SAIA-Burgess Electronics Ltd. Page 9-17 Measuring tasks PCD2.H110 Notes Page 9-18 SAIA-Burgess Electronics Ltd. (2H1-90-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL Appendix A. Summary of all software elements for programming in IL Function block 'Init' Init FB: Initialisation of a H110 module Module number Init =1 Function Block Counter configuration =2 Counter preset =3 Register preset =4 Enable counter config. =5 CCO configuration =6 IN-A configuration =7 IN-B configuration =8 Measuring configuration =9 Measuring value = 10 Enable measuring config. = 11 TCO configuration = 12 FB levels: 1 Index modified: no Processing time: 5 ms *) *) measured with PCD2.M120 Function description: This FB defines the settings of the PCD2.H110 module and reads the base address from file D2H110_B.MBA. Parameter '1' must be given as a 'K' constant, parameter '3' and '4' are PCD register addresses (absolute or symbolic) and all other parameters as integer numbers. 26/755 E2 (2H1-AA-E.DOC) SAIA-Burgess Electronics Ltd. Page A-1 Summary of software elements for IL PCD2.H110 Description of participating input/output elements: Para- Designation meter =1 Module no. =2 Counter mode configuration =3 =4 =5 Type Format Value K Load counter preset value Load register preset value Enable counter configuration Kn Integer K 1–K 16 0-4 R Integer 0 - 16777215 R Integer 0 - 16777215 Integer 0-3 =6 CCO configuration Integer 0-3 =7 Input A configuration Integer 0–1 =8 Input B configuration Integer 0-1 =9 Measure mode configuration Integer 0-5 = 10 Load measure value Integer 0 - 65535 = 11 Enable measure configuration Integer 0-3 = 12 TCO configuration Integer 0-3 Page A-2 SAIA-Burgess Electronics Ltd. Comment 0 / 1 = mode x1 2 = mode x2 3 = mode x3 4 = mode x4 Start value of the counter CCO set value 0 = static-normal 1 = static-inverted 2 = dynam.-normal 3 = dynam.-inverted 0 = static-normal 1 = static-inverted 2 = dynam.-normal 3 = dynam.-inverted 0 = normal (counter) 1 = invers (counter) 2 = normal (measure) 3 = invers (measure) 0 = normal 1 = invers 0 = impulse-manual 1 = impulse-autom. 2 = period-manual 3 = period-autom. 4 = frequency-manual 5 = frequency-autom. measure window in case of frequency measure and clock divider in case of impulsion length or period measure 0 = static-normal 1 = static-inverted 2 = dynam.-normal 3 = dynam.-inverted 0 = static-normal 1 = static-inverted 2 = dynam.-normal 3 = dynam.-inverted (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL Function block 'Exec' Exec FB: Execution of a command for the H110 module Exec Function Block Module number =1 Command =2 Parameter (Register) (= 3) (= 3) FB levels: 1 Index modified: nein (Register) Processing time: depending from the command Function description: This FB is used to send commands to the PCD2.H110 module. Module number (parameter 1) must be a 'K' constant (K 1…K 16). The base address is defined in file 'D2H110_B.MBA'. These FBs support up to max. 16 PCD2.H110 modules per PCD system. Individual commands (parameter 2) are described in the following pages. The parameter of a command (e.g. counter preset value for command LdCtPres) is transferred from a register (parameter 3). If a command does not need a parameter (e.g. StartCt) any register or 'rNotUse' can be presented. 26/755 E2 (2H1-AA-E.DOC) SAIA-Burgess Electronics Ltd. Page A-3 Summary of software elements for IL PCD2.H110 Individual instructions for PCD2.H110 (FB parameters) LdCtPres Command: Load counter preset Exec Function Block Module number =1 LdCtPres =2 Register with load value =3 Index modified: no Processing time: 1.5.ms Function description: This command loads the preset counter value. This value will be the one from which the counter will count up or down after a start counter command. Description of participating input/output elements: Par. =1 =2 =3 Page A-4 Designation/Function Module number Command: LdCtPres Register with load value Type K Format Value 1 - 16 Comment 24 bit counter R integer 0 - 16777215 SAIA-Burgess Electronics Ltd. (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL LdRegPres Command: Load register preset Exec Function Block Module number =1 LdRegPres =2 Register with load value =3 Index modified: no Processing time: 1.5.ms Function description: This command loads the register preset value. This value will be compared to the counter value. When they'll be equal then the CCO will be set according to the CCO configuration. Description of participating input/output elements: Par. =1 =2 =3 Designation/Function Module number Command: LdRegPres PCD reg. with load value 26/755 E2 (2H1-AA-E.DOC) Type K Format Value 1 - 16 Comment 24 bit counter R Integer 0 - 16777215 SAIA-Burgess Electronics Ltd. Page A-5 Summary of software elements for IL ModMsConf Command: PCD2.H110 Measure mode configuration Exec Function Block Module number =1 ModMsConf =2 Register with value for configuration =3 Index modified: no Processing time: 1 ms Function description: This command loads the measure register configuration with the mode of the measure chosen. The manual mode means that after each measure a new start counter has to be done. In automatic mode the first start has to be done by the user program and then a condition like CCO is to be used to finish the measure. Description of participating input/output elements: Par. =1 =2 =3 Designation/Function Module number Command: ModMsConf PCD register with value for the configuration Type K R Format Value 1 - 16 Comment integer default value = 0 0-5 This command is used only if the configuration should be changed during the program run. Normally, the configuration is done on the beginning of the program in the FB 'Init' (parameter 9). Page A-6 SAIA-Burgess Electronics Ltd. (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 LdMsVal Summary of software elements for IL Command: Load measure value Exec Function Block Module number =1 LdMsVal =2 Register with load value =3 Index modified: no Processing time: 1.3 ms Function description: This command loads the measure window in case of frequency measure and loads the clock divider value in case of period or impulsion length measure. In case of frequency measure: To get a resolution of 0.1%, you need to count 1000 impulsion on input A. The measure window depend of the frequency to measure. For instance to measure a frequency like: 100 kHz the measure window has to be: 500 Hz the measure window has to be: 10 ms 2000 ms Formula: f = frequency t = time of measure window R= resolution t= 1000 * R f In case of period or impulsion length measure, see next page: 26/755 E2 (2H1-AA-E.DOC) SAIA-Burgess Electronics Ltd. Page A-7 Summary of software elements for IL PCD2.H110 In case of period or impulsion length measure The time of the measure is always equal to a period of the signal or to the length of the impulsion. For instance to measure a period of a frequency like: 500 Hz the measure time has to be 2 ms 270 µHz the measure time has to be 1 hour With the formula as follow, it is possible to calculate the value of the time base. To get a resolution of 0.1 % you need at least 1000 impulsion. t = period or impulsion length [s] n = value to load clk = clock number n= 106 * t - 1 clk You need to subtract 1 because when the counter "time base" reach 0, it needs 1µs to reinitialize itself. Description of participating input/output elements: Par. =1 =2 =3 Page A-8 Designation/Function Module number Command: LdMsVal PCD reg. with load value Type K R Format Value 1 - 16 Com integer 16 bit SAIA-Burgess Electronics Ltd. 0 - 65535 (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL RdCt Command: Read counter Exec Function Block Module number =1 RdCt =2 =3 Index modified: Register for result no Processing time: 1.4 ms Function description: This command reads the actual counter value. Description of participating input/output elements: Par. =1 =2 =3 Designation/Function Module number Command: RdCt PCD register for result 26/755 E2 (2H1-AA-E.DOC) Type K R Format Value 1 - 16 Com. integer 24 bit SAIA-Burgess Electronics Ltd. 0 - 16777215 Page A-9 Summary of software elements for IL RdMsImp Command: PCD2.H110 Read measure in impulsion Exec Function Block Module number =1 RdMsImp =2 Index modified: Register for result =3 no Processing time: 1.4 ms Function description: This command reads the result of the measure in impulsion. For a frequency measure the result is the number of impulsion during the measure window was open. On the other hands for a period or impulsion length measurement the results is the number of impulsion between either two edge up for the period measure or one edge up and the edge down of the impulsion. Description of participating input/output elements: Par. =1 =2 =3 Page A-10 Designation/Function Module number Command: RdMsImp PCD register for result Type K Format Value 1 - 16 Com. R integer 0 - 65535 16 bit SAIA-Burgess Electronics Ltd. (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL RdMsUnit Command: Read measure in Unit Exec Function Block Module number =1 RdMsUnit =2 =3 Index modified: Register for result no Processing time: 1.4 ms Function description: This command reads the result of the measure in specific unit. For a frequency measure the result is in Hertz. For period or impulsion length measurements the results are seconds (s). In both cases the results is a floating point value. Description of participating input/output elements: Par. =1 =2 =3 Designation/Function Module number Command: RdMsUnit PCD register for result 26/755 E2 (2H1-AA-E.DOC) Type K Format R FP SAIA-Burgess Electronics Ltd. Value 1 - 16 Com. 16 bit Page A-11 Summary of software elements for IL StartCt Command: PCD2.H110 Start counter Exec Function Block Module number =1 StartCt =2 not used =3 Index modified: no Processing time: 0.4 ms Function description: This command starts the counter if the hardware enable is high or put the counter in a waiting position if the hardware enable is low. In a manual mode this command has to be done after each measure, on the other hands in automatic mode the start has to be done once by the user program. Par. =1 =2 =3 Page A-12 Designation/Function Module number Command: StartCt empty PCD register Type K Format Value 1 - 16 R integer 0 SAIA-Burgess Electronics Ltd. Comment (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL StartMs Command: Start measure Exec Function Block Module number =1 StartMs =2 not used =3 Index modified: no Processing time: 0.5 ms Function description: This command starts the measure if the hardware enable is high or put the measure in a waiting position if the hardware enable is low. In a manual mode this command has to be done after each measure, on the other hands in automatic mode the start has to be done once by the user program. Par. =1 =2 =3 Designation/Function Module number Command: StartMs empty PCD register 26/755 E2 (2H1-AA-E.DOC) Type K R Format Value 1 - 16 integer SAIA-Burgess Electronics Ltd. Comment 0 Page A-13 Summary of software elements for IL StopMs Command: PCD2.H110 Stop measure Exec Function Block Module number =1 StopMs =2 not used =3 Index modified: no Processing time: 0.5 ms Function description: This command stops the measure. The results in the two 16 bits counters are from the last measure finished or maybe completely wrong. Par. =1 =2 =3 Designation/Function Module number Command: StopMs empty PCD register Type K Format Value 1 - 16 R integer 0 Comment For a new start, the command 'StartMs' is to execute again. Page A-14 SAIA-Burgess Electronics Ltd. (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for IL RdIdent Command: Read module identification Exec Function Block Module number =1 RdIdent =2 Index modified: =3 Register for result no Processing time: 1 ms Function description: This command can be used to check the correct function of the PCD2.H110 module and read the FPGA version. If the module is working properly, the value 17xx will be returned. See table below. If the module is faulty (or incorrectly addressed) the value 0 is read. Description of participating input/output elements: Par. =1 =2 =3 Designation/Function Module number Command: RdIdent PCD register for result Type K R Format Value 1 - 16 Comment integer 0 → faulty 12 bit Table of valid identifiers: Value 2759 1761 1762 1763 ... 3215 26/755 E2 (2H1-AA-E.DOC) FPGA version version HC0 version HC1 version HC2 version HC3 ... version HDF SAIA-Burgess Electronics Ltd. Page A-15 Summary of software elements for IL PCD2.H110 Notes Page A-16 SAIA-Burgess Electronics Ltd. (2H1-AA-E.DOC) 26/755 E2 PCD2.H110 Summary of software elements for FUPLA Appendix B. Summary of all software elements for programming in FUPLA In preparation 26/755 E2 (2H1-AB-E.DOC) SAIA-Burgess Electronics Ltd. Page B-1 Summary of software elements for FUPLA PCD2.H110 Notes Page B-2 SAIA-Burgess Electronics Ltd. (2H1-AB-E.DOC) 26/755 E2 From : To send back to : Company : Department : Name : Address : SAIA-Burgess Electronics Ltd. Bahnhofstrasse 18 CH-3280 Murten (Switzerland) http://www.saia-burgess.com Tel. : BA : Electronic Controllers Date : Manual PCD2.H110 If you have any suggestions concerning the SAIA PCD, or have found any errors in this manual, brief details would be appreciated. SAIA-Burgess Electronics Ltd. Your suggestions : SAIA-Burgess Electronics Ltd. ">

Public link updated
The public link to your chat has been updated.
Advertisement
Key features
- Counting frequency up to 100 kHz
- Frequency range 500 Hz to 100 kHz
- Period or pulse lengths from 2 ms to 1h
- Axis control with incremental shaft encoders
- Programmable for other specific OEM tasks by means of plug-in PROM
- Pre-programmed functional blocks for standard functions
- Up to 16 PCD2.H110 modules in parallel operation
- Counting and measuring functions can be utilized simultaneously
- 24-bit counter and 16-bit measure register
- Direct counter output (CCO) and tachometer output (TCO)