(Ebook) Introductory Programs with the 32-bit PIC Microcontroller: A Line-by-Line Code Analysis and Reference Guide for Embedded Programming in C (Maker Innovations Series) by Hubert Ward ISBN 9781484290514, 9781484290507, 1484290518, 148429050X - The ebook is available for quick download, easy access to content
(Ebook) Introductory Programs with the 32-bit PIC Microcontroller: A Line-by-Line Code Analysis and Reference Guide for Embedded Programming in C (Maker Innovations Series) by Hubert Ward ISBN 9781484290514, 9781484290507, 1484290518, 148429050X - The ebook is available for quick download, easy access to content
com
OR CLICK BUTTON
DOWLOAD EBOOK
(Ebook) Introductory Programs with the 32-bit PIC Microcontroller by Hubert Ward
ISBN 9781484290514, 1484290518
https://ebooknice.com/product/introductory-programs-with-the-32-bit-pic-
microcontroller-50009494
ebooknice.com
(Ebook) Programming Arduino Projects with the PIC Microcontroller: A Line-By Line
Code Analysis and Complete Reference Guide for Embedded Programming in C by Hubert
Henry Ward ISBN 9781484272299, 1484272293
https://ebooknice.com/product/programming-arduino-projects-with-the-pic-
microcontroller-a-line-by-line-code-analysis-and-complete-reference-guide-for-
embedded-programming-in-c-34873434
ebooknice.com
https://ebooknice.com/product/intermediate-c-programming-for-the-pic-
microcontroller-simplifying-embedded-programming-22417478
ebooknice.com
(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
ebooknice.com
(Ebook) C Programming for the PIC Microcontroller. by kan
https://ebooknice.com/product/c-programming-for-the-pic-microcontroller-50195818
ebooknice.com
(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans Heikne, Sanna
Bodemyr ISBN 9789127456600, 9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312
ebooknice.com
(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success) by Peterson's
ISBN 9780768906677, 0768906679
https://ebooknice.com/product/sat-ii-success-math-1c-and-2c-2002-peterson-s-sat-
ii-success-1722018
ebooknice.com
(Ebook) Advanced PIC Microcontroller Projects in C: From USB to ZIGBEE with the PIC
18F Series by Dogan Ibrahim ISBN 9780750689823, 075068982X
https://ebooknice.com/product/advanced-pic-microcontroller-projects-in-c-from-
usb-to-zigbee-with-the-pic-18f-series-1123344
ebooknice.com
https://ebooknice.com/product/programming-8-bit-pic-microcontrollers-in-c-with-
interactive-hardware-simulation-2530310
ebooknice.com
Hubert Ward
This work is subject to copyright. All rights are solely and exclusively
licensed by the Publisher, whether the whole or part of the material is
concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in
any other physical way, and transmission or information storage and
retrieval, electronic adaptation, computer software, or by similar or
dissimilar methodology now known or hereafter developed.
The publisher, the authors, and the editors are safe to assume that the
advice and information in this book are believed to be true and accurate
at the date of publication. Neither the publisher nor the authors or the
editors give a warranty, expressed or implied, with respect to the
material contained herein or for any errors or omissions that may have
been made. The publisher remains neutral with regard to jurisdictional
claims in published maps and institutional affiliations.
Prerequisites
As to any prerequisites you need before reading this book, there are
none. I will assume you are a complete novice, and I will explain every
step as you progress through the book. Every instruction will be
analyzed to explain how the C instruction works and how it achieves
what we want from the instructions. The only things you will definitely
need to use this book are as follows.
MPLAB X
This is the IDE, integrated development environment, from Microchip. I
will be using versions 5.25 and 5.40, but any version from 2.2 will be
fine as there will be only some minor differences. Also, as I know
Microchip is constantly updating its IDE, I am confident that the
changes will only be minor. This means the procedures for the IDE that
you will learn from this book will still stand you in good stead for any
later versions of the IDE.
Compiler Software
You will need a 32-bit compiler software to compile your programs
within MPLAB X. I use v2.41, although for a lot of my programs, I use
the older version 1.32, as the newer versions have some of the libraries
missing.
MPLAB X and the compiler software are freely available from the
Microchip website. You may have to search the archive section for some
of the older compiler versions. You could upgrade to the paid version of
the compiler software, but I have not done that for any of my programs.
If you were to make a career in embedded programming, then the paid
version of the compiler may have some advantages, such as more
efficient code that uses less memory.
Simulation Software
MPLAB X does come with a simulation option for its PICs. This does
mean that you can try some of the programs without spending any
money on equipment. However, the simulation capabilities are not very
extensive, and they are used more for debugging your programs. I will
take you through using the simulation option within MPLAB X for some
of the programs in the book, but most will be carried out on the
explorer 16 development board. However, simulating the programs will
give you a chance to see if you can enjoy programming these PICs. It is
not just about making money, as you will earn more if you enjoy what
you do.
There are some ECAD (electronic computer-aided design) software
that you can use to simulate the programs. PROTEUS is one that I have
used for 8-bit PICs. Multisim is another one, but you must make sure
that it can support the PICs you want to use, and they are not free.
MPLAB Harmony
Microchip has invested a lot of time and money in creating its
programming environment named MPLAB Harmony. It is aimed at
saving a lot of time in developing PIC programs. If you just want to get
something working and are not really interested in learning how it
works, then this environment can be useful. However, be aware that
once you go down that route, you can become dependent upon the
environment, as you are not really learning how the programs work.
That’s great for Microchip but not for you. I believe this approach is
counterproductive, as it does far too much for you and doesn’t explain
how it works. If you really want to become a versatile and productive
programmer, then you need to really understand how every bit of your
program works. Only then can you really say you wrote it and not just
cobbled together bits of code that you don’t understand. My main aim
in writing this book is to show that it is not too difficult to learn how to
program these PICs yourself. If you learn how PICs work and how we
can write C instructions to make them do what we want, then you will
become that versatile and experienced programmer that will find an
exciting and useful career as an embedded programmer.
Why am I writing this book and not working as that embedded
programmer? Well, really, I ventured into programming PICs a bit too
late in my life. I have been in education, teaching electrical and
electronic engineering at HND level, for over 25 years. So now I am
ready to retire and concentrate on trying to pass my knowledge and
experience onto you younger guys. I hope that in reading this book, you
will learn enough to become that versatile and productive embedded
programmer.
This is a very useful board that has the following peripheral devices:
An LCD, Liquid Crystal Display
A variable resistor to provide an analog input
Four switches connected to four inputs
Eight LEDs connected to PORTA
A 25LC256 256k serial EEPROM
A TC1074A temperature sensor
These are just a few of the devices that are available to you on the
explorer board. All these make the board a very useful addition to your
embedded programming equipment. This can easily justify the cost of
around £100.
You will need a programming tool to download your programs from
MPLAB X to your PIC. There are a couple of tools that you can use, such
as
ICD3 can that I use but Microchip has now stopped supplying this.
Instead, they supply the ICD4 can. However, this is quite expensive at
around £210.
The PICKIT3 is a much cheaper device at around £30; however,
Microchip has now moved on to the PICKIT4 programmer which they
sell for around £70.
You can buy plugin boards to help expand the explorer board. One
such plugin board is shown in Figure 3. You will see that I use this
extensively in my book.
You could be spending around £250 plus, but you should find it a
useful investment as you can earn a high rate of pay as an embedded
programmer. There are cheaper tools you can use, but I can only write
about the ones I have used.
There are many other programming environments, but I know these
that I have shown you work and work well. Indeed, I have used my
explorer boards, with the plugin expansion slot, to control a
sophisticated industrial control system.
Some Important Aspects of C Programming
Before we move deep into the book, I think it would be useful to
mention some aspects of C programming that we will come across in
the analysis of the program listings.
The Main Loop
All C programs work in loops, usually more than one. However, all C
programs must have the “main” loop. It is to this main loop that the PIC
will go to find the very first instruction of the C program. All the other
loops are within this main loop or are called, as subroutines, from the
main loop.
Curly Brackets
C programming uses brackets to define the confines of these loops.
These are what I call “curly brackets,” that is, the opening curly bracket
“{“ and the closing curly bracket “}”. These are used to group a series of
instructions together. For example:
void main ()
{
instructions go here
}
Normal Brackets
The C programming also uses what I call “normal brackets,” that is, the
opening normal bracket “(“ and the closing normal bracket “)”. These
are used in conjunction with subroutines and subroutine calls.
We will look at these brackets as we analyze the programs in the
book.
Subroutines or Functions or Methods
Subroutines are sections of instructions that lie outside the main loop
of the program. They are used, primarily, to save memory, as if you want
the PIC to carry out a section of instructions in exactly the same way
more than once, then you should write them as a subroutine. Some
programmers may call these “functions” or “methods,” as they normally
carry out a function of some sort. I am an old hat at programming, and
so I call them subroutines.
Subroutines may or may not want values to be passed up to them
and send data back to the main loop of the program. To create a
subroutine, we use the general format as shown here:
keyword name of subroutine (request type of possible value to be
sent up)
The keyword is used to indicate what type of data the subroutine
will send back to the main program. If the subroutine will not send any
data back, which is the most common type of subroutine, then the
keyword would be “void.” However, if the subroutine will be sending
data back to the main program, then the keyword would indicate what
data type the data would be, for example:
unsigned char
int
For example: void delay250 (unsigned char t)
Note the use of the “normal brackets.”
This will create a subroutine that will not be sending data back to
the main program, that is, the keyword “void.” It will be expecting the
main program to pass up a value of the data type “unsigned char.” The
subroutine will copy that value into the local variable “t.”
When the main loop calls these subroutines, it is done using the
general format:
subroutine name (send any variables that the subroutine may
require)
For example: delay250(4);
This will call the subroutine called “delay250” and send the value
“4” to be copied into the subroutine’s local variable “t.”
Local and Global Variables
As I have mentioned the term local variable, I thought I should explain
what they are. C programming uses variables, which are newly created
memory locations, whose number of bits depends upon the data type
the variable will be, to store useful values that you will use in your
program. You should give the variable a suitable name that helps
explain what the variable is used for. However, we can use just simple
letters if we wanted to. C has two main types of variables:
Local variables: These are variables that are created when we create
a subroutine, and they are only valid for use in the subroutine they
were created in.
Global variables: These are variables that we create when we
construct the whole program. I usually list all the global variables at
the beginning of the program listing. These global variables can be
used anywhere within the program, that is, the main loop and any
subroutines, etc.
We will look more closely at these aspects of C programming as we
analyze the program listings.
Summary
In this introduction, we have looked at MPLAB X, the IDE from
Microchip, and the possible development boards you may have to buy. I
have tried to explain the aims of this book, and I have detailed some of
my experiences in the hope of convincing you I do know enough about
C programming for PIC micros.
In the first chapter, we will learn how to create a project in MPLAB
X. We will look at creating a header file, within MPLAB X, and use it in
our programs. This header file will look at how we use the
configuration words to set the clocks of the PIC and some other
important aspects of the PIC. I hope you will find this book useful and it
will help you get started on your career as an embedded programmer.
Table of Contents
Chapter 1:Creating Our First C Program
What Is MPLAB X
Creating a Project in MPLAB X
The Initial Comments
The Speed of the Clock
Writing the Configuration Words
Our First Program
Setting the PORTS
Exercise 1-1
The Hexadecimal Number System
The First Program Listing
Analysis of Listing 1-1
Simulating the Program in MPLAB X
Solution to Exercise 1-1
Summary
Chapter 2:Header Files and Delays
What Are Header Files and Why We Use Them?
Creating a Header File
Using the Header File
Slowing the PIC Down
Creating a Delay
The Variable Delay Subroutine
What Is a Subroutine
The Analysis of the Delay Subroutine
Creating a 1ms Delay
Good Programming Practice
The Algorithm
The Flowchart
Our First Useful Program
The Algorithm
The Allocation List
The Flowchart for the Program
Creating the Project
Analysis of Listing 2-3
Downloading the Program to a Prototype Board
Extending the Program to the Crossroads Traffic Lights
The Algorithm
Analysis of Listing 2-4
Simulating the Program Within MPLAB X
Summary
Chapter 3:The Seven-Segment Display
Controlling a Seven-Segment Display
The Seven-Segment Display
Common Anode Seven-Segment Display
Common Cathode Seven-Segment Display
Controlling the Display with the PIC
The Seven-Segment Display Program
The Algorithm
The Flowchart
The Listing for the Seven-Segment Display Program
Analysis of Listing 3-1
Improving the Seven-Segment Display Program
The Problem with the Program
Arrays
Using Pointers
Analysis of Listing 3-2
The Improved Program
Exercise 3-1
Solution to Exercise 3-1
Summary
Chapter 4:The LCD
The 1602 LCD
Instruction or Command Mode
Data Mode
The Control Pins of the LCD
The LCD Header File for PORTE
Analysis of Listing 4-1
Analysis of Listing 4-2
Creating Your Own Symbols to Display on the LCD
The Pixel Maps
The 8-Bit Binary Values for the Four Special Characters
The Program “Pixel to Matrix”
The Special Character Program
The Program Listing for the Special Character Program
Analysis of Listing 4-3
Summary
Chapter 5:The Dot Matrix Display
The 8 by 8 Dot Matrix Board
The Single Dot Matrix Display
The Max7219 Driver IC
Writing to the Max7219
Analysis of Listing 5-1
Creating the Data for Each Row in the Two-Dimensional Array
Controlling Four 64-Bit Dot Matrix Boards
Analysis of Listing 5-3
Analysis of Listing 5-2
A Program to Scroll Text on the Matrix Display
Summary
Chapter 6:Communication
The 25LC256 EEPROM
What Is an EEPROM Device
Writing to the EEPROM
Reading from the EEPROM
The Connections of the EEPROM on the Explorer 16
Development Board
The Algorithm for the EEPROM Program
Analysis of Listing 6-1
The Setting of the CKE and CKP Bits
The Message “Ann Ward”
Using the Parallel Master Port
The Data for the PMMODE Control Register
The PMCON Control Register
The PMAEN Control Register
Analysis of Listing 6-2
Analysis of Listing 6-3
Summary
Chapter 7: The I2C Communication
The I2C Protocol
I2C Communication Protocol
Writing to the Slave
The Start Bit
The Address Bits and Control Bit in the First Byte
The Acknowledgment Bit
The Data Byte
The Stop Bit
Reading from the Slave
The NACK or Not Acknowledgment Bit
Analysis of the I2C Protocol Header File
The I2C Expander Module
The LCD2004
The Connections of the I2C Expander
Analysis of Listing 7-2
The Program to Use the I2C Expander to Control the LCD2004
Analysis of Listing 7-3
Summary
Chapter 8:Interrupts
Interrupts
The Fetch and Execute Cycle
The Program Counter or “PC”
Single Vectored Interrupts
Multivectored Interrupts
How Does the PIC Keep Track of Where It Must Go and
Where It Must Get Back To?
The Stack and Its Main Use
The Sources of Interrupts in a 32-Bit PIC
Analysis of Listing 8-1
Using More Than One Interrupt Source with Single Vector Mode
Analysis of Listing 8-2
Interrupt Priority
Multivectored Interrupts with Priority
Analysis of Listing 8-3
Summary
Chapter 9:The Real-Time Clock
The External Crystal 32.768kHz Oscillator
The 24-Hour LCD Clock Program
Analysis of Listing 9-1
The TM1637 and the Four Seven-Segment Displays
The TM1637 Driver IC
Analysis of Listing 9-2
Summary
Chapter 10:The Real-Time Clock and the DS3231
The DS3231 RTC Module
The Order the DS3231 Expects the Data
The Program Algorithm
Displaying the Temperature
Binary Numbers
Adding Binary Numbers
Reading the Temperature from the TC72
Examples of the Two’s Complement Process
Using the UART and a Terminal Software
Using the Alarms of the DS3231
The UART
The UxMODE Control Register
The UxSTA Register
Using Tera Term
Connecting the Devices to the PIC32
Analysis of Listing 10-1
Summary
Chapter 11:The RTCC Module
The RTCC Module of the 32-Bit PIC
BCD (Binary-Coded Decimal)
Displaying the 32-Bit Value on the LCD
RTCC Module Program
Analysis of Listing 11-1
Understanding Instruction on Line 504 RTCALRM =0x8403;
Summary
Chapter 12:The Real Analog World
The Real-World Signals
An Analog Signal
The Digital World
A Simple Voltmeter Program
The Algorithm of the Voltmeter Program
Analysis of Listing 12-1
The ADC Process
The Acquisition Time
The 4–20mA Transducer
Controlling Two Analog Inputs
Analysis of Listing 12-2
Summary
Chapter 13:The DHT11 Transducer
The DHT11 Humidity and Temperature Sensor
Communicating with the DHT11
The Use of a Pull-Up Resistor
The DHT11 Program Listing
Analysis of Listing 13-1
The Logical OR and AND Truth Tables
A Design Procedure
Know the Events You Want to Control
Analysis of Listing 13-2
Simulating the Program in MPLAB X
Summary
Chapter 14:Creating a Square Wave
Creating a Simple Square Wave
Using the Output Compare Module (OCMP) of the PIC32
Using the Logic Analyzer Within MPLAB X
Creating Some Musical Notes
Creating a PWM Square Wave with the OC1MP Module
The Average of a Square Wave
Analysis of Listing 14-4
Varying the Brightness of a Lamp
Analysis of Listing 14-5
Summary
Appendix
Appendix 1:Data Types
Appendix 2:Some Useful Definitions
Appendix 3:Mathematical and Logic Operators
Appendix 4:Keywords
Appendix 5:Numbering Systems Within Microprocessor-Based
Systems
Appendix 6:The ASCII Character Set
Appendix 7:The LCD Instruction Set
Index
About the Author
Hubert Ward
has nearly 25 years of experience as a college lecturer delivering the
BTEC, and now Pearson’s, Higher National Certificate and Higher
Diploma in Electrical and Electronic Engineering. Hubert has a 2.1
Honors Bachelor’s Degree in Electrical and Electronic Engineering.
Hubert has also worked as a consultant in embedded programming. His
work has established his expertise in the assembler and C
programming languages, within the MPLAB X IDE from Microchip, as
well as designing electronic circuits and PCBs using ECAD software.
Hubert was also the UK technical expert in Mechatronics for three
years, training the UK team and taking them to enter in the Skills
Olympics in Seoul 2001, resulting in one of the best outcomes to date
for the UK in Mechatronics.
About the Technical Reviewer
Mike McRoberts
is the author of Beginning Arduino by Apress. He is the winner of Pi
Wars 2018 and a member of Medway Makers. He is an Arduino and
Raspberry Pi enthusiast.
© The Author(s), under exclusive license to APress Media, LLC, part of Springer
Nature 2023
H. Ward, Introductory Programs with the 32-bit PIC Microcontroller
https://doi.org/10.1007/978-1-4842-9051-4_1
In this chapter, we will study the process of creating a project for the
32-bit PIC within Microchip’s IDE, MPLAB X. We will study the
important aspect of creating a clock for the PIC. Then we will create our
first program that will look at the ports and learn how to set the
direction of data through the ports. We will then write a simple
program to light an LED and simulate it within MPLAB X.
After reading this chapter, you will have studied how to create a
project in MPLAB X. You will also have a good understanding of the
configuration words and how we can control the ports, so that we can
write our first simple program.
You will also have used the simulation in MPLAB X to confirm our
first program works correctly.
What Is MPLAB X
MPLAB X is Microchip’s IDE, integrated development environment. It is
a collection of programs designed to make the development of
programs for the PIC microcontrollers an easy and enjoyable process. It
uses a dedicated text editor that has coloring for keywords and uses an
IntelliSense that works like predictive text on a mobile phone. It has a
range of debugging tools that aid the debugging of your programs. It
also has a simulation software that allows you to simulate most of your
PIC programs. All this and the required compilers are freely available
from the Microchip website.
Creating a Project in MPLAB X
Assuming you have downloaded the software and the compiler, you
simply click the mouse on the following icon to start the program.
Once the software has started, the opening screen, shown in Figure 1-1,
should appear.
You should appreciate that when you create a project, a new folder
will be created on your hard drive, where all the files and directories for
the project will be stored.
To create a new project, simply click the word “File” in the main
menu, and then select “New Project” from the fly-out menu that
appears. An alternative approach would be to click the mouse on the
small orange box with the green cross in it, which is the second item
from the left on the second menu bar. The “Choose Project” window
shown in Figure 1-2 should appear.
The display will now show the configuration bits in the bottom half
of the editing window. This is shown in Figure 1-15.
You can now make the changes that we need as follows:
Change the second option FPLLIDIV, the input divider to the phase
lock loop, to DIV_2.
Change the third option FPLLMUL, the PLL multiplier, to MUL_18.
Change the fourth option FPLLODIV, the PLL output divider, to DIV_1.
Next, change the FNOSC option to PRIPLL, primary oscillator with
phase lock loop. This tells the PIC that we will be passing the
oscillator through the phase lock loop circuit.
Next, change the FSOCEN, the secondary oscillator enable bit, to off
to disable the secondary oscillator.
Next, change the IESO to off to disable the two-speed startup.
Next, set the POSCMOD, the primary oscillator mode, to XT. This is
because the 8MHz external crystal is less than 10MHz which is within
the XT range of frequencies.
Next, set the FPBDIV, the frequency of the peripheral bus divider, to
DIV_2. This is to reduce the frequency of the peripheral bus to
36MHz.
Change the FWDTEN to off. The WDT is the Watch Dog Timer which
will stop the program if nothing happens for a set period of time. This
is really used in production lines, and we don’t need this for our
programs, so we must turn it off.
This is displayed in the editing window as shown in Figure 1-15.
Note the changes will be highlighted in blue.
The changes are ready, but they will not take place until we have
written the source code into the program. This can be done by clicking
the mouse on the tab at the bottom of the window labeled “Generate
Source Code to Output.” When you do this, the source code for these
changes will appear in the output window. This is shown in Figure 1-
16.
Figure 1-16 The Source Code for the Changes to the Configuration Bits
You then need to select all the text, including the “#include <xc.h>”,
in that window and copy it into your program in the editing window.
Your screen should now look something like that shown in Figure 1-
17.
Figure 1-17 The Code Pasted into the Editing Window
Note, I have copied everything including the #include <xc.h>, the
last line in the code. I will explain the importance of this #include
option later.
There are a lot of changes we are making to the configuration bits.
We will make the same changes for all the projects we will create in the
book. This is because we will be using the explorer 16 development
board for all our programs. That being the case, it will be easier if we
create a header file for this. We will do this in Chapter 2, where we will
discuss the importance of header files.
‘When we drew towards the conflux of the river Thames there were
two objects that attracted our notice: the one, the King’s guardship,
placed there for the purposes of good œconomy, the other a large
painted vessel which floated on the surface of the water, and is
called a buoy. While we were passing the king’s ship, I heard the
report of a cannon, and saw the flash of the charge at some
distance; and, on inquiring the reason of such a circumstance, was
informed it was customary for every ship which passed, by way of
obedience, to lower her topsail; but the firing of the gun made them
hasten to show their obedience, for fear of a more unfavourable
salute; for, though a flash of powder might give us some alarm, the
discharge of a ball might make us feel the effects of disobedience....
Hitherto the generality of our company appeared to carry jollity and
mirth in their countenances; but now we began to see the blushing
rose die in the sickly cheek, and several of our passengers began to
feel the sickening effects of the rolling sea; they withdrew from their
mirth, and in pleasure crept into a corner, and silently mourned their
lost pleasures in solitude.... Thrice happy the souls who are by divine
grace made sick of unsatisfying delights, and compelled to withdraw
from unsatisfying objects, and seek and find permanent bliss in the
friendship of Immanuel!
‘About ten o’clock on Friday night we were brought safely into the
harbour of Margate, and then cast anchor in order to set a great
number of our passengers on shore, who were bound for that place
of rendezvous. How great are the advantages of navigation! By the
skill and care of three men and a boy, a number of persons were in
safety conveyed from one part to another of the kingdom....
‘By six in the morning we went on shore, and joyfully met our
friends, who were brought down the day before; but in their passage
were overtaken by a violent storm of thunder and lightning, whilst
our voyage was smooth and prosperous; but, in the morning, we all
met in peace and safety. Thus we sat down to a friendly breakfast,
and cheerfully talked over the adventures of the little voyage.
Something like this, I think, may take place in the state of
blessedness.... While we were thus employed, we consulted how to
dispose of ourselves while we continued at Ramsgate; we mutually
agreed to form ourselves into a little family, and though we could not
all lodge, yet we wished to board together in the same house.’ This
is a pleasing instance of bonne camaraderie engendered, in a short
time, among agreeable companions.
‘In order to pursue the design of our coming, some of our company
mixed among the bathers at the seaside. The convenience of
bathing, the coolness of a fine summer’s morning, the agreeable
appearance of company so early, and the novelty of the scene, had a
very pleasing effect.... We began to look around us; and though we
were not presented with objects of taste and elegance, yet the town
and environs afforded us some rural prospects, which yielded both
instruction and pleasure. Upon our left hand, as we ascended from
the sea-side, stands the seat of observation, erected on a point of
land, and commanding an extensive prospect over that part of the
sea called the Downs, where you behold a number of ships lying at
anchor, or on their passage to different parts of the world. From
thence you may likewise see the lofty cliffs of France, and
reverberating the light of the sun; while, at the same time, you may,
by way of amusement, watch the motions of every boat coming in
and going out of the harbour; and, as the sea is always varying, its
appearance altogether affords an agreeable amusement. Here the
Company frequently stop to rest themselves after a morning’s or an
evening’s walk, and are sweetly regaled by the cool refreshing
breezes of the sea....
It took them two days to get to Margate, and another day to reach
Gravesend. On their way they passed a vessel cast on shore, which
‘cut a dismal figure, such as they make, to an enlightened eye, who
make shipwreck of faith, whom Christians see, as they pursue their
course, run aground, and dash to pieces.’
‘I will likewise administer that which shall cure the worst of breaths,
provided the lungs be not totally perished and imposthumated; as
also certain and infallible remedies for those whose breaths are yet
untainted; so that nothing but either a very long sickness, or old age
itself, shall ever be able to spoil them.
‘I will, besides, (if it be desired) take away from their fatness who
have over much, and add flesh to those that want it, without the
least detriment to their constitutions.’
Then there was that arch quack and empiric, Sir Kenelm Digby, with
his ‘sympathetic powder,’ etc., and Dr. Saffold, originally a weaver,
who distributed his handbills broadcast, advertising his ability to cure
every disease under the sun.
Medicine in the last century was very crude. Bleeding and purging
were matters of course; but some of the remedies in the
pharmacopœia were very curious. Happy the patient who knew not
the composition of his dose. Take the following:92
‘Take a middle-sized viper, freed from head, skin, and intestines; and
two pints of water. Boil them to a pint and a half; then remove the
vessel from the fire; and when the liquor is grown cold, let the fat,
which congeals upon the surface, if the viper was fresh, be taken off.
Into this broth, whilst warm, put a pullet of a moderate size, drawn
and freed from the skin, and all the fat, but with the flesh intire. Set
the vessel on the fire again, that the liquor may boil; then remove it
from the fire, take out the chicken, and immediately chop its flesh
into little pieces: put these into the liquor again, set it over the fire,
and as soon as it boils up, pour out the broth, first carefully taking
off the scum.
‘Of this broth let the patient take half a pint every morning, at two of
the clock in the afternoon, and at supper-time.’
In the same book, also (p. 97), we find the following remedy for
cancer:
‘Take of live wood-lice, one ounce; fine sugar, two drams; a little
powder of nutmeg; and half a pint of alexeterial water. Let the
wood-lice and sugar, with the nutmeg, be ground together in a
marble mortar, then gradually add the water, which being well
mixed, strain it with hard pressing. Two ounces of this expression
are to be taken twice a day, shaking the vessel, so that no part of it
may be lost.’
And it also seems that much virtue was attached to the great
number of component parts in a medicine, as may be seen in the
recipe for Arquebusade Water93 (from the same book, p. 101).
‘Take of comfrey leaves and root, sage, mugwort, bugloss, each four
handfulls; betony, sanicle, ox-eye daisy, common daisy, greater
figwort, plantane, agrimony, vervain, wormwood, fennel, each two
handfulls; St. John’s wort, long birthwort, orpine, veronica, lesser
centaury, milfoil, tobacco, mouse-ear, mint, hyssop, each one
handfull; wine twenty-four pounds. Having cut and bruised the
herbs, pour on them the wine, and let them stand together, in
digestion, in horse dung, or any other equivalent heat, for three
days: afterwards distill in an alembic with a moderate fire.
‘This celebrated water has for some time been held in great esteem,
in contusions, for resolving coagulated blood, discussing the tumors
that arise on fractures and dislocations, for preventing the progress
of gangrenes, and cleansing and healing ulcers and wounds,
particularly gunshot wounds....’
‘Take two ounces of the worts that grow dangling to the hinder heels
of a stone horse,94 wash them in common water, then infuse them
in white wine all night, and afterwards let them be dried, and
reduced to powder. The dose is half a dram twice a day, in any
proper vehicle. A dram of Venice soap given twice a day, either in
pills, or dissolved in some proper liquor, is likewise said to cure a
Cancer.’
In the early part of the eighteenth century, the regular physicians
were very ignorant. Ward95 thus describes them, and, although his
language was coarse, he was a keen observer.
There was another who sold the Elixir Stomachum which was sold at
the various coffee-houses about town, and he complains thus: ‘☞
Garrowaye, the Apple-man at the Exchange, who had it of me, to
sell, for five or six years, I have lately found out, is Counterfeiting it,
and have removed mine from him; and what he now sells is a
Counterfeit sort, and not the Right, as was formerly Sold there.’
Nor did the sterner sex monopolise the profession of quackdom, for
‘At the Blew-Ball in Grays-Inn Lane, near Holborn Barrs, next Door to
a Tallow-Chandler, where you may see my Name upon a Board over
the Door, liveth Elizabeth Maris, the True German Gentlewoman
lately arrived.’ It seems that we were much indebted to Germany for
our quacks, for ‘At the Boot and Spatter dash,99 next Door but One
to the Vine Tavern, in Long-Acre, near Drury Lane, Liveth a German
Dr. and Surgeon, Who by the blessing of GOD on his great Pains,
Travels and Experience, hath had wonderful Success in the Cure of
the Diseases following,’ &c. There was also ‘Cornelius à Tilbourg,
Sworn Chirurgeon in Ordinary to K. Charles the II., to our late
Sovereign K. William, as also to Her present Majesty Queen Ann.’
A certain John Choke, whose motto was ‘Nothing without God,’ and
was ‘an approved Physician; and farther, Priviledged by his Majesty,’
advertised ‘an Arcane which I had in Germany, from the Famous and
most Learned Baptista Van Helmont, of worthy Memory (whose
Daughter I Wedded), and whose Prœscripts most Physicians follow.’
One quack blossomed forth in verse, and thus describes himself: ‘In
Cripplegate Parish, in Whitecross Street, almost at the farther End,
near Old Street (turning in by the sign of the Black Croe, in Goat
Alley, straightforward down three steps, at the sign of the Blew Ball),
liveth one of above Forty Years’ Experience, who with God’s Blessing
performeth these cures following:
‘To all that please to come, he will and can
Cure most Diseases incident to Man.
The Leprosie, the Cholic, and the Spleen,
And most Diseases common to be seen.
Although not cured by Quack Doctors’ proud,
And yet their Name doth ring and range aloud,
With Riches, and for Cures which others do,
Which they could not perform, and this is true.
This Doctor he performeth without doubt, }
The Ileak Passion, Scurvy, and the gout, }
Even to those the Hospitals turn out.’ }
Such ground as one did not cover, another did. Take, for instance,
the following: ‘In Surry-Street, in the Strand, at the Corner House
with a White-Balcony and Blue-Flower pots, liveth a Gentlewoman,
who
‘Hath a most excellent Wash to beautifie the Face, which cures all
Redness, Flushings, or Pimples. Takes off any Yellowness, Morpheu,
Sunburn, or Spots on the Skin, and takes away Wrinckles and
Driness, caused too often by Mercurial Poysonous Washes, rendring
the worst of Faces fair and tender, and preserves ’em so. You may
have from half a Crown to five Pound a Bottle. You may also have
Night Masks, Forehead Pieces, incomparable whitepots, and Red
Pomatum for the lips, which keeps them all the Year plump and
smooth, and of a delicate natural colour. She has an admirable Paste
to smooth and whiten the Hands, with a very good Tooth powder,
which cleanses and whitens the Teeth. And a Water to wash the
Mouth, which prevents the Scurvy in the Gums and cures where ’tis
already come.
‘You may have a Plaster and Water which takes off Hair from any
part of the Body, so that it shall never come again. She has also a
most excellent Secret to prevent the Hair from falling, causing it to
grow where it is wanting in any part of the Head. She also shapes
the Eye-brows, making them perfectly beautiful, without any pain,
and raises low Foreheads as high as you please. And colours Grey or
Red Hair to a lovely Brown, which never decays, changes, or smoots
the Linnen. She has excellent Cosmeticks to anoint the Face after
the Small Pox, which wears out any Scars, Marks, or Redness; and
has great skill in all manner of sore Eyes.
‘She has a most excellent Dyet Drink which cures the worst of
Consumptions, or any Impurity of the Blood: And an Antiscorbutick
spirit, which, being taken one spoonful in the Morning, and another
at Night, with moderate Exercise, cures the Scurvy, tho’ never so far
gone, and all broke out in Blotches: with many other Secrets in
Physick, which you may be satisfied in when you speak with her....
She has an approved Remedy for Barrenness in Women.’
Very late in the preceding century (he died May 12, 1691), there was
a most famous quack, Dr. Thomas Saffold, one of whose handbills I
give as a curiosity:
‘Dear Friends, let your Disease be what God will,
Pray to Him for a Cure—try Saffold’s Skill,
Who may be such a healing Instrument
As will Cure you to your own Heart’s Content.
His Medicines are Cheap, and truly Good,
Being full as safe as your daily Food.
Saffold he can do what may be done, by
Either Physick or true Astrology:
His Best Pills, Rare Elixirs, and Powder,
Do each Day Praise him Lowder and Lowder.
Dear Country-men, I pray be you so Wise, }
When Men Back-bite him, believe not their Lyes, }
But go see him and believe your own Eyes; }
Then he will say you are Honest and Kind,
Try before you Judge, and Speak as you Find.
‘Lastly, He doth with great certainty and privacy: Resolve all manner
of Lawful Questions, according to the Rules of Christian Astrology,
and more than Twenty One Years’ Experience.’
Talk of modern quacks—they are but second-rate to Saffold! His
Pillulæ Londinenses, or London pills, were advertised that ‘not only
the meaner sort of all Ages and each Sex, but people of Eminence,
both for their Rank in the World and their parts, have found
admirable success in taking these Pills.’
Thomas Saffold knew well the value of advertising, and scattered his
very varied handbills broadcast. Presumably, like modern quacks, he
made money. Of course he died, and his epitaph is as follows (he
originally was a weaver):
‘Here lies the Corpse of Thomas Saffold,
By Death, in spite of Physick, baffled;
Who, leaving off his working loom,
Did learned doctor soon become.
To poetry he made pretence,
Too plain to any man’s own sense;
But he when living thought it sin
To hide his talent in napkin;
Now Death does Doctor (poet) crowd
Within the limits of a shroud.’
‘I asked him then for anything that had blood upon it; so he
presently sent for his garter, wherewith his hand was first bound,
and as I called for a basin of water, as if I would wash my hands, I
took a handful of powder of vitriol, which I had in my study, and
presently dissolved it. As soon as the bloody garter was brought me,
I put it in the basin, observing, in the interim, what Mr. Howell did,
who stood talking with a gentleman in a corner of my chamber, not
regarding at all what I was doing. He started suddenly, as if he had
found some strange alteration in himself. I asked him what he ailed.
‘“I know not what ails me; but I feel no more pain. Methinks that a
pleasing kind of freshness, as it were a wet cold napkin, did spread
over my hand, which hath taken away the inflammation that
tormented me before.”
‘I replied, “Since, then, you feel already so much good of my
medicament, I advise you to cast away all your plasters; only keep
the wound clean, and in a moderate temper, betwixt heat and cold.”
This may be taken as a sample of his cures, albeit his first; and,
although he excited the enmity of the licensed medical profession,
he seems to have cured the Countess of Conway of an inveterate
head-ache, which greatly enhanced his reputation. He died no one
knows when, but some time early in the century.
And in our time, too, have been the quacks, the Zouave Jacob and
Dr. Newton, who pretended to have the miraculous gift of healing by
the imposition of hands, so that we can scarcely wonder that, in an
age when the dissemination of accurate and scientific knowledge as
the present is (imperfect though it be), a man like Valentine
Greatraks was believed in as of almost divine authority at the period
at which he lived. But it is a very curious thing that some men either
imagine that they have, or feign to have a miraculous gift of healing.
Witness in our own day the ‘Peculiar People,’ who base their peculiar
gift of healing on a text from the Epistle of St. James, chap. 5, v. 14
—‘Is any sick among you? let him call upon the elders of the Church;
and let them pray over him, anointing him with oil in the name of
the Lord.’
With them, also, is a great function for the benediction of oil for
anointing the sick; the rubric for which is as follows:101 ‘In the
Celebration of the Holy Eucharist on a Week-day, immediately before
the elements are brought up and placed on the Altar, the Elder or
Elders present shall bring the vessel containing the oil to the Angel,
who shall present it uncovered upon the Altar; and then kneeling
down at the Altar, and the Elders kneeling down at the access to the
Sanctuary, the Angel shall say this Prayer of Benediction.’
But the Viennese are a practical race, and his failures to cure,
notably in one case, that of Mademoiselle Paradis (a singer), who
was blind, caused charges of deceit to be brought against him, and
he was told to leave Vienna at a day’s notice. He obeyed, and went
to Paris, where he set up a superb establishment, fitted up most
luxuriously. The novelty-loving Parisians soon visited him, and here,
in a dimly lit room, with pseudo-scientific apparatus to excite the
imagination, and a great deal of corporal manipulation, tending to
the same purpose, to the accompaniment of soft music or singing,
hysterical women went into convulsive fits, and laughed, sobbed,
and shrieked, according to their different temperaments.
Many cases are given in her book of the cures effected by this
benevolent couple; how the blind were made to see, the deaf to
hear, the lame to walk, or the dumb to speak—nay, could even cast
out devils—as the following testimonial will show.
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.
ebooknice.com