100% found this document useful (1 vote)
15 views

LabView advanced programming techniques 2nd ed Edition Rick Bitter pdf download

The document provides information about the book 'LabVIEW: Advanced Programming Techniques, 2nd Edition' by Rick Bitter, which covers advanced programming topics in LabVIEW, including software development, exception handling, and multi-threading. It aims to support users with varying levels of expertise by presenting key programming techniques and tools. Additionally, it highlights the contributions of the authors and acknowledges the support received during the book's development.

Uploaded by

ouumluyba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
15 views

LabView advanced programming techniques 2nd ed Edition Rick Bitter pdf download

The document provides information about the book 'LabVIEW: Advanced Programming Techniques, 2nd Edition' by Rick Bitter, which covers advanced programming topics in LabVIEW, including software development, exception handling, and multi-threading. It aims to support users with varying levels of expertise by presenting key programming techniques and tools. Additionally, it highlights the contributions of the authors and acknowledges the support received during the book's development.

Uploaded by

ouumluyba
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 64

LabView advanced programming techniques 2nd ed

Edition Rick Bitter pdf download

https://ebookname.com/product/labview-advanced-programming-
techniques-2nd-ed-edition-rick-bitter/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Programming Arduino with LabVIEW 1st Edition Marco


Schwartz

https://ebookname.com/product/programming-arduino-with-
labview-1st-edition-marco-schwartz/

Digital Signal Processing System Design Second Edition


LabVIEW Based Hybrid Programming Nasser Kehtarnavaz

https://ebookname.com/product/digital-signal-processing-system-
design-second-edition-labview-based-hybrid-programming-nasser-
kehtarnavaz/

MAC OS X advanced development techniques 1st ed Edition


Joe Zobkiw

https://ebookname.com/product/mac-os-x-advanced-development-
techniques-1st-ed-edition-joe-zobkiw/

Processing and finishing of polymeric materials 1st


Edition Wiley

https://ebookname.com/product/processing-and-finishing-of-
polymeric-materials-1st-edition-wiley/
Cultivating the Spirit How College Can Enhance Students
Inner Lives 1st Edition Alexander W. Astin

https://ebookname.com/product/cultivating-the-spirit-how-college-
can-enhance-students-inner-lives-1st-edition-alexander-w-astin/

Student Centered Coaching A Guide for K 8 Coaches and


Principals 1st Edition Diane Sweeney

https://ebookname.com/product/student-centered-coaching-a-guide-
for-k-8-coaches-and-principals-1st-edition-diane-sweeney/

Eratosthenes Geography Eratosthenes (Editor)

https://ebookname.com/product/eratosthenes-geography-
eratosthenes-editor/

Iraq and the Use of Force in International Law 1st


Edition Marc Weller

https://ebookname.com/product/iraq-and-the-use-of-force-in-
international-law-1st-edition-marc-weller/

Improving K 12 STEM Education Outcomes through


Technological Integration 1st Edition Michael J. Urban
(Editor) & David A. Falvo (Editor)

https://ebookname.com/product/improving-k-12-stem-education-
outcomes-through-technological-integration-1st-edition-michael-j-
urban-editor-david-a-falvo-editor/
Signal and Image Multiresolution Analysis 1st Edition
Abdelialil Ouahabi

https://ebookname.com/product/signal-and-image-multiresolution-
analysis-1st-edition-abdelialil-ouahabi/
3325_C000.fm Page i Tuesday, August 22, 2006 2:25 PM

Half Title Page



LabVIEW
Advanced
Programming
Techniques
SECOND EDITION
3325_C000.fm Page ii Tuesday, August 22, 2006 2:25 PM
3325_C000.fm Page iii Tuesday, August 22, 2006 2:25 PM

Title Page
3325_C000.fm Page iv Tuesday, August 22, 2006 2:25 PM

CRC Press
Taylor & Francis Group
6000 Broken Sound Parkway NW, Suite 300
Boca Raton, FL 33487-2742
© 2007 by Taylor & Francis Group, LLC
CRC Press is an imprint of Taylor & Francis Group, an Informa business

No claim to original U.S. Government works


Printed in the United States of America on acid-free paper
10 9 8 7 6 5 4 3 2 1

International Standard Book Number-10: 0-8493-3325-3 (Hardcover)


International Standard Book Number-13: 978-0-8493-3325-5 (Hardcover)

This book contains information obtained from authentic and highly regarded sources. Reprinted
material is quoted with permission, and sources are indicated. A wide variety of references are
listed. Reasonable efforts have been made to publish reliable data and information, but the author
and the publisher cannot assume responsibility for the validity of all materials or for the conse-
quences of their use.

No part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any
electronic, mechanical, or other means, now known or hereafter invented, including photocopying,
microfilming, and recording, or in any information storage or retrieval system, without written
permission from the publishers.

For permission to photocopy or use material electronically from this work, please access www.
copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC)
222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that
provides licenses and registration for a variety of users. For organizations that have been granted a
photocopy license by the CCC, a separate system of payment has been arranged.

Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and
are used only for identification and explanation without intent to infringe.

Library of Congress Cataloging-in-Publication Data

Bitter, Rick.
LabVIEW : advanced programming techniques / Richard Bitter, Taqi
Mohiuddin, Matthew R. Nawrocki. -- 2nd ed.
p. cm.
ISBN 0-8493-3325-3 (alk. paper)
1. Computer programming. 2. LabVIEW. 3. Computer graphics. I. Mohiuddin,
Taqi. II. Nawrocki, Matt. III. Title.

QA76.6.B5735 2006
005.1--dc22 2006044686

Visit the Taylor & Francis Web site at


http://www.taylorandfrancis.com
and the CRC Press Web site at
http://www.crcpress.com
3325_C000.fm Page v Tuesday, August 22, 2006 2:25 PM

Preface and
Acknowledgments
As the power of the standard personal computer has steadily evolved, so have the
capabilities of LabVIEW. LabVIEW has simplified the working lives of thousands
of scientists, engineers, and technicians, and has increased their productivity. Auto-
mation has reduced the costs and increased the manufacturing outputs of factories
around the world. Cycle times for product development have been shortened and
quality of many products has steadily improved. LabVIEW does not get credit for
all of these improvements, but has without question played a valuable role in many
organizations for accomplishing these goals.
In our earlier experiences with LabVIEW, we found that adequate coverage of
key topics was lacking. Subjects that are useful to users without a formal background
in computer science such as approaches to software development, exception han-
dling, and state machines were very difficult to find. In addition, newer areas such
as multi-threading and ActiveX are even harder to locate and sometimes documen-
tation is non-existent. Part of our intent in this book is to cover these topics that are
difficult to find in other books on LabVIEW.
The chapters in this book are written in a manner that will allow readers to study
the topic of interest without having to read the contents in sequential order. Users
of LabVIEW with varying levels of expertise will find this book beneficial.
Proficiency with a programming language requires an understanding of the
language constructs and the tools needed to produce and debug code. The first two
chapters provide an overview of LabVIEW’s Integrated Development Environment,
programming constructs, and main features. These chapters are meant to supplement
LabVIEW’s documentation, and provide some good background information for
programmers new to the language.
Effective programmers have an understanding of programming techniques that
are applicable to a large number of programming problems. Programming tools such
as state machines that simplify logic of handling various occurrences and the use
of instrument drivers are two such programming tools. Exception handling is left
out of more applications than we want to discuss (including some of our own), but
we have included a chapter specifically on exception handling in LabVIEW.
Advanced programmers understand the operation of the language they are work-
ing with and how it interacts with the system. We present a chapter on multi-
threading’s impact on LabVIEW. Version 5.0 was LabVIEW’s debut into the world
of multi-threaded capable programming languages. A number of the issues that occur
with multi-threading programming were abstracted from the programmer, but a
working knowledge of muti-threaded interactions is needed.
3325_C000.fm Page vi Tuesday, August 22, 2006 2:25 PM

Object Oriented Programming (OOP) is commonly employed in languages


such as C++ and Java. LabVIEW programmers can realize some of the benefits to
such an approach as well. We define key terms often used in OOP, give an
explanation of object analysis and introduce you to applying these concepts within
a LabVIEW environment.
We also present two chapters on ActiveX and .NET. An explanation of related
technologies such as Component Object Model (COM) and Object Linking and
Embedding (OLE) is provided along with the significance of ActiveX. A description
on the use of ActiveX in LabVIEW applications is then provided. We follow this
up with several useful examples of ActiveX/.NET such as embedding a browser on
the front panel, use of the tree view control, and automating tasks with Microsoft
Word, Excel, and Access.
This book would not have been possible without the efforts of many individuals.
First, we want to thank our friends at National Instruments. Ravi Marawar was
invaluable in his support for the completion of this book. We would also like to
thank Norma Dorst and Steve Rogers for their assistance.
Our publishers at CRC Press, Nora and Helena have provided us with guidance
from the first day we began working on this edition until its completion. We
haven’t forgotten about the first edition publishing support of Dawn and Felicia.
If not for their efforts, this book may not have been successful enough to warrant
a second edition.
A special thanks to Tim Sussman, our colleague and friend. He came through
for us at times when we needed him. Also thanks to Greg Stehling, John Gervasio,
Jeff Hunt, Ron Wegner, Joe Luptak, Mike Crowley, the Tellabs Automation team
(Paul Mueller, Kevin Ross, Bruce Miller, Mark Yedinak, and Purvi Shah), Ted Lietz,
and Waj Hussain (if it weren’t for Waj, we would have never written the papers
which got us to writing this book).
Finally, we owe many thanks for the love and support of our families. They had
to put up with us during the many hours spent on this book. We would like to begin
by apologizing to our wives for the time spent working on the second edition that
could not be spent on the households! A special appreciation goes out to the loving
wives who dealt positively with our absences — Thanks to Claire, Sheila, and
Jahanara! Thank you moms and dads: Auradker and Mariam Mohiuddin, Rich and
Madalyn Bitter, Barney and Veronica Nawrocki. For moral support we thank Jaha-
nara, Mazhar, Tanweer, Faheem, Firdaus, Aliyah and Asiya, Matt Bitter, Andrea and
Jerry Lehmacher; Sheila, Reilly, Andy, Corinne, Mark, and Colleen Nawrocki, Sue
and Steve Fechtner.
3325_C000.fm Page vii Tuesday, August 22, 2006 2:25 PM

The Authors
Rick Bitter graduated from the University of Illinois at Chicago in 1994. He has
presented papers at Motorola and National Instruments-sponsored symposia. Rick
currently develops performance testing applications as a Senior Software Engineer.

Taqi Mohiuddin graduated in electrical engineering from the University of Illinois


at Chicago in 1995. He obtained his MBA from DePaul University. He has worked
with LabVIEW since 1995, beginning with version 3.1, ranging in various telecom-
munications applications. He has presented papers on LabVIEW at Motorola and
National Instruments conferences.

Matt Nawrocki graduated from Northern Illinois University in 1995. He has written
papers and has done presentations on LabVIEW topics at Motorola, National Instru-
ments, and Tellabs.
3325_C000.fm Page viii Tuesday, August 22, 2006 2:25 PM
3325_book.fm Page ix Monday, August 21, 2006 2:07 PM

Contents
Chapter 1 Introduction to LabVIEW....................................................................1
1.1 Virtual Instruments...........................................................................................1
1.1.1 The Front Panel....................................................................................2
1.1.2 Block Diagram .....................................................................................2
1.1.3 Executing VIs .......................................................................................3
1.1.4 LabVIEW File Extensions ...................................................................5
1.2 LabVIEW Projects ...........................................................................................5
1.3 Help ..................................................................................................................6
1.3.1 Built-in Help ........................................................................................7
1.3.2 Websites................................................................................................8
1.4 Data Flow Programming..................................................................................8
1.5 Menus and Palettes ..........................................................................................9
1.6 Front Panel Controls ......................................................................................11
1.6.1 User Control Sets ...............................................................................12
1.6.1.1 Numeric...............................................................................13
1.6.1.2 Boolean ...............................................................................15
1.6.1.3 String & Path ......................................................................16
1.6.1.4 Ring & Enum, List & Table...............................................18
1.6.1.5 Array, Cluster, and Matrix..................................................20
1.6.1.6 Graphs and Charts ..............................................................22
1.6.1.7 String & Path and I/O ........................................................24
1.7 Block Diagram Functions ..............................................................................26
1.7.1 Structures............................................................................................26
1.7.1.1 Sequence Structure .............................................................27
1.7.1.2 Case Structure.....................................................................30
1.7.1.3 For Loop .............................................................................32
1.7.1.4 While Loop .........................................................................37
1.7.1.5 Event Structure ...................................................................38
1.7.1.6 Disable Structure ................................................................38
1.7.1.7 Timed Structure ..................................................................39
1.7.1.8 Formula Node .....................................................................41
1.7.2 Numeric, Boolean, String, and Comparison .....................................42
1.7.3 Array and Cluster...............................................................................45
1.7.4 Timing ................................................................................................47
1.7.5 Dialog and User Interface..................................................................48
1.7.6 File I/O ...............................................................................................49
1.7.7 Instrument I/O, Connectivity, and Communication ..........................51
1.7.8 Creating Connectors...........................................................................52
1.7.9 Editing Icons ......................................................................................54
3325_book.fm Page x Monday, August 21, 2006 2:07 PM

1.7.10 Using SubVIs .....................................................................................56


1.7.11 VI Setup .............................................................................................56
1.8 Setting Options...............................................................................................61
1.8.1 Paths ...................................................................................................61
1.8.2 Block Diagram ...................................................................................62
1.8.3 Environment .......................................................................................63
1.8.4 Revision History.................................................................................63
1.8.5 VI Server and Web Server .................................................................64
1.8.6 Controls/Functions Palettes................................................................65

Chapter 2 LabVIEW Features ............................................................................69


2.1 Global and Local Variables............................................................................69
2.2 Shared Variables.............................................................................................72
2.3 Customizing Controls ....................................................................................74
2.3.1 Custom Controls ................................................................................74
2.3.2 Type Definitions .................................................................................76
2.3.3 Strict Type Definitions .......................................................................77
2.4 Property Nodes...............................................................................................78
2.5 Reentrant VIs..................................................................................................81
2.6 Libraries (.LLB) .............................................................................................83
2.7 Web Server .....................................................................................................86
2.8 Web Publishing Tool......................................................................................89
2.9 Instrument Driver Tools .................................................................................90
2.10 Profile Functions ............................................................................................94
2.10.1 VI Profiler ..........................................................................................94
2.10.2 Buffer Allocations ..............................................................................97
2.10.3 VI Metrics ..........................................................................................97
2.11 Auto SubVI Creation .....................................................................................98
2.12 Graphical Comparison Tools .......................................................................100
2.12.1 Compare VIs ....................................................................................101
2.12.2 Compare VI Hierarchies ..................................................................102
2.12.3 SCC Compare Files .........................................................................103
2.13 Report Generation Palette ............................................................................104
2.14 Application Builder......................................................................................106
2.15 Sound VIs.....................................................................................................107
2.16 Application Control......................................................................................109
2.16.1 VI Server VIs ...................................................................................109
2.16.2 Menu VIs..........................................................................................113
2.16.3 Help VIs ...........................................................................................117
2.16.4 Other Application Control VIs.........................................................118
2.17 Advanced Functions.....................................................................................118
2.17.1 Data Manipulation............................................................................118
2.17.2 Calling External Code......................................................................119
2.17.3 Synchronization................................................................................119
3325_book.fm Page xi Monday, August 21, 2006 2:07 PM

2.18 Source Code Control....................................................................................121


2.18.1 Configuration....................................................................................121
2.18.2 Adding and Modifying Files ...........................................................122
2.18.3 Advanced Features ...........................................................................123
2.19 Graphs ..........................................................................................................124
2.19.1 Standard Graphs...............................................................................124
2.19.2 3-D Graphs.......................................................................................125
2.19.3 Digital and Mixed Signal Graphs....................................................126
2.19.4 Picture Graphs..................................................................................126
2.20 Data Logging................................................................................................126
2.21 Find and Replace .........................................................................................127
2.22 Print Documentation ....................................................................................129
2.23 VI History ....................................................................................................130
2.24 Key Navigation ............................................................................................131
2.25 Express VIs ..................................................................................................132
2.26 Navigation Window......................................................................................133
2.27 Splitter Bar ...................................................................................................133
Bibliography ..........................................................................................................134

Chapter 3 State Machines .................................................................................135


3.1 Introduction ..................................................................................................135
3.1.1 State Machines in LabVIEW...........................................................136
3.1.2 When to Use a State Machine .........................................................136
3.1.3 Types of State Machines..................................................................137
3.2 Enumerated Types and Type Definitions.....................................................137
3.2.1 Type Definitions Used with State Machines ...................................138
3.2.2 Creating Enumerated Constants and Type Definitions ...................139
3.2.3 Converting between Enumerated Types and Strings.......................139
3.2.4 Drawbacks to Using Type Definitions and Enumerated
Controls ............................................................................................140
3.3 Sequence-Style State Machine.....................................................................140
3.3.1 When to Use a Sequence-Style State Machine...............................141
3.3.2 Example............................................................................................142
3.4 Test Executive-Style State Machine ............................................................144
3.4.1 The LabVIEW Template Standard State Machine..........................145
3.4.2 When to Use a Test Executive-Style State Machine.......................147
3.4.3 Recommended States for a Test Executive-Style State
Machine ............................................................................................147
3.4.4 Determining States for Test Executive-Style State Machines.........148
3.4.5 Example............................................................................................149
3.5 Classical-Style State Machine .....................................................................151
3.5.1 When to Use a Classical-Style State Machine................................152
3.5.2 Example............................................................................................152
3.6 Queued-Style State Machine .......................................................................161
3.6.1 When to Use the Queued-Style State Machine...............................162
3325_book.fm Page xii Monday, August 21, 2006 2:07 PM

3.6.2 Example Using LabVIEW Queue Functions ..................................162


3.6.3 Example Using an Input Array........................................................164
3.7 Drawbacks to Using State Machines...........................................................164
3.8 Recommendations and Suggestions.............................................................166
3.8.1 Documentation .................................................................................166
3.8.2 Ensure Proper Setup.........................................................................166
3.8.3 Error, Open, and Close States..........................................................166
3.8.4 Status of Shift Registers ..................................................................167
3.8.5 Typecasting an Index to an Enumerated Type ................................167
3.8.6 Make Sure You Have a Way Out.....................................................168
3.9 Problems/Examples ......................................................................................168
3.9.1 The Blackjack Example ...................................................................168
3.9.2 The Test Sequencer Example...........................................................171
3.9.3 The PC Calculator Example ............................................................176
Bibliography ..........................................................................................................179

Chapter 4 Application Structure .......................................................................181


4.1 Planning........................................................................................................181
4.2 Purpose of Structure.....................................................................................182
4.3 Software Models ..........................................................................................183
4.3.1 The Waterfall Model ........................................................................184
4.3.2 The Spiral Model .............................................................................185
4.3.3 Block Diagrams................................................................................186
4.3.4 Description of Logic ........................................................................186
4.4 Project Administration .................................................................................187
4.5 Documentation .............................................................................................188
4.5.1 LabVIEW Documentation ...............................................................188
4.5.2 Printing LabVIEW Documentation .................................................189
4.5.3 VI History ........................................................................................189
4.6 The Three-Tiered Structure..........................................................................189
4.7 Main Level ...................................................................................................192
4.7.1 User Interface ...................................................................................192
4.7.1.1 User Interface Design .......................................................192
4.7.1.2 Property Node Examples..................................................194
4.7.1.3 Customizing Menus ..........................................................197
4.7.2 Exception-Handling at the Main Level ...........................................199
4.8 Second Level — Test Level.........................................................................199
4.9 Bottom Level — Drivers .............................................................................201
4.10 Style Tips......................................................................................................203
4.10.1 Sequence Structures .........................................................................203
4.10.2 Nested Structures .............................................................................204
4.10.3 Drivers ..............................................................................................205
4.10.4 Polling Loops ...................................................................................205
4.10.5 Array Handling ................................................................................206
3325_book.fm Page xiii Monday, August 21, 2006 2:07 PM

4.11 The LabVIEW Project .................................................................................207


4.11.1 Project Overview..............................................................................207
4.11.2 Project File Operations ....................................................................209
4.11.3 Project Library .................................................................................210
4.11.4 Project File Organization .................................................................212
4.11.5 Build Specifications .........................................................................213
4.11.6 Source Code Management ...............................................................215
4.12 Summary ......................................................................................................215
Bibliography ..........................................................................................................218

Chapter 5 Drivers ..............................................................................................219


5.1 Communication Standards ...........................................................................219
5.1.1 GPIB.................................................................................................219
5.1.2 Serial Communications ....................................................................221
5.1.3 VXI...................................................................................................223
5.1.4 LXI ...................................................................................................224
5.1.5 VISA Definition ...............................................................................224
5.1.6 DDE..................................................................................................226
5.1.7 OLE ..................................................................................................227
5.1.8 TCP/IP..............................................................................................227
5.1.9 DataSocket........................................................................................228
5.1.10 Traditional DAQ...............................................................................229
5.1.11 NI-DAQmx .......................................................................................231
5.1.12 File I/O .............................................................................................235
5.1.13 Code Interface Node and Call Library Function ............................239
5.2 Driver Classifications ...................................................................................240
5.2.1 Configuration Drivers.......................................................................241
5.2.2 Measurement Drivers .......................................................................241
5.2.3 Status Drivers ...................................................................................241
5.3 Inputs/Outputs ..............................................................................................241
5.4 Error Handling .............................................................................................242
5.5 NI Spy ..........................................................................................................244
5.5.1 NI Spy Introduction .........................................................................244
5.5.2 Configuring NI Spy..........................................................................244
5.5.3 Running NI Spy ...............................................................................246
5.6 Driver Guidelines .........................................................................................247
5.7 Reuse and Development Reduction.............................................................247
5.8 Driver Example ............................................................................................248
5.9 Instrument I/O Assistant ..............................................................................250
5.10 IVI Drivers ...................................................................................................251
5.10.1 Classes of IVI Drivers .....................................................................251
5.10.2 Interchangeability.............................................................................252
5.10.3 Simulation ........................................................................................252
5.10.4 State Management............................................................................253
5.10.5 IVI Driver Installation......................................................................253
3325_book.fm Page xiv Monday, August 21, 2006 2:07 PM

5.10.6 IVI Configuration.............................................................................254


5.10.7 How to Use IVI Drivers...................................................................255
5.10.8 Soft Panels........................................................................................256
5.10.9 IVI Driver Example .........................................................................256
Bibliography ..........................................................................................................260

Chapter 6 Exception Handling..........................................................................261


6.1 Exception Handling Defined........................................................................261
6.2 Types of Errors.............................................................................................263
6.2.1 I/O Errors .........................................................................................263
6.2.2 Logical Errors ..................................................................................264
6.3 Built-in Error Handling................................................................................265
6.3.1 Error Cluster.....................................................................................265
6.3.2 Error Codes ......................................................................................268
6.3.3 VISA Error Handling.......................................................................268
6.3.4 Simple Error Handler.......................................................................270
6.3.5 General Error Handler .....................................................................270
6.3.6 Find First Error ................................................................................271
6.3.7 Clear Error........................................................................................272
6.4 Performing Exception Handling ..................................................................272
6.4.1 When?...............................................................................................272
6.4.2 Exception-Handling at Main Level .................................................273
6.4.3 Programmer-Defined Errors.............................................................273
6.4.4 Managing Errors ..............................................................................274
6.4.5 State Machine Exception Handling .................................................276
6.4.6 Logging Errors .................................................................................277
6.4.7 External Error Handler.....................................................................277
6.4.8 Proper Exit Procedure......................................................................280
6.4.9 Exception Handling Example ..........................................................281
6.5 Debugging Code...........................................................................................286
6.5.1 Error List ..........................................................................................286
6.5.2 Execution Highlighting ....................................................................287
6.5.3 Single-Stepping ................................................................................287
6.5.4 Probe Tool ........................................................................................288
6.5.5 Breakpoint Tool................................................................................290
6.5.6 Suspending Execution......................................................................291
6.5.7 Data Logging....................................................................................291
6.5.8 NI Spy/GPIB Spy.............................................................................292
6.5.9 Utilization of Debugging Tools .......................................................293
6.5.10 Evaluating Race Conditions.............................................................295
6.6 Summary ......................................................................................................296
Bibliography ..........................................................................................................297
3325_book.fm Page xv Monday, August 21, 2006 2:07 PM

Chapter 7 Shared Variable ................................................................................299


7.1 Overview of Shared Variables .....................................................................299
7.1.1 Single Process Variables ..................................................................300
7.1.2 Network Published Variable.............................................................300
7.2 Shared Variable Engine................................................................................301
7.2.1 Accessing the Shared Variable Engine ............................................301
7.2.1.1 Shared Variable Manager..................................................301
7.2.1.2 Windows Event Viewer ....................................................302
7.2.1.3 Windows Performance Monitor .......................................302
7.2.1.4 Windows Task Manager ...................................................304
7.3 Shared Variable Processes and Services......................................................304
7.4 Shared Variable Networking ........................................................................306
7.5 Shared Variable Domains.............................................................................308
7.6 Pitfalls of Distributed Applications .............................................................312
7.7 Shared Variables and Network Security ......................................................313
7.7.1 LabVIEW Specific Security Issues..................................................316
Bibliography ..........................................................................................................317

Chapter 8 .NET, ActiveX, and COM................................................................319


8.1 Introduction to OLE, COM, and ActiveX ...................................................320
8.1.1 Definition of Related Terms.............................................................320
8.1.1.1 Properties and Methods ....................................................320
8.1.1.2 Interfaces...........................................................................321
8.1.1.3 Clients and Servers ...........................................................321
8.1.1.4 In-Process and Out-of-Process .........................................321
8.1.1.5 The Variant........................................................................322
8.2 COM.............................................................................................................322
8.3 OLE ..............................................................................................................323
8.4 ActiveX.........................................................................................................323
8.4.1 Description of ActiveX ....................................................................323
8.4.2 ActiveX Definitions .........................................................................324
8.4.3 ActiveX Technologies ......................................................................324
8.4.3.1 ActiveX Terminology .......................................................325
8.4.4 Events ...............................................................................................326
8.4.5 Containers.........................................................................................326
8.4.6 How ActiveX Controls Are Used ....................................................327
8.5 .NET .............................................................................................................327
8.5.1 Description of .NET.........................................................................328
8.5.2 Common Language Runtime ...........................................................328
8.5.3 Intermediate Language.....................................................................329
8.5.4 Web Protocols ..................................................................................329
8.5.5 Assembly ..........................................................................................329
8.5.6 Global Assembly Cache...................................................................329
3325_book.fm Page xvi Monday, August 21, 2006 2:07 PM

8.6 LabVIEW and ActiveX................................................................................330


8.6.1 The LabVIEW ActiveX Container ..................................................330
8.6.1.1 Embedding Objects...........................................................330
8.6.1.2 Inserting ActiveX Controls and Documents ....................332
8.6.2 The ActiveX Palette .........................................................................334
8.6.2.1 Automation Open and Close ............................................334
8.6.2.2 The Property Node ...........................................................335
8.6.2.3 The Invoke Node ..............................................................336
8.6.2.4 Variant to Data Function ..................................................339
8.6.3 Using the Container versus Automation..........................................340
8.6.4 Event Support in LabVIEW ............................................................340
8.6.4.1 Register Event...................................................................341
8.6.4.2 Event Callback..................................................................341
8.6.5 LabVIEW as ActiveX Server...........................................................343
8.7 LabVIEW and .NET ....................................................................................344
8.7.1 .NET Containers...............................................................................344
8.7.2 .NET Palette .....................................................................................347
8.8 The VI Server...............................................................................................348
8.9 ActiveX and .NET Examples ......................................................................350
8.9.1 Common Dialog Control .................................................................350
8.9.2 Progress Bar Control........................................................................351
8.9.3 Microsoft Calendar Control .............................................................353
8.9.4 Web Browser Control ......................................................................354
8.9.5 Microsoft Scripting Control.............................................................358
8.9.6 Microsoft System Information Control ...........................................360
8.9.7 Microsoft Status Bar Control...........................................................362
8.9.8 Microsoft Tree View Control ...........................................................365
8.9.9 Microsoft Agent ...............................................................................368
8.9.9.1 Request Objects — First Tier...........................................369
8.9.9.2 Other First-Tier Controls ..................................................369
8.9.9.3 The Characters Object ......................................................369
8.9.9.4 The Character Control ......................................................370
8.9.10 Registry Editing Control ..................................................................375
8.9.11 Controlling Microsoft Word.............................................................377
8.9.12 Microsoft Access Control ................................................................379
8.9.13 Instrument Control Using ActiveX..................................................383
8.9.14 Instrument Control Using .NET ......................................................384
8.9.15 Controlling LabVIEW from Other Applications.............................387
8.9.16 Understanding ActiveX Error Codes ...............................................391
8.9.17 Advanced ActiveX details................................................................393
Bibliography ..........................................................................................................395

Chapter 9 Multithreading in LabVIEW............................................................397


9.1 Multithreading Terminology ........................................................................398
9.1.1 Win32 ...............................................................................................398
3325_book.fm Page xvii Monday, August 21, 2006 2:07 PM

9.1.2UNIX ................................................................................................398
9.1.3Multitasking .....................................................................................398
9.1.3.1 Preemptive Multithreading ...............................................399
9.1.4 Kernel Objects..................................................................................400
9.1.5 Thread...............................................................................................400
9.1.6 Process..............................................................................................401
9.1.7 Application .......................................................................................401
9.1.8 Priority..............................................................................................402
9.1.8.1 How Operating Systems Determine which Threads........402
9.1.9 Security.............................................................................................402
9.1.10 Thread Safe ......................................................................................402
9.2 Thread Mechanics ........................................................................................403
9.2.1 Thread States....................................................................................404
9.2.2 Scheduling Threads..........................................................................404
9.2.3 Context Switching............................................................................404
9.3 Win32 Multithreading ..................................................................................405
9.4 Pthreads ........................................................................................................406
9.5 Multithreading Problems..............................................................................407
9.5.1 Race Conditions ...............................................................................408
9.5.2 Priority Inversion..............................................................................408
9.5.3 Starvation..........................................................................................409
9.5.4 Deadlocking .....................................................................................409
9.5.5 Operating System Solutions.............................................................410
9.6 Multithreading Myths ..................................................................................410
9.6.1 The More Threads, the Merrier .......................................................410
9.6.2 More Threads, More Speed .............................................................411
9.6.3 Makes Applications More Robust ...................................................411
9.6.4 Conclusion on Myths .......................................................................412
9.7 Hyper-Threading ..........................................................................................412
9.8 Multithreaded LabVIEW .............................................................................413
9.8.1 Execution Subsystems......................................................................414
9.8.2 The Run Queue ................................................................................417
9.8.3 DLLs in Multithreaded LabVIEW ..................................................418
9.8.4 Customizing the Thread Configuration ...........................................421
9.9 Thread Count Estimation for LabVIEW .....................................................423
9.9.1 Same as Caller or Single Subsystem Applications .........................426
9.9.2 Multiple Subsystem Applications ....................................................427
9.9.3 Optimizing VIs for Threading .........................................................428
9.9.4 Using VI Priorities ...........................................................................432
9.10 Subroutines in LabVIEW.............................................................................434
9.10.1 Express VIs ......................................................................................435
9.10.2 LabVIEW Data Types......................................................................435
9.10.3 When to Use Subroutines ................................................................437
9.11 Summary ......................................................................................................441
Bibliography ..........................................................................................................441
3325_book.fm Page xviii Monday, August 21, 2006 2:07 PM

Chapter 10 Object-Oriented Programming in LabVIEW ..................................443


10.1 What Is Object-Oriented? ............................................................................444
10.1.1 The Class..........................................................................................444
10.1.2 Encapsulation ...................................................................................445
10.1.3 Aggregation ......................................................................................446
10.1.4 Inheritance ........................................................................................447
10.1.5 Polymorphism ..................................................................................448
10.2 Objects and Classes .....................................................................................448
10.2.1 Methods............................................................................................449
10.2.1.1 Special Method — Constructor........................................449
10.2.1.2 Special Method — Destructor..........................................450
10.2.2 Properties..........................................................................................450
10.3 Object Analysis ............................................................................................451
10.4 Object Design...............................................................................................459
10.4.1 Container Classes.............................................................................460
10.4.2 Abstract Classes ...............................................................................460
10.5 Object Programming ....................................................................................464
10.6 Developing Objects in LabVIEW................................................................465
10.6.1 Properties..........................................................................................466
10.6.2 Constructors .....................................................................................467
10.6.3 Destructors .......................................................................................471
10.6.4 Methods............................................................................................472
10.6.4.1 Public Methods .................................................................472
10.6.4.2 Private Methods ................................................................472
10.7 Examples in Developing Instrument Drivers...............................................473
10.7.1 Complex Instrument Designs...........................................................476
10.8 Object Template ...........................................................................................487
10.9 Exercises.......................................................................................................489
Bibliography ..........................................................................................................489

Index ......................................................................................................................491
3325_C001.fm Page 1 Tuesday, August 22, 2006 9:11 AM

1 Introduction to LabVIEW

Programmers develop software applications every day in order to increase efficiency


and productivity in various situations. LabVIEW, as a programming language, is a
powerful tool that can be used to help achieve these goals. LabVIEW (Laboratory
Virtual Instrument Engineering Workbench) is a graphically-based programming
language developed by National Instruments. Its graphical nature makes it ideal for
test and measurement (T&M), automation, instrument control, data acquisition, and
data analysis applications. This results in significant productivity improvements over
conventional programming languages. National Instruments focuses on products for
T&M, giving them a good insight into developing LabVIEW.
This chapter will provide a brief introduction to LabVIEW. Some basic topics
will be covered to give you a better understanding of how LabVIEW works and
how to begin using it. This chapter is not intended to teach beginners LabVIEW
programming thoroughly. Those wishing to learn LabVIEW should consider attend-
ing a National Instruments LabVIEW Basics course. Relevant information on the
courses offered, schedules, and locations can be found at www.ni.com/training. If
you have prior experience with LabVIEW, you can skip this chapter and proceed to
the advanced chapters.
First, VIs and their components will be discussed, followed by LabVIEW’s
dataflow programming paradigm. Then, several topics related to creating VIs will
be covered by explaining the front panel and block diagram. The chapter will
conclude with descriptions of icons and setting preferences.

1.1 VIRTUAL INSTRUMENTS


Simply put, a Virtual Instrument (VI) is a LabVIEW programming element. A VI
consists of a front panel, block diagram, and an icon that represents the program.
The front panel is used to display controls and indicators for the user, and the block
diagram contains the code for the VI. The icon, which is a visual representation of
the VI, has connectors for program inputs and outputs.
Programming languages such as C and BASIC use functions and subroutines as
programming elements. LabVIEW uses the VI. The front panel of a VI handles the
function inputs and outputs, and the code diagram performs the work of the VI.
Multiple VIs can be used to create large scale applications, in fact, large scale
applications may have several hundred VIs. A VI may be used as the user interface
or as a subroutine in an application. User interface elements such as graphs are
easily accessed, as drag-and-drop units in LabVIEW.

1
3325_C001.fm Page 2 Tuesday, August 22, 2006 9:11 AM

2 LabVIEW: Advanced Programming Techniques

FIGURE 1.1

1.1.1 THE FRONT PANEL


Figure 1.1 illustrates the front panel of a LabVIEW VI. It contains a knob for
selecting the number of measurements per average, a control for selecting the
measurement type, a digital indicator to display the output value, and a stop button.
An elaborate front panel can be created without much effort to serve as the user
interface for an application. Front panels and LabVIEW’s built-in tools are discussed
in more detail in Section 1.5.

1.1.2 BLOCK DIAGRAM


Figure 1.2 depicts the block diagram, or source code, that accompanies the front
panel in Figure 1.1. The outer rectangular structure represents a While loop, and the
inner one is a case structure. The icon in the center is a VI, or subroutine, that takes
the number of measurements per average as input and returns the frequency value
as the output. The orange line, or wire, represents the data being passed from the
control into the VI. The selection for the measurement type is connected, or wired
to the case statement to determine which case is executed. When the stop button is
pressed, the While loop stops execution. This example demonstrates the graphical
nature of LabVIEW and gives you the first look at the front panel, block diagram,
and icon that make up a Virtual Instrument. Objects and structures related to the
code diagram will be covered further in Section 1.6.
LabVIEW is not an interpreted language; it is compiled behind the scenes by
LabVIEW’s execution engine. Similar to Java, the VIs are compiled into an execut-
able code that LabVIEW’s execution engine processes during runtime. Every time
a change is made to a VI, LabVIEW constructs a wire table for the VI. This wire
table identifies elements in the block diagram that have inputs needed for that element
3325_C001.fm Page 3 Tuesday, August 22, 2006 9:11 AM

Introduction to LabVIEW 3

"Frequency"
Number of Measurements per Average Output

Measurement Type

stop

FIGURE 1.2

to run. Elements can be primitive operators such as addition, or more complex such
as a subVI. If LabVIEW successfully constructs all the wire tables, you are presented
a solid arrow indicating that the VIs can be executed. If the wire table cannot be
created, then a broken arrow is presented for the VIs with a problem, and also for
each VI loaded in memory that requires that VI for execution. LabVIEW runs in
several subsystems, which will be described throughout this book. All that we need
to understand now is that the main execution subsystem compiles diagrams while
you write them. This allows programmers to write code and test it without needing
to wait for a compiling process, and programmers do not need to worry about
execution speed because the language is not interpreted.
The wire diagrams that are constructed do not define an order in which elements
are executed. This is an important concept for advanced programmers to understand.
LabVIEW is a dataflow-based language, which means that elements will be executed
in a somewhat arbitrary order. LabVIEW does not guarantee which order a series
of elements is executed in if they are not dependent on each other. A process called
arbitrary interleaving is used to determine the order elements are executed in. You
may force an order of execution by requiring that elements require output from
another element before execution. This is a fairly common practice, and most
programmers do not recognize that they are forcing the order of execution. When
programming, it will become obvious that some operations must take place before
others can. It is the programmer’s responsibility to provide a mechanism to force
the order of execution in the code design.

1.1.3 EXECUTING VIS


A LabVIEW program is executed by pressing the arrow or the Run button located
in the palette along the top of the window. While the VI is executing, the Run button
changes to a black color as depicted in Figure 1.3. Note that not all of the items in
the palette are displayed during execution of a VI. As you proceed to the right along
3325_C001.fm Page 4 Tuesday, August 22, 2006 9:11 AM

4 LabVIEW: Advanced Programming Techniques

FIGURE 1.3

the palette, you will find the Continuous Run, Stop, and Pause buttons. If you
compare Figures 1.1 and 1.3, the last three buttons in Figure 1.1 disappear in Figure
1.3. These buttons are used for alignment of objects on the panel or diagram, and
are not available while a program is running. VIs are normally run from the front
panel; however, they can also be executed from the block diagram. This allows the
programmer to run the program and utilize some of the other tools that are available
for debugging purposes.
If the Run button appears as a broken arrow, this indicates that the LabVIEW
program or VI cannot compile because of programming errors. When all of the
errors are fixed, the broken Run button will be substituted by the regular Run button.
LabVIEW has successfully compiled the diagram. While editing or creating a VI,
you may notice that the palette displays the broken Run button. If you continue to
see this after editing is completed, press the button to determine the cause of the
errors. An Error List window will appear displaying all of the errors that must be
fixed before the VI can compile. Debugging techniques are discussed further in
Chapter 6, which covers exception handling.
The palette contains four additional buttons on the block diagram that are not
available from the front panel. These are typically used for debugging an application.
The button with the lightbulb is for Execution Highlighting and the three following
it are used for stepping through the code. Figure 1.4 shows the code diagram with
Execution Highlighting activated. You can see bubbles that represent the data flowing
along the wire, from one block to the next. You can step through the code as needed
when the Pause button is used in conjunction with Execution Highlighting. As stated
earlier, debugging techniques will be covered in Chapter 6.
3325_C001.fm Page 5 Tuesday, August 22, 2006 9:11 AM

Introduction to LabVIEW 5

FIGURE 1.4

1.1.4 LABVIEW FILE EXTENSIONS


LabVIEW programs utilize the .vi extension. However, multiple VIs can be saved
into library format with the .llb extension. Libraries are useful for grouping related
VIs for file management. When loading a particular VI that makes calls to other
VIs, the system is able to find them quickly. Using a library has benefits over simply
using a directory to group VIs. It saves disk space by compressing VIs, and facilitates
the movement of VIs between directories or computers. When saving single VIs,
remember to add the .vi extension. If you need to create a library for a VI and its
subVIs, you will need to create a source distribution using the LabVIEW Project.
If you want to create a new library starting with one VI, you can use Save or Save
As. Then select New VI Library from the dialog box. The File Manager can then
be used to add or remove VIs from a library.

1.2 LABVIEW PROJECTS


Among other features in LabVIEW 8, the one you should be interacting with daily
is the project view. LabVIEW’s new project view provides a convenient interface
to access everything in a LabVIEW project. Historically, locating all the Vis in
an application has required the use of the hierarchy window, but that does not
locate some things like LabVIEW libraries and configuration of the application
builder. The project explorer provides a tree-driven list of all of these. The set of
VI sources and libraries are shown in the first major breakdown: the Source tree.
Information related to compilation and installation of an application are kept in
3325_C001.fm Page 6 Tuesday, August 22, 2006 9:11 AM

6 LabVIEW: Advanced Programming Techniques

FIGURE 1.5

the second branch of the tree: Build Specifications. Information relating to the
target machine environment you are building an application to is located in the
last branch: System Definition. Applications that use the same operating system
as the development platform will not find the System Definition folder to be of
value. If a compile target is something like a Palm Pilot, then this folder is where
definitions specific to a Palm based target would be configured. The project window
is shown in Figure 1.5.
Among other things worth noting on the project explorer window is the toolbar,
which contains buttons to create, save, and save all VIs in the application; compile;
the standard cut, copy, and paste buttons; buttons to support compilation of VIs; and
buttons to support source code control tools. All of these features will be elaborated
on in Chapters 2 and 4.
In general, most work will be done in the Sources branch which provides a
listing of all VIs and variables in the project. The Dependencies section is for VIs,
DLLs, and project libraries that are called statically by a VI.

1.3 HELP
For beginning users of LabVIEW, there are various sources for assistance to aid in
learning the language. Because this book is not a comprehensive guide for begin-
Another Random Document on
Scribd Without Any Related Topics
Lady-day 1730; and in his Principal, as will appear, soon afterwards,
very unexpectedly, found a Patron.
The Doctor gave Mr. Pegge the choice of three Cures under him—
of Sundrich, of a London Living, or the Chaplainship of St. Cross, of
which the Doctor was then Master. Mr. Pegge preferred Sundrich,
which he held till Dr. Lynch exchanged, that Rectory for
Bishopsbourne, and then removed thither at Midsummer 1731.
Within a few months after this period, Dr. Lynch, who had married
a daughter of Archbishop Wake, obtained for Mr. Pegge, unsolicited,
the Vicarage of Godmersham (cum Challock), into which he was
inducted Dec. 6, 1731.
We have said unsolicited, because, at the moment when the Living
was conferred, Mr. Pegge had more reason to expect a reproof from
his Principal, than a reward for so short a service of these Cures.
The case was, that Mr. Pegge had, in the course of the preceding
summer (unknown to Dr. Lynch) taken a little tour, for a few months,
to Leyden, with a Fellow Collegian (John Stubbing, M. B. then a
medical pupil under Boerhaave), leaving his Curacy to the charge of
some of the neighbouring Clergy. On his return, therefore, he was
not a little surprized to obtain actual preferment through Dr. Lynch,
without the most distant engagement on the score of the Doctor's
interest with the Archbishop, or the smallest suggestion from Mr.
Pegge.
Being now in possession of a Living, and independent property,
Mr. Pegge married (April 13, 1732) Miss Anne Clarke, the only
daughter of Benjamin, and sister of John Clarke, Esqrs. of Stanley,
near Wakefield, in the county of York, by whom he had one Son
[Samuel, of whom hereafter], who, after his Mother's death, became
eventually heir to his Uncle; and one Daughter, Anna-Katharina, wife
of the Rev. John Bourne, M.A. of Spital, near Chesterfield, Rector of
Sutton cum Duckmanton, and Vicar of South Winfield, both in
Derbyshire; by whom she had two daughters, Elizabeth, who
married Robert Jennings, Esq. and Jane, who married Benjamin
Thompson, Esq.
While Mr. Pegge was resident in Kent, where he continued twenty
years, he made himself acceptable to every body, by his general
knowledge, his agreeable conversation, and his vivacity; for he was
received into the familiar acquaintance of the best Gentlemen's
Families in East Kent, several of whom he preserved in his
correspondence after he quitted the county, till the whole of those of
his own standing gave way to fate before him.
Having an early propensity to the study of Antiquity among his
general researches, and being allowedly an excellent Classical
Scholar, he here laid the foundation of what in time became a
considerable collection of books, and his little cabinet of Coins grew
in proportion; by which two assemblages (so scarce among Country
Gentlemen in general) he was qualified to pursue those collateral
studies, without neglecting his parochial duties, to which he was
always assiduously attentive.
The few pieces which Mr. Pegge printed while he lived in Kent will
be mentioned hereafter, when we shall enumerate such of his
Writings as are most material. These (exclusively of Mr. Urban's
obligations to him in the Gentleman's Magazine) have appeared
principally, and most conspicuously, in the Archæologia, which may
be termed the Transactions of the Society of Antiquaries. In that
valuable collection will be found more than fifty memoirs, written
and communicated by him, many of which are of considerable
length, being by much the greatest number hitherto contributed by
any individual member of that respectable Society.
In returning to the order of time, we find that, in July 1746, Mr.
Pegge had the great misfortune to lose his Wife; whose monumental
inscription, at Godmersham, bears ample testimony of her worth:
"MDCCXLVI.
Anna Clarke, uxor Samuelis Pegge
Vicarii hujus parochiæ;
Mulier, si qua alia, sine dolo,
Vitam æternam et beatam fidenter hic sperat;
nec erit frustra."
This event entirely changed Mr. Pegge's destinations; for he now
zealously meditated on some mode of removing himself, without
disadvantage, into his Native County. To effect this, one of two
points was to be carried; either to obtain some piece of preferment,
tenable in its nature with his Kentish Vicarage; or to exchange the
latter for an equivalent; in which last he eventually succeeded
beyond his immediate expectations.
We are now come to a new epoch in the Doctor's life; but there is
an interval of a few years to be accounted for, before he found an
opportunity of effectually removing himself into Derbyshire.
His Wife being dead, his Children young and at school, and himself
reduced to a life of solitude, so ungenial to his temper (though no
man was better qualified to improve his leisure); he found relief by
the kind offer of his valuable Friend, Sir Edward Dering, Bart.
At this moment Sir Edward chose to place his Son[12] under the
care of a private Tutor at home, to qualify him more competently for
the University. Sir Edward's personal knowledge of Mr. Pegge, added
to the Family situation of the latter, mutually induced the former to
offer, and the latter to accept, the proposal of removing from
Godmersham to Surrenden (Sir Edward's mansion-house) to
superintend Mr. Dering's education for a short time; in which
capacity he continued about a year and a half, till Mr. Dering was
admitted of St. John's College, Cambridge, in March 1751.
Sir Edward had no opportunity, by any patronage of his own,
permanently to gratify Mr. Pegge, and to preserve him in the circle of
their common Friends. On the other hand, finding Mr. Pegge's
propensity to a removal so very strong, Sir Edward reluctantly
pursued every possible measure to effect it.
The first vacant living in Derbyshire which offered itself was the
Perpetual Curacy of Brampton, near Chesterfield; a situation
peculiarly eligible in many respects. It became vacant in 1747; and,
if it could have been obtained, would have placed Mr. Pegge in the
centre of his early acquaintance in that County; and, being tenable
with his Kentish living, would not have totally estranged him from his
Friends in the South of England. The patronage of Brampton is in
the Dean of Lincoln, which Dignity was then filled by the Rev. Dr.
Thomas Cheyney; to whom, Mr. Pegge being a stranger, the
application was necessarily to be made in a circuitous manner, and
he was obliged to employ more than a double mediation before his
name could be mentioned to the Dean.
The mode he proposed was through the influence of William the
third Duke of Devonshire; to whom Mr. Pegge was personally known
as a Derbyshire man (though he had so long resided in Kent), having
always paid his respects to his Grace on the public days at
Chatsworth, as often as opportunity served, when on a visit in
Derbyshire. Mr. Pegge did not, however, think himself sufficiently in
the Duke's favour to make a direct address for his Grace's
recommendation to the Dean of Lincoln, though the object so fully
met his wishes in moderation, and in every other point. He had,
therefore, recourse to a friend, the Right Rev. Dr. Fletcher, Bishop of
Dromore, then in England; who, in conjunction with Godfrey
Watkinson, of Brampton Moor, Esq. (the principal resident
Gentleman in the parish of Brampton) solicited, and obtained, his
Grace's interest with the Dean of Lincoln: who, in consequence,
nominated Mr. Pegge to the living.
One point now seemed to be gained towards his re-
transplantation into his native soil, after he had resisted considerable
offers had he continued in Kent; and thus did he think himself
virtually in possession of a living in Derbyshire, which in its nature
was tenable with Godmersham in Kent. Henceforward, then, he no
doubt felt a satisfaction that he should soon be enabled to live in
Derbyshire, and occasionally visit his friends in Kent, instead of
residing in that county, and visiting his friends in Derbyshire.
But, after all this assiduity and anxiety (as if admission and
ejection had pursued him a second time), the result of Mr. Pegge's
expectations was far from answering his then present wishes; for,
when he thought himself secure by the Dean's nomination, and that
nothing was wanting but the Bishop's licence, the Dean's right of
Patronage was controverted by the Parishioners of Brampton, who
brought forward a Nominee of their own.
The ground of this claim, on the part of the Parish, was owing to
an ill-judged indulgence of some former Deans of Lincoln, who had
occasionally permitted the Parishioners to send an Incumbent
directly to the Bishop for his licence, without the intermediate
nomination of the Dean in due form.
These measures were principally fomented by the son of the last
Incumbent, the Rev. Seth Ellis, a man of a reprobate character, and
a disgrace to his profession, who wanted the living, and was
patronised by the Parish. He had a desperate game to play; for he
had not the least chance of obtaining any preferment, as no
individual Patron, who was even superficially acquainted with his
moral character alone, could with decency advance him in the
church. To complete the detail of the fate of this man, whose
interest the deluded part of the mal-contents of the parish so
warmly espoused, he was soon after suspended by the Bishop from
officiating at Brampton[13].
Whatever inducements the Parish might have to support Mr. Ellis
so strenuously we do not say, though they manifestly did not arise
from any pique to one Dean more than to another; and we are
decidedly clear that they were not founded in any aversion to Mr.
Pegge as an individual; for his character was in all points too well
established, and too well known (even to the leading opponents to
the Dean), to admit of the least personal dislike in any respect. So
great, nevertheless, was the acrimony with which the Parishioners
pursued their visionary pretensions to the Patronage, that, not
content with the decision of the Jury (which was highly respectable)
in favour of the Dean, when the right of Patronage was tried in
1748; they had the audacity to carry the cause to an Assize at
Derby, where, on the fullest and most incontestable evidence, a
verdict was given in favour of the Dean, to the confusion and
indelible disgrace of those Parishioners who espoused so bad a
cause, supported by the most undaunted effrontery.
The evidence produced by the Parish went to prove, from an entry
made nearly half a century before in the accompts kept by the
Churchwardens, that the Parishioners, and not the Deans of Lincoln,
had hitherto, on a vacancy, nominated a successor to the Bishop of
the Diocese for his licence, without the intervention of any other
person or party. The Parish accompts were accordingly brought into
court at Derby, wherein there appeared not only a palpable
erasement, but such an one as was detected by a living and credible
witness; for, a Mr. Mower swore that, on a vacancy in the year 1704,
an application was made by the Parish to the Dean of Lincoln in
favour of the Rev. Mr. Littlewood[14].
In corroboration of Mr. Mower's testimony, an article in the Parish
accompts and expenditures of that year was adverted to, and which,
when Mr. Mower saw it, ran thus:
"Paid William Wilcoxon, for going to Lincoln to the Dean
concerning Mr. Littlewood, five shillings."
The Parishioners had before alleged, in proof of their title, that
they had elected Mr. Littlewood; and, to uphold this asseveration,
had clumsily altered the parish accompt-book, and inserted the
words "to Lichfield to the Bishop," in the place of the words "to
Lincoln to the Dean."
Thus their own evidence was turned against the Parishioners; and
not a moment's doubt remained but that the patronage rested with
the Dean of Lincoln.
We have related this affair without a strict adherence to
chronological order as to facts, or to collateral circumstances, for the
sake of preserving the narrative entire, as far as it regards the
contest between the Dean of Lincoln and the Parish of Brampton; for
we believe that this transaction (uninteresting as it may be to the
publick in general) is one of very few instances on record which has
an exact parallel.
The intermediate points of the contest, in which Mr. Pegge was
more peculiarly concerned, and which did not prominently appear to
the world, were interruptions and unpleasant impediments which
arose in the course of this tedious process.
He had been nominated to the Perpetual Curacy of Brampton by
Dr. Cheyney, Dean of Lincoln; was at the sole expence of the suit
respecting the right of Patronage, whereby the verdict was given in
favour of the Dean; and he was actually licensed by the Bishop of
Lichfield. In consequence of this decision and the Bishop's licence,
Mr. Pegge, not suspecting that the contest could go any farther,
attended to qualify at Brampton, on Sunday, August 28, 1748, in the
usual manner; but was repelled by violence from entering the
Church.
In this state matters rested regarding the Patronage of Brampton,
when Dr. Cheyney was unexpectedly transferred from the Deanry of
Lincoln to the Deanry of Winchester, which (we may observe by the
way) he solicited on motives similar to those which actuated Mr.
Pegge at the very moment; for Dr. Cheyney, being a Native of
Winchester, procured an exchange of his Deanry of Lincoln with the
Rev. Dr. William George, Provost of Queen's college, Cambridge, for
whom the Deanry of Winchester was intended by the Minister on the
part of the Crown.
Thus Mr. Pegge's interests and applications were to begin de novo
with the Patron of Brampton; for, his nomination by Dr. Cheyney, in
the then state of things, was of no validity. He fell, however, into
liberal hands; for his activity in the proceedings which had hitherto
taken place respecting the living in question had rendered fresh
advocates unnecessary, as it had secured the unasked favour of Dr.
George, who not long afterwards voluntarily gave him the Rectory of
Whittington, near Chesterfield, in Derbyshire; into which he was
inducted Nov. 11, 1751, and where he resided for upwards of 44
years without interruption[15].
Though Mr. Pegge had relinquished all farther pretensions to the
living of Brampton before the cause came to a decision at Derby, yet
he gave every possible assistance at the trial, by the communication
of various documents, as well as by his personal evidence at the
Assize, to support the claim of the new Nominee, the Rev. John
Bowman, in whose favour the verdict was given, and who afterwards
enjoyed the benefice.
Here then we take leave of this troublesome affair, so nefarious
and unwarrantable on the part of the Parishioners of Brampton; and
from which Patrons of every description may draw their own
inferences.
Mr. Pegge's ecclesiastical prospect in Derbyshire began soon to
brighten; and he ere long obtained the more eligible living of
Whittington. Add to this that, in the course of the dispute concerning
the Patronage of Brampton, he became known to the Hon. and Right
Rev. Frederick (Cornwallis) Bishop of Lichfield and Coventry; who
ever afterwards favoured him not only with his personal regard, but
with his patronage, which extended even beyond the grave, as will
be mentioned hereafter in the order of time.
We must now revert to Mr. Pegge's old Friend Sir Edward Dering,
who, at the moment when Mr. Pegge decidedly took the living of
Whittington, in Derbyshire, began to negotiate with his Grace of
Canterbury (Dr. Herring), the Patron of Godmersham, for an
exchange of that living for something tenable with Whittington.
The Archbishop's answer to this application was highly honourable
to Mr. Pegge: "Why," said his Grace, "will Mr. Pegge leave my
Diocese? If he will continue in Kent, I promise you, Sir Edward, that
I will give him preferment to his satisfaction[16]."
No allurements, however, could prevail; and Mr. Pegge, at all
events, accepted the Rectory of Whittington, leaving every other
pursuit of the kind to contingent circumstances. An exchange was,
nevertheless, very soon afterwards effected, by the interest of Sir
Edward with the Duke of Devonshire, who consented that Mr. Pegge
should take his Grace's Rectory of Brinhill[17] in Lancashire, then
luckily void, the Archbishop at the same time engaging to present
the Duke's Clerk to Godmersham. Mr. Pegge was accordingly
inducted into the Rectory of Brindle, Nov. 23, 1751, in less than a
fortnight after his induction at Whittington[18].
In addition to this favour from the Family of Cavendish, Sir Edward
Dering obtained for Mr. Pegge, almost at the same moment, a scarf
from the Marquis of Hartington (afterwards the fourth Duke of
Devonshire), then called up to the House of Peers, in June 1751, by
the title of Baron Cavendish of Hardwick. Mr. Pegge's appointment is
dated Nov. 18, 1751; and thus, after all his solicitude, he found
himself possessed of two livings and a dignity, honourably and
indulgently conferred, as well as most desirably connected, in the
same year and in the same month; though this latter circumstance
may be attributed to the voluntary lapse of Whittington[19]. After Mr.
Pegge had held the Rectory of Brinhill for a few years, an
opportunity offered, by another obliging acquiescence of the Duke of
Devonshire, to exchange it for the living of Heath (alias Lown), in his
Grace's Patronage, which lies within seven miles of Whittington: a
very commodious measure, as it brought Mr. Pegge's parochial
preferments within a smaller distance of each other. He was
accordingly inducted into the Vicarage of Heath, Oct. 22, 1758,
which he held till his death.
This was the last favour of the kind which Mr. Pegge individually
received from the Dukes of Devonshire; but the Compiler of this little
Memoir regarding his late Father, flatters himself that it can give no
offence to that Noble Family if he takes the opportunity of testifying
a sense of his own personal obligations to William the fourth Duke of
Devonshire, when his Grace was Lord Chamberlain of his Majesty's
Household.
As to Mr. Pegge's other preferments, they shall only be briefly
mentioned in chronological order; but with due regard to his
obligations. In the year 1765 he was presented to the Perpetual
Curacy of Wingerworth, about six miles from. Whittington, by the
Honourable and Reverend James Yorke, then Dean of Lincoln,
afterwards Bishop of Ely, to whom he was but little known but by
name and character. This appendage was rendered the more
acceptable to Mr. Pegge, because the seat of his very respectable
Friend Sir Henry Hunloke, Bart. is in the parish, from whom, and all
the Family, Mr. Pegge ever received great civilities.
We have already observed, that Mr. Pegge became known,
insensibly as it were, to the Honourable and Right Reverend
Frederick (Cornwallis), Bishop of Lichfield, during the contest
respecting the living of Brampton; from whom he afterwards
received more than one favour, and by whom another greater
instance of regard was intended, as will be mentioned hereafter.
Mr. Pegge was first collated by his Lordship to the Prebend of
Bobenhull, in the Church of Lichfield, in 1757; and was afterwards
voluntarily advanced by him to that of Whittington in 1763, which he
possessed at his death[20].
In addition to the Stall at Lichfield, Mr. Pegge enjoyed the Prebend
of Louth, in the Cathedral of Lincoln, to which he had been collated
(in 1772) by his old acquaintance, and Fellow-collegian, the late
Right Reverend John Green, Bishop of that See[21].
This seems to be the proper place to subjoin, that, towards the
close of his life, Mr. Pegge declined a situation for which, in more
early days, he had the greatest predilection, and had taken every
active and modest measure to obtain—a Residentiaryship in the
Church of Lichfield.
Mr. Pegge's wishes tended to this point on laudable, and almost
natural motives, as soon as his interest with the Bishop began to
gain strength; for it would have been a very pleasant interchange, at
that period of life, to have passed a portion of the year at Lichfield.
This expectation, however, could not be brought forward till he was
too far advanced in age to endure with tolerable convenience a
removal from time to time; and therefore, when the offer was
realized, he declined the acceptance.
The case was literally this: While Mr. Pegge's elevation in the
Church of Lichfield rested solely upon Bishop (Frederick) Cornwallis,
it was secure, had a vacancy happened: but his Patron was
translated to Canterbury in 1768, and Mr. Pegge had henceforward
little more than personal knowledge of any of his Grace's Successors
at Lichfield, till the Hon. and Right Reverend James Cornwallis (the
Archbishop's Nephew) was consecrated Bishop of that See in 1781.
On this occasion, to restore the balance in favour of Mr. Pegge,
the Archbishop had the kindness to make an Option of the
Residentiaryship at Lichfield, then possessed by the Rev. Thomas
Seward. It was, nevertheless, several years before even the tender
of this preferment could take place; as his Grace of Canterbury died
in 1783, while Mr. Seward was living.
Options being personal property, Mr. Pegge's interest, on the
demise of the Archbishop, fell into the hands of the Hon. Mrs.
Cornwallis, his Relict and Executrix, who fulfilled his Grace's original
intention in the most friendly manner, on the death of Mr. Seward, in
1790[22].
The little occasional transactions which primarily brought Mr.
Pegge within the notice of Bishop (Frederick) Cornwallis at
Eccleshall-castle led his Lordship to indulge him with a greater share
of personal esteem than has often fallen to the lot of a private
Clergyman so remotely placed from his Diocesan. Mr. Pegge had
attended his Lordship two or three times on affairs of business, as
one of the Parochial Clergy, after which the Bishop did him the
honour to invite him to make an annual visit at Eccleshall-castle as
an Acquaintance. The compliance with this overture was not only
very flattering, but highly gratifying, to Mr. Pegge, who consequently
waited upon his Lordship for a fortnight in the Autumn, during
several years, till the Bishop was translated to the Metropolitical See
of Canterbury in 1768. After this, however, his Grace did not forget
his humble friend, the Rector of Whittington, as will be seen; and
sometimes corresponded with him on indifferent matters.
About the same time that Mr. Pegge paid these visits at Eccleshall-
castle, he adopted an expedient to change the scene, likewise, by a
journey to London (between Easter and Whitsuntide); where, for a
few years, he was entertained by his old Friend and Fellow-collegian
the Rev. Dr. John Taylor, F. S. A. Chancellor of Lincoln, &c. (the
learned Editor of Demosthenes and Lysias), then one of the
Residentiaries of St. Paul's.
After Dr. Taylor's death (1766), the Bishop of Lincoln, Dr. John
Green, another old College-acquaintance, became Mr. Pegge's
London-host for a few years, till Archbishop Cornwallis began to
reside at Lambeth. This event superseded the visits to Bishop Green,
as Mr. Pegge soon afterwards received a very friendly invitation from
his Grace; to whom, from that time, he annually paid his respects at
Lambeth-palace, for a month in the Spring, till the Archbishop's
decease, which took place about Easter 1783.
All these were delectable visits to a man of Mr. Pegge's turn of
mind, whose conversation was adapted to every company, and who
enjoyed the world with greater relish from not living in it every day.
The society with which he intermixed, in such excursions, changed
his ideas, and relieved him from the tædium of a life of much
reading and retirement; as, in the course of these journeys, he often
had opportunities of meeting old Friends, and of making new literary
acquaintance.
On some of these occasions he passed for a week into Kent,
among such of his old Associates as were then living, till the death
of his much-honoured Friend, and former Parishioner, the elder
Thomas Knight, Esq. of Godmersham, in 1781[23]. We ought on no
account to omit the mention of some extra-visits which Mr. Pegge
occasionally made to Bishop Green, at Buckden, to which we are
indebted for the Life of that excellent Prelate Robert Grosseteste,
Bishop of Lincoln;—a work upon which we shall only observe here,
that it is Dr. Pegge's chef-d'œuvre, and merits from the world much
obligation. To these interviews with Bishop Green, we may also
attribute those ample Collections, which Dr. Pegge left among his
MSS. towards a History of the Bishops of Lincoln, and of that
Cathedral in general, &c. &c.
With the decease of Archbishop Cornwallis (1783), Mr. Pegge's
excursions to London terminated. His old familiar Friends, and
principal acquaintance there, were gathered to their fathers; and he
felt that the lot of a long life had fallen upon him, having survived
not only the first, but the second class of his numerous distant
connexions.
While on one of these visits at Lambeth, the late Gustavus
Brander, Esq. F. S. A. who entertained an uncommon partiality for
Mr. Pegge, persuaded him, very much against his inclination, to sit
for a Drawing, from which an octavo Print of him might be engraved
by Basire. The Work went on so slowly, that the Plate was not
finished till 1785, when Mr. Pegge's current age was 81. Being a
private Print, it was at first only intended for, and distributed among,
the particular Friends of Mr. Brander and Mr. Pegge. This Print,
however, now carries with it something of a publication; for a
considerable number of the impressions were dispersed after Mr.
Brander's death, when his Library, &c. were sold by auction; and the
Print is often found prefixed to copies of "The Forme of Cury," a
work which will hereafter be specified among Mr. Pegge's literary
labours[24].
The remainder of Mr. Pegge's life after the year 1783 was, in a
great measure, reduced to a state of quietude; but not without an
extensive correspondence with the world in the line of Antiquarian
researches: for he afterwards contributed largely to the
Archæologia, and the Bibliotheca Topographica Britannica, &c. &c. as
may appear to those who will take the trouble to compare the dates
of his Writings, which will hereafter be enumerated, with the time of
which we are speaking.
The only periodical variation in life, which attended Mr. Pegge after
the Archbishop's death, consisted of Summer visits at Eccleshall-
castle to the present Bishop (James) Cornwallis, who (if we may be
allowed the word) adopted Mr. Pegge as his guest so long as he was
able to undertake such journeys.
We have already seen an instance of his Lordship's kindness in the
case of the intended Residentiaryship; and have, moreover, good
reasons to believe that, had the late Archdeacon of Derby (Dr. Henry
Egerton) died at an earlier stage of Mr. Pegge's life, he would have
succeeded to that dignity.
This part of the Memoir ought not to be dismissed without
observing, to the honour of Mr. Pegge, that, as it was not in his
power to make any individual return (in his life-time) to his Patrons,
the two Bishops of Lichfield of the name of Cornwallis, for their
extended civilities, he directed, by testamentary instructions, that
one hundred volumes out of his Collection of Books should be given
to the Library of the Cathedral of Lichfield[25].
During Mr. Pegge's involuntary retreat from his former associations
with the more remote parts of the Kingdom, he was actively awake
to such objects in which he was implicated nearer home.
Early in the year 1788 material repairs and considerable
alterations became necessary to the Cathedral of Lichfield. A
subscription was accordingly begun by the Members of the Church,
supported by many Lay-gentlemen of the neighbourhood; when Mr.
Pegge, as a Prebendary, not only contributed handsomely, but
projected, and drew up, a circular letter, addressed to the Rev.
Charles Hope, M. A. the Minister of All Saints (the principal) Church
in Derby, recommending the promotion of this public design. The
Letter, being inserted in several Provincial Newspapers, was so well
seconded by Mr. Hope, that it had a due effect upon the Clergy and
Laity of the Diocese in general; for which Mr. Pegge received a
written acknowledgment of thanks from the present Bishop of
Lichfield, dated May 29, 1788.
This year (1788), memorable as a Centenary in the annals of
England, was honourable to the little Parish of Whittington, which
accidentally bore a subordinate local part in the History of the
Revolution; for it was to an inconsiderable public-house there (still
called the Revolution-house) that the Earl of Devonshire, the Earl of
Danby, the Lord Delamere, and the Hon. John D'Arcy, were driven
for shelter, by a sudden shower of rain, from the adjoining common
(Whittington-Moor), where they had met by appointment, disguised
as farmers, to concert measures, unobservedly, for promoting the
succession of King William III. after the abdication of King James II.
[26]

The celebration of this Jubilee, on Nov. 5, 1788, is related at large


in the Gentleman's Magazine of that month[27]; on which day Mr.
Pegge preached a Sermon[28], apposite to the occasion, which was
printed at the request of the Gentlemen of the Committee who
conducted the ceremonial[29], which proceeded from his Church to
Chesterfield in grand procession.
In the year 1791 (July 8) Mr. Pegge was created D. C. L. by the
University of Oxford, at the Commemoration. It may be thought a
little extraordinary that he should accept an advanced Academical
Degree so late in life, as he wanted no such aggrandizement in the
Learned World, or among his usual Associates, and had voluntarily
closed all his expectations of ecclesiastical elevation. We are
confident that he was not ambitious of the compliment; for, when it
was first proposed to him, he put a negative upon it. It must be
remembered that this honour was not conferred on an unknown
man (novus homo); but on a Master of Arts of Cambridge, of name
and character, and of acknowledged literary merit[30]. Had Mr. Pegge
been desirous of the title of Doctor in earlier life, there can be no
doubt but that he might have obtained the superior degree of D. D.
from Abp. Cornwallis, upon the bare suggestion, during his familiar
and domestic conversations with his Grace at Lambeth-palace.
Dr. Pegge's manners were those of a gentleman of a liberal
education, who had seen much of the world, and had formed them
upon the best models within his observation. Having in his early
years lived in free intercourse with many of the principal and best-
bred Gentry in various parts of Kent; he ever afterwards preserved
the same attentions, by associating with respectable company, and
(as we have seen) by forming honourable attachments.
In his avocations from reading and retirement, few men could
relax with more ease and cheerfulness, or better understood the
desipere in loco;—could enter occasionally into temperate convivial
mirth with a superior grace, or more interest and enliven every
company by general conversation.
As he did not mix in business of a public nature, his better
qualities appeared most conspicuously in private circles; for he
possessed an equanimity which obtained the esteem of his Friends,
and an affability which procured the respect of his dependents.
His habits of life were such as became his profession and station.
In his clerical functions he was exemplarily correct, not entrusting
his parochial duties at Whittington (where he constantly resided) to
another (except to the neighbouring Clergy during the excursions
before-mentioned) till the failure of his eye-sight rendered it
indispensably necessary; and even that did not happen till within a
few years of his death.
As a Preacher, his Discourses from the pulpit were of the didactic
and exhortatory kind, appealing to the understandings rather than to
the passions of his Auditory, by expounding the Holy Scriptures in a
plain, intelligible, and unaffected manner. His voice was naturally
weak, and suited only to a small Church; so that when he
occasionally appeared before a large Congregation (as on Visitations,
&c.), he was heard to a disadvantage. He left in his closet
considerably more than 230 Sermons composed by himself, and in
his own hand-writing, besides a few (not exceeding 26) which he
had transcribed (in substance only, as appears by collation) from the
printed works of eminent Divines. These liberties, however, were not
taken in his early days, from motives of idleness, or other
attachments—but later in life, to favour the fatigue of composition;
all which obligations he acknowledged at the end of each such
Sermon.
Though Dr. Pegge's life was sedentary, from his turn to studious
retirement, his love of Antiquities, and of literary acquirements in
general; yet these applications, which he pursued with, great ardour
and perseverance, did not injure his health. Vigour of mind, in
proportion to his bodily strength, continued unimpaired through a
very extended course of life, and nearly till he had reached "ultima
linea rerum:" for he never had any chronical disease; but gradually
and gently sunk into the grave under the weight of years, after a
fortnight's illness, Feb. 14, 1796, in the 92d year of his age.
He was buried, according to his own desire, in the chancel at
Whittington, where a mural tablet of black marble (a voluntary
tribute of filial respect) has been placed, over the East window with
the following short inscription:
"At the North End of the Altar Table, within the Rails,
lie the Remains of
Samuel Pegge, LL. D.
who was inducted to this Rectory Nov. 11, 1751,
and died Feb. 14, 1796;
in the 92d year of his Age."
Having closed the scene; it must be confessed, on the one hand,
that the biographical history of an individual, however learned, or
engaging to private friends, who had passed the major part of his
days in secluded retreats from what is called the world, can afford
but little entertainment to the generality of Readers. On the other
hand, nevertheless, let it be allowed that every man of
acknowledged literary merit, had he made no other impression,
cannot but have left many to regret his death.
Though Dr. Pegge had exceeded even his "fourscore years and
ten," and had outlived all his more early friends and acquaintance;
he had the address to make new ones, who now survive, and who, it
is humbly hoped, will not be sorry to see a modest remembrance of
him preserved by this little Memoir.
Though Dr. Pegge had an early propensity to the pursuit of
Antiquarian knowledge, he never indulged himself materially in it, so
long as more essential and professional occupations had a claim
upon him; for he had a due sense of the nature and importance of
his clerical function. It appears that he had read the Greek and Latin
Fathers diligently at his outset in life. He had also re-perused the
Classicks attentively before he applied much to the Monkish
Historians, or engaged in Antiquarian researches; well knowing that
a thorough knowledge of the Learning of the Antients, conveyed by
classical Authors, was the best foundation for any literary structure
which had not the Christian Religion for its cornerstone.
During the early part of his incumbency at Godmersham in Kent,
his reading was principally such as became a Divine, or which
tended to the acquisition of general knowledge, of which he
possessed a greater share than most men we ever knew. When he
obtained allowable leisure to follow unprofessional pursuits, he
attached himself more closely to the study of Antiquities; and was
elected a Fellow of the Society of Antiquaries, Feb. 14, 1751, N. S. in
which year the Charter of Incorporation was granted (in November),
wherein his name stands enrolled among those of many very
respectable and eminently learned men[31].
Though we will be candid enough to allow that Dr. Pegge's style in
general was not sufficiently terse and compact to be called elegant;
yet he made ample amends by the matter, and by the accuracy with
which he treated every copious subject, wherein all points were
matured by close examination and sound judgment[32].
and a fund of knowledge, more than would have displayed itself in
any greater work, where the subject requires but one bias, and one
peculiar attention[33].
It is but justice to say, that few men were so liberal in the
diffusion of the knowledge which he had acquired, or more ready to
communicate it, either vivâ voce, or by the loan of his MSS. as many
of his living Friends can testify.
In his publications he was also equally disinterested as in his
private communications; for he never, as far as can be recollected,
received any pecuniary advantage from any pieces that he printed,
committing them all to the press, with the sole reserve of a few
copies to distribute among his particular Friends[34]. —No. III. 1766.
"An Essay on the Coins of Cunobelin; in an Epistle to the Right Rev.
Bishop of Carlisle [Charles Lyttelton], President of the Society of
Antiquaries." [105 pages, 4to.] [This collection of coins is classed in
two plates, and illustrated by a Commentary, together with
observations on the word tascia. N. B. The impression consisted of
no more than 200 copies.]—No. IV. 1772. "An Assemblage of Coins
fabricated by Authority of the Archbishops of Canterbury. To which
are subjoined, Two Dissertations." [125 pages, 4to.] 1. On a fine
Coin of Alfred the Great, with his Head. 2. On an Unic, in the
Possession of the late Mr. Thoresby, supposed to be a Coin of St.
Edwin; but shewn to be a Penny of Edward the Confessor. [An Essay
is annexed on the origin of metropolitical and other subordinate
mints; with an Account of their Progress and final Determination:
together with other incidental Matters, tending to throw light on a
branch of the Science of Medals, not perfectly considered by English
Medalists.]—No. V. 1772. "Fitz-Stephen's Description of the City of
London, newly translated from the Latin Original, with a necessary
Commentary, and a Dissertation on the Author, ascertaining the
exact Year of the Production; to which are added, a correct Edition
of the Original, with the various Readings, and many Annotations."
[81 pages, 4to.] [This publication (well known now to have been one
of the works of Dr. Pegge) was, as we believe, brought forward at
the instance of the Hon. Daines Barrington, to whom it is inscribed.
The number of copies printed was 250.]—No. VI. 1780. "The Forme
of Cury. A Roll of antient English Cookery, compiled about the Year
1390, Temp. Ric. II. with a copious Index and Glossary." [8vo.] [The
curious Roll, of which this is a copy, was the property of the late
Gustavus Brander, esq. It is in the hand-writing of the time, a
facsimile of which is given facing p. xxxi. of the Preface. The work
before us was a private impression; but as, since Mr. Brander's
decease, it has fallen, by sale, into a great many hands, we refer to
the Preface for a farther account of it. Soon after Dr. Pegge's
elucidation of the Roll was finished, Mr. Brander presented the
autograph to the British Museum.]—No. VII. 1789. "Annales Eliæ de
Trickenham, Monachi Ordinis Benedictini. Ex Bibliothecâ Lamethanâ."
To which is added, "Compendium Compertorum. Ex Bibliothecâ Ducis
Devoniæ." [4to.] [Both parts of this publication contain copious
annotations by the Editor. The former was communicated by Mr.
John Nichols, Printer, to whom it is inscribed. The latter was
published by permission of his Grace the Duke of Devonshire, to
whom it is dedicated. The respective Prefaces to these pieces will
best explain the nature of them.]—No. VIII. 1793. "The Life of
Robert Grosseteste, the celebrated Bishop of Lincoln." [4to.] [This
Work we have justly called his chef-d'œuvre; for, in addition to the
life of an individual, it comprises much important history of
interesting times, together with abundant collateral matter.]—The
two following works have appeared since the Writer's death: No. IX.
1801. "An Historical Account of Beauchief Abbey, in the County of
Derby, from its first Foundation to its final Dissolution. Wherein the
three following material Points, in opposition to vulgar Prejudices,
are clearly established: 1st, That this Abbey did not take its name
from the Head of Archbishop Becket, though it was dedicated to
him. 2d, That the Founder of it had no hand in the Murder of that
Prelate; and, consequently, that the House was not erected in
Expiation of that Crime. 3d, The Dependance of this House on that
of Welbeck, in the County of Nottingham; a Matter hitherto
unknown." [4to.]—No. X. 1809. "Anonymiana; or, Ten Centuries of
Observations on various Authors and Subjects. Compiled by a late
very learned and reverend Divine; and faithfully published from the
original MS. with the Addition of a copious Index." [8vo.]]
In the following Catalogue we must be allowed to deviate from
chronological order, for the sake of preserving Dr. Pegge's
contributions to various periodical and contingent Publications,
distinct from his independent Works; to all which, however, we shall
give (as far as possible) their respective dates.
The greatest honour, which a literary man can obtain, is the
eulogies of those who possessed equal or more learning than
himself. "Laudatus à laudatis viris" may peculiarly and deservedly be
said of Dr. Pegge, as might be exemplified from the frequent
mention made of him by the most respectable contemporary writers
in the Archæological line; but modesty forbids our enumerating
them.

Whittington Church, Derbyshire.


Gent. Mag. Supp. 1809. Pl. II, p. 1201.
Schnebbelie del. 1789.
APPENDIX TO THE PARENTALIA.
1. Whittington Church.
The annexed View was taken in 1789, by the ingenious Mr. Jacob
Schnebbelie; and the following concise account of it was
communicated in 1793, by the then worthy and venerable Rector.
"Whittington, of whose Church the annexed Plate contains a
Drawing by the late Mr. Schnebbelie, is a small parish of about 14 or
15 hundred acres, distant from the church and old market-place of
Chesterfield about two miles and a half. It lies in the road from
Chesterfield to Sheffield and Rotherham, whose roads divide there at
the well-known inn The Cock and Magpye, commonly called The
Revolution House.
The situation is exceedingly pleasant, in a pure and excellent air. It
abounds with all kinds of conveniences for the use of the
inhabitants, as coal, stone, timber, &c.; besides its proximity to a
good market, to take its products.
The Church is now a little Rectory, in the gift of the Dean of
Lincoln. At first it was a Chapel of Ease to Chesterfield, a very large
manor and parish; of which I will give the following short but
convincing proof. The Dean of Lincoln, as I said, is Patron of this
Rectory, and yet William Rufus gave no other church in this part of
Derbyshire to the church of St. Mary at Lincoln but the church of
Chesterfield; and, moreover, Whittington is at this day a parcel of the
great and extensive manor of Chesterfield; whence it follows, that
Whittington must have been once a part both of the rectory and
manor of Chesterfield. But whence comes it, you will say, that it
became a rectory, for such it has been many years? I answer, I
neither know how nor when; but it is certain that chapels of ease
have been frequently converted into rectories, and I suppose by
mutual agreement of the curate of the chapel, the rector of the
mother church, and the diocesan. Instances of the like emancipation
of chapels, and transforming them into independent rectories, there
are several in the county of Derby, as Matlock, Bonteshall, Bradley,
&c.; and others may be found in Mr. Nichols's "History of Hinckley,"
and in his "Bibliotheca Topographica Britannica," No. VI.
Fig. 1 is an inscription on the Ting-tang, or Saints Bell, of
Whittington Church, drawn by Mr. Schnebbelie, 27 July, 1789, from
an impression taken in clay. This bell, which is seen in the annexed
view, hangs within a stone frame, or tabernacle, at the top of the
church, on the outside between the Nave and the Chancel. It has a
remarkable fine shrill tone, and is heard, it is said, three or four
miles off, if the wind be right. It is very antient, as appears both
from the form of the letters, and the name (of the donor, I suppose),
which is that in use before surnames were common. Perhaps it may
be as old as the fabrick of the church itself, though this is very
antient.
Fig. 2 is a stone head, near the roof on the North side of the
church.
In the East window of the church is a small Female Saint.
In this window, A. a fess Vaire G. and O. between three water-
bougets Sable. Dethick.
Cheque A. and G. on a bend S. a martlet. Beckering.
At the bottom of this window an inscription,
Rogero Cric.
Roger Criche was rector, and died 1413, and probably made the
window. He is buried within the rails of the communion-table, and
his slab is engraved in the second volume of Mr. Gough's "Sepulchral
Monuments of Great Britain," Plate XIX. p. 37. Nothing remains of
the inscription but Amen.
In the upper part of the South window of the Chancel, is a picture
in glass of our Saviour with the five Wounds; an angel at his left
hand sounding a trumpet[35].—On a pane of the upper tier of the
West window is the portrait of St. John; his right hand holding a
book with the Holy Lamb upon it: and the forefinger of his left hand
pointing to the Cross held by the Lamb, as uttering his well-known
confession: "Behold the Lamb of God, which taketh away the sin of
the world[35]."
In the South window of the Chancel is, Barry wavy of 6 A. and G.
a chief A. Ermine and Gules. Barley.
Ermine, on a chief indented G. or lozengé.
In the Easternmost South window of the nave is A. on a chevron
Sable, three quatrefoils Argent. Eyre.
This window has been renewed; before which there were other
coats and some effigies in it.
Jan. 1, 1793.
Samuel Pegge, Rector."

2. Whittington Rectory.
This View was taken also, in 1789, by Mr. Schnebbelie; and the
account of it drawn up in 1793 by Dr. Pegge, then resident in it, at
the advanced age of 88.
"The Parsonage-house at Whittington is a convenient substantial
stone building, and very sufficient for this small benefice. It was, as I
take it, erected by the Rev. Thomas Callice, one of my predecessors;
and, when I had been inducted, I enlarged it, by pulling down the
West end, making a cellar, a kitchen, a brew-house, and a pantry,
with chambers over them. There is a glebe of about 30 acres
belonging to it with a garden large enough for a family, and a small
orchard. The garden is remarkably pleasant in respect to its fine
views to the North, East, and South, with the Church to the West.
There is a fair prospect of Chesterfield Church, distant about two
miles and a half; and of Bolsover Castle to the West; and, on the
whole, this Rectorial house may be esteemed a very delightful
habitation.
S. Pegge."
In this Parsonage the Editor of the present Volume, accompanied
by his late excellent Friend Mr. Gough, spent many happy hours with
the worthy Rector for several successive years, and derived equal
information and pleasure from his instructive conversation.

Whittington Rectory.
Gent. Mag. Sep. 1810. Pl. II, p. 217.
Schnebbelie del.

3. The Revolution House.


To complete the little series of Views at Whittington more
immediately connected with Dr. Pegge, a third plate is here given,
from another Drawing by Mr. Schnebbelie, of the small public-house
at Whittington, which has been handed down to posterity for above
a century under the honourable appellation of "The Revolution
House." It obtained that name from the accidental meeting of two
noble personages, Thomas Osborne Earl of Danby, and William
Cavendish Earl of Devonshire, with a third person, Mr. John
D'Arcy[36], privately one morning, 1688, upon Whittington, Moor, as a
middle place between Chatsworth, Kniveton, and Aston, their
respective residences, to consult about the Revolution, then in
agitation[37]; but a shower of rain happening to fall, they removed to
the village for shelter, and finished their conversation at a public-
house there, the sign of The Cock and Pynot[38].
The part assigned to the Earl of Danby was, to surprize York; in
which he succeeded: after which, the Earl of Devonshire was to take
measures at Nottingham, where the Declaration for a free
Parliament, which he, at the head of a number of Gentlemen of
Derbyshire, had signed Nov. 28, 1688[39], was adopted by the
Nobility, Gentry, and Commonalty of the Northern Counties,
assembled there for the defence of the Laws, Religion, and
Properties[40].
The success of these measures is well known; and to the
concurrence of these Patriots with the proceedings in favour of the
Prince of Orange in the West, is this Nation indebted for the
establishment of her rights and liberties at the glorious Revolution.
The cottage here represented stands at the point where the road
from Chesterfield divides into two branches, to Sheffield and
Rotherham. The room where the Noblemen sat is 15 feet by 12 feet
10, and is to this day called The Plotting Parlour. The old armed
chair, still remaining in it, is shewn by the landlord with particular
satisfaction, as that in which it is said the Earl of Devonshire sat; and
he tells with equal pleasure, how it was visited by his descendants,
and the descendants of his associates, in the year 1788. Some new
rooms, for the better accommodation of customers, were added
about 20 years ago.
The Duke of Leeds' own account of his meeting the Earl of Devonshire and Mr.
John D'Arcy[41] at Whittington, in the County of Derby, A. D. 1688.

The Earl of Derby, afterwards Duke of Leeds, was impeached, A.D.


1678, of High Treason by the House of Commons, on a charge of
being in the French interest, and, in particular, of being Popishly
affected: many, both Peers and Commoners, were misled, and had
conceived an erroneous opinion concerning him and his political
conduct. This he has stated himself, in the Introduction to his
Letters, printed A. 1710, where he says, "That the malice of my
accusation did so manifestly appear in that article wherein I was
charged to be Popishly affected, that I dare swear there was not one
of my accusers that did then believe that article against me."

His Grace then proceeds, for the further clearing of himself, in


these memorable words, relative to the meeting at Whittington, the
subject of this memoir.
"The Duke of Devonshire also, when we were partners in the
secret trust about the Revolution, and who did meet me and Mr.
John D'Arcy, for that purpose, at a town called Whittington, in
Derbyshire, did, in the presence of the said Mr. D'Arcy, make a
voluntary acknowledgment of the great mistakes he had been led
into about me; and said, that both he, and most others, were
entirely convinced of their error. And he came to Sir Henry
Goodrick's house in Yorkshire purposely to meet me there again, in
order to concert the times and methods by which he should act at
Nottingham (which was to be his post), and one at York (which was
to be mine); and we agreed, that I should first attempt to surprize
York, because there was a small garrison with a Governor there;
whereas Nottingham was but an open town, and might give an
alarm to York, if he should appear in arms before I had made my
attempt upon York; which was done accordingly[42]; but is mistaken
in divers relations of it. And I am confident that Duke (had he been
now alive) would have thanked nobody for putting his prosecution of
me amongst the glorious actions of his life."

Celebration of the Revolution Jubilee, at Whittington and Chesterfield, on the


4th and 5th of November, 1788.

On Tuesday the 4th instant, the Committee appointed to conduct


the Jubilee had a previous meeting, and dined together at the
Revolution House in Whittington. His Grace the Duke of Devonshire,
Lord Stamford, Lord George and Lord John Cavendish, with several
neighbouring Gentlemen, were present. After dinner a subscription
was opened for the erecting of a Monumental Column, in
Commemoration of the Glorious Revolution, on that spot where the
Earls of Devonshire and Danby, Lord Delamere, and Mr. John D'Arcy,
met to concert measures which were eminently instrumental in
rescuing the Liberties of their Country from perdition. As this
Monument is intended to be not less a mark of public Gratitude, than
the memorial of an important event; it was requested, that the
present Representatives of the above-mentioned families would
excuse their not being permitted to join in the expence.
On the 5th, at eleven in the morning, the commemoration
commenced with divine service at Whittington Church. The Rev. Mr.
Pegge, the Rector of the Parish, delivered an excellent Sermon from
the words "This is the day, &c." Though of a great age, having that
very morning entered his 85th year, he spoke with a spirit which
seemed to be derived from the occasion, his sentiments were
pertinent, well arranged, and his expression animated.
The descendants of the illustrious houses of Cavendish, Osborne,
Boothe, and Darcy (for the venerable Duke of Leeds, whose age
would not allow him to attend, had sent his two grandsons, in whom
the blood of Osborne and D'Arcy is united); a numerous and
powerful gentry; a wealthy and respectable yeomanry; a hardy, yet
decent and attentive peasantry; whose intelligent countenances
shewed that they understood, and would be firm to preserve that
blessing, for which they were assembled to return thanks to
Almighty God, presented a truly solemn spectacle, and to the eye of
a philosopher the most interesting that can be imagined.
After service the company went in succession to view the old
house, and the room called by the Anti-revolutionists "The Plotting-
Parlour," with the old armed-chair in which the Earl of Devonshire is
said to have sitten, and every one was then pleased to partake of a
very elegant cold collation, which was prepared in the new rooms
annexed to the cottage. Some time being spent in this, the
procession began:
Constables with long staves, two and two.
The Eight Clubs, four and four; viz.

1. Mr. Deakin's: Flag, blue, with orange fringe, on it the figure of Liberty, the
motto, "The Protestant Religion, and the Liberties of England, we will
maintain."
2. Mr. Bluett's: Flag, blue, fringed with orange, motto, "Libertas; quæ sera,
tamen respexit inertem." Underneath the figure of Liberty crowning
Britannia with a wreath of laurels, who is represented sitting on a Lion,
at her feet the Cornucopiæ of Plenty; at the top next the pole, a Castle,
emblematical of the house where the club is kept; on the lower side of
the flag Liberty holding a Cap and resting on the Cavendish arms.
3. Mr. Ostliff's: Flag, broad blue and orange stripe, with orange fringe; in the
middle the Cavendish arms; motto as No. 1.
4. Mrs. Barber's: Flag, garter blue and orange quarter'd, with white fringe,
mottoes, "Liberty secured." "The Glorious Revolution 1688."
5. Mr. Valentine Wilkinson's: Flag, blue with orange fringe, in the middle the
figure of Liberty; motto as No. 1.
6. Mr. Stubbs: Flag, blue with orange fringe, motto, "Liberty, Property, Trade,
Manufactures;" at the top a head of King William crowned with laurel, in
the middle in a large oval, "Revolution 1688." On one side the Cap of
Liberty, on the other the figure of Britannia; on the opposite side the flag
of the Devonshire arms.
Mrs. Ollerenshaw's: Flag, blue with orange fringe; motto as No. 1. on both
sides.
Mr. Marsingale's: Flag, blue with orange fringe; at the top the motto, "In
Memory of the Glorious Assertors of British Freedom 1688," beneath, the
figure of Liberty leaning on a shield, on which is inscribed, "Revolted
from Tyranny at Whittington 1688;" and having in her hand a scroll with
the words "Bill of Rights" underneath a head of King William the Third;
on the other side the flag, the motto, "The Glorious Revolter from
Tyranny 1688" underneath the Devonshire arms; at the bottom the
following inscription, "Willielmus Dux Devon. Bonorum Principum Fidelis
Subditus; Inimicus et Invisus Tyrannis."
The Members of the Clubs were estimated 2000
persons, each having a white wand in his hand
with blue and orange tops and favours, with
the Revolution stamped upon them.

The Derbyshire militia's band of music.


The Corporation of Chesterfield in their formalities,
who joined the procession on entering the town.

The Duke of Devonshire in his coach and six.

Attendants on horseback with four led horses.

The Earl of Stamford in his post chaise and four.

Attendants on horseback.

The Earl of Danby and Lord Francis Osborne in their


post-chaise and four.

Attendants on horseback.

Lord George Cavendish in his post-chaise and four.

Attendants on horseback.

Lord John Cavendish in his post-chaise and four.


Attendants on horseback.

Sir Francis Molyneux and Sir Henry Hunloke, Barts.


in Sir Henry's coach and six.

Attendants on horseback.

And upwards of forty other carriages of the neighbouring


gentry, with their attendants.

Gentlemen on horseback, three and three.

Servants on horseback, ditto.


The procession in the town of Chesterfield went along Holywell-
Street, Saltergate, Glumangate, then to the left along the upper side
of the Market-place to Mr. Wilkinson's house, down the street past
the Mayor's house, along the lower side of the Market-place to the
end of the West Barrs, from thence past Dr. Milnes's house to the
Castle, where the Derbyshire band of music formed in the centre
and played "Rule Britannia," "God save the King, &c." the Clubs and
Corporation still proceeding in the same order to the Mayor's and
then dispersed.
Revolution House at Whittington.
Gent. Mag. Suppl. to Vol. LXXX. Part II, p. 609.
Schnebbelie del.
The whole was conducted with order and regularity, for
notwithstanding there were fifty carriages, 400 gentlemen on
horseback, and an astonishing throng of spectators, not an accident
happened. All was joy and gladness, without a single burst of unruly
tumult and uproar. The approving eye of Heaven shed its auspicious
beams, and blessed this happy day with more than common
splendour.
The company was so numerous as scarcely to be accommodated
at the three principal inns. It would be a piece of injustice not to
mention the dinner at the Castle, which was served in a style of
unusual elegance.
The following toasts were afterwards given:
1. The King.
2. The glorious and immortal Memory of King William the IIId.
3. The Memory of the Glorious Revolution.
4. The Memory of those Friends to their Country, who, at the
risk of their lives and fortunes, were instrumental in effecting
the Glorious Revolution in 1688.
5. The Law of the Land.
6. The Prince of Wales.
7. The Queen, and the rest of the Royal Family.
8. Prosperity to the British Empire.
9. The Duke of Leeds, and prosperity to the House of Osborne.
10. The Duke of Devonshire, and prosperity to the House of
Cavendish.
11. The Earl of Stamford, and prosperity to the united House of
Boothe and Grey.
12. The Earl of Danby, and prosperity to the united House of
Osborne and Darcy.
13. All the Friends of the Revolution met this year to
commemorate that glorious Event.
14. The Dke of Portland.
15. Prosperity to the County of Derby.
16. The Members for the County.
17. The Members for the Borough of Derby.
18. The Duchess of Devonshire, &c.

In the evening a brilliant exhibition of fireworks was played off,


under the direction of Signor Pietro; during which the populace were
regaled with a proper distribution of liquor. The day concluded with a
ball, at which were present near 300 gentlemen and ladies; amongst
whom were many persons of distinction. The Duchess of
Devonshire, surrounded by the bloom of the Derbyshire hills, is a
picture not to be pourtrayed. Near 250 ball-tickets were received at
the door.
The warm expression of gratitude and affection sparkling in every
eye, must have excited in the breasts of those noble personages,
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookname.com

You might also like