100% found this document useful (2 votes)
35 views

Introduction to Embedded Systems Using ANSI C and the Arduino Development Environment Synthesis Lectures on Digital Circuits and Systems 1st Edition Russell - The ebook with rich content is ready for you to download

The document provides information about a book titled 'Introduction to Embedded Systems Using ANSI C and the Arduino Development Environment' by David Russell, which focuses on teaching embedded software development using ANSI C for Arduino. It includes links to download the book and several other recommended ebooks related to embedded systems. The text aims to simplify the learning process for beginners by using the Arduino platform to teach fundamental methods for creating embedded software.

Uploaded by

dunjwaesoe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
35 views

Introduction to Embedded Systems Using ANSI C and the Arduino Development Environment Synthesis Lectures on Digital Circuits and Systems 1st Edition Russell - The ebook with rich content is ready for you to download

The document provides information about a book titled 'Introduction to Embedded Systems Using ANSI C and the Arduino Development Environment' by David Russell, which focuses on teaching embedded software development using ANSI C for Arduino. It includes links to download the book and several other recommended ebooks related to embedded systems. The text aims to simplify the learning process for beginners by using the Arduino platform to teach fundamental methods for creating embedded software.

Uploaded by

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

Download the full version and explore a variety of ebooks

or textbooks at https://ebookultra.com

Introduction to Embedded Systems Using ANSI C and


the Arduino Development Environment Synthesis
Lectures on Digital Circuits and Systems 1st
Edition Russell

_____ Follow the link below to get your download now _____

https://ebookultra.com/download/introduction-to-embedded-
systems-using-ansi-c-and-the-arduino-development-
environment-synthesis-lectures-on-digital-circuits-and-
systems-1st-edition-russell/

Access ebookultra.com now to download high-quality


ebooks or textbooks
Here are some recommended products for you. Click the link to
download, or explore more at ebookultra.com

Introduction to Embedded Systems A Cyber Physical Systems


Approach 1ST Edition E. A. Lee And S. A. Seshia

https://ebookultra.com/download/introduction-to-embedded-systems-a-
cyber-physical-systems-approach-1st-edition-e-a-lee-and-s-a-seshia/

Embedded Systems Handbook Second Edition Embedded Systems


Design and Verification Richard Zurawski

https://ebookultra.com/download/embedded-systems-handbook-second-
edition-embedded-systems-design-and-verification-richard-zurawski/

AVR Microcontroller and Embedded Systems Using Assembly


and C Pearson Custom Electronics Technology 1st Edition
Muhammad Ali Mazidi
https://ebookultra.com/download/avr-microcontroller-and-embedded-
systems-using-assembly-and-c-pearson-custom-electronics-
technology-1st-edition-muhammad-ali-mazidi/

Multi Core Embedded Systems Embedded Multi Core Systems


1st Edition Georgios Kornaros

https://ebookultra.com/download/multi-core-embedded-systems-embedded-
multi-core-systems-1st-edition-georgios-kornaros/
Digital Communication Systems Using SystemVue 1st Edition
Dennis Silage

https://ebookultra.com/download/digital-communication-systems-using-
systemvue-1st-edition-dennis-silage/

Java Software and Embedded Systems 1st Edition Mattis


Hayes

https://ebookultra.com/download/java-software-and-embedded-
systems-1st-edition-mattis-hayes/

Practical RF Circuit Design for Modern Wireless Systems


Active Circuits and Systems Gilmore

https://ebookultra.com/download/practical-rf-circuit-design-for-
modern-wireless-systems-active-circuits-and-systems-gilmore/

Embedded Systems Handbook 1st Edition Richard Zurawski

https://ebookultra.com/download/embedded-systems-handbook-1st-edition-
richard-zurawski/

Testing Complex and Embedded Systems 1st Edition Kim H.


Pries

https://ebookultra.com/download/testing-complex-and-embedded-
systems-1st-edition-kim-h-pries/
Introduction to Embedded Systems Using ANSI C and
the Arduino Development Environment Synthesis
Lectures on Digital Circuits and Systems 1st Edition
Russell Digital Instant Download
Author(s): Russell, David
ISBN(s): 9781608454983, 1608454983
Edition: 1
File Details: PDF, 1.67 MB
Year: 2010
Language: english
~ \ i \) I\ l;-\ '\ & ~ ·1 :\ Y I' l H) I I'll I\ I I\ II I I\\

Introduction to
Embedded Systems
Using ANSI C and the
Arduino Development Environment

David Russell
Introduction to
Embedded Systems
Using ANSI C and
the Arduino Development Environment
Copyright © 2010 by Morgan & Claypool

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in
any form or by any means—electronic, mechanical, photocopy, recording, or any other except for brief quotations in
printed reviews, without the prior permission of the publisher.

Introduction to Embedded Systems: Using ANSI C and the Arduino Development Environment
David J. Russell
www.morganclaypool.com

ISBN: 9781608454983 paperback


ISBN: 9781608454990 ebook

DOI 10.2200/S00291ED1V01Y201007DCS030

A Publication in the Morgan & Claypool Publishers series


SYNTHESIS LECTURES ON DIGITAL CIRCUITS AND SYSTEMS

Lecture #30
Series Editor: Mitchell A. Thornton, Southern Methodist University
Series ISSN
Synthesis Lectures on Digital Circuits and Systems
Print 1932-3166 Electronic 1932-3174
Synthesis Lectures on Digital
Circuits and Systems
Editor
Mitchell A. Thornton, Southern Methodist University
The Synthesis Lectures on Digital Circuits and Systems series is comprised of 50- to 100-page books
targeted for audience members with a wide-ranging background. The Lectures include topics that are
of interest to students, professionals, and researchers in the area of design and analysis of digital circuits
and systems. Each Lecture is self-contained and focuses on the background information required to
understand the subject matter and practical case studies that illustrate applications. The format of a
Lecture is structured such that each will be devoted to a specific topic in digital circuits and systems
rather than a larger overview of several topics such as that found in a comprehensive handbook. The
Lectures cover both well-established areas as well as newly developed or emerging material in digital
circuits and systems design and analysis.

Introduction to Embedded Systems: Using ANSI C and the Arduino Development


Environment
David J. Russell
2010

Arduino Microcontroller: Processing for Everyone! Part II


Steven F. Barrett
2010

Arduino Microcontroller Processing for Everyone! Part I


Steven F. Barrett
2010

Digital System Verification: A Combined Formal Methods and Simulation Framework


Lun Li and Mitchell A. Thornton
2010

Progress in Applications of Boolean Functions


Tsutomu Sasao and Jon T. Butler
2009

Embedded Systems Design with the Atmel AVR Microcontroller: Part II


Steven F. Barrett
2009
iv

Embedded Systems Design with the Atmel AVR Microcontroller: Part I


Steven F. Barrett
2009

Embedded Systems Interfacing for Engineers using the Freescale HCS08 Microcontroller II:
Digital and Analog Hardware Interfacing
Douglas H. Summerville
2009

Designing Asynchronous Circuits using NULL Convention Logic (NCL)


Scott C. Smith and Jia Di
2009

Embedded Systems Interfacing for Engineers using the Freescale HCS08 Microcontroller I:
Assembly Language Programming
Douglas H.Summerville
2009

Developing Embedded Software using DaVinci & OMAP Technology


B.I. (Raj) Pawate
2009

Mismatch and Noise in Modern IC Processes


Andrew Marshall
2009

Asynchronous Sequential Machine Design and Analysis: A Comprehensive Development of


the Design and Analysis of Clock-Independent State Machines and Systems
Richard F. Tinder
2009

An Introduction to Logic Circuit Testing


Parag K. Lala
2008

Pragmatic Power
William J. Eccles
2008

Multiple Valued Logic: Concepts and Representations


D. Michael Miller and Mitchell A. Thornton
2007

Finite State Machine Datapath Design, Optimization, and Implementation


Justin Davis and Robert Reese
2007
v
Atmel AVR Microcontroller Primer: Programming and Interfacing
Steven F. Barrett and Daniel J. Pack
2007

Pragmatic Logic
William J. Eccles
2007

PSpice for Filters and Transmission Lines


Paul Tobin
2007

PSpice for Digital Signal Processing


Paul Tobin
2007

PSpice for Analog Communications Engineering


Paul Tobin
2007

PSpice for Digital Communications Engineering


Paul Tobin
2007

PSpice for Circuit Theory and Electronic Devices


Paul Tobin
2007

Pragmatic Circuits: DC and Time Domain


William J. Eccles
2006

Pragmatic Circuits: Frequency Domain


William J. Eccles
2006

Pragmatic Circuits: Signals and Filters


William J. Eccles
2006

High-Speed Digital System Design


Justin Davis
2006
vi

Introduction to Logic Synthesis using Verilog HDL


Robert B.Reese and Mitchell A.Thornton
2006

Microcontrollers Fundamentals for Engineers and Scientists


Steven F. Barrett and Daniel J. Pack
2006
Introduction to
Embedded Systems
Using ANSI C and
the Arduino Development Environment

David J. Russell
University of Nebraska-Lincoln

SYNTHESIS LECTURES ON DIGITAL CIRCUITS AND SYSTEMS #30

M
&C Morgan & cLaypool publishers
ABSTRACT
Many electrical and computer engineering projects involve some kind of embedded system in which
a microcontroller sits at the center as the primary source of control. The recently-developed Arduino
development platform includes an inexpensive hardware development board hosting an eight-bit
ATMEL ATmega-family processor and a Java-based software-development environment. These
features allow an embedded systems beginner the ability to focus their attention on learning how to
write embedded software instead of wasting time overcoming the engineering CAD tools learning
curve.
The goal of this text is to introduce fundamental methods for creating embedded software in
general, with a focus on ANSI C. The Arduino development platform provides a great means for
accomplishing this task. As such, this work presents embedded software development using 100%
ANSI C for the Arduino’s ATmega328P processor. We deviate from using the Arduino-specific
Wiring libraries in an attempt to provide the most general embedded methods. In this way, the reader
will acquire essential knowledge necessary for work on future projects involving other processors.
Particular attention is paid to the notorious issue of using C pointers in order to gain direct access
to microprocessor registers, which ultimately allow control over all peripheral interfacing.

KEYWORDS
embedded systems, embedded software, embedded development, microcontroller, mi-
croprocessor, ANSI C, Arduino, ATmega328P
To my best friend Jamie
and our three wonderful kids:
Gates, Gracen, and Gavin
xi

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xix

1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Digital Representation of Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Digital Logic Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.4 Digital Vectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.5 Information Representation in a Digital Processor . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.1 Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.5.2 Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

2 ANSI C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Essential Elements of the Language . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.3 Formatted Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.4 Variables and Arithmetic Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.4.1 Variable Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.4.2 Type Conversions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4.3 Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
2.4.4 Arithmetic Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
2.4.5 Relational and Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.4.6 Increment and Decrement Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
2.4.7 Bitwise Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.4.8 Assignment Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
2.4.9 Conditional Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.5 Control Flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
2.5.1 If-Else . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.5.2 Else-If . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.5.3 Switch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.5.4 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
xii
2.5.5 Infinite Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
2.5.6 Miscellaneous (Please Don’t Use) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
2.6 Functions and Program Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.7 Scope Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
2.8 Pointers and Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.8.1 Passing by Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.8.2 Dynamic Memory Allocation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
2.9 Multi-dimensional Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
2.10 Function Pointers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
2.11 Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
2.11.1 Typedef . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
2.12 Unions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
2.13 Bit-fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
2.14 Variable-length Argument Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76

3 Introduction to Arduino . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.2 Experiments Using the Arduino Duemilanove Development Board . . . . . . . . . . . 80
3.3 Arduino Tools Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

4 Embedded Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4.2 Debugging the Arduino Tutorial . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89

5 ATmega328P Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
5.2 AVR CPU Core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96

6 General-Purpose Input/Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.1 Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.1.2 Basic Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
6.1.3 Pin-muxing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
6.2 Input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.2.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
6.2.2 Internal Pull-up Resistor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
xiii
6.3 Accessing GPIO lines in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.3.1 Managing Outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6.3.2 Managing Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106
6.4 Pertinent Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
6.4.1 PORTB - The Port B Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.4.2 DDRB - The Port B Data Direction Register . . . . . . . . . . . . . . . . . . . . . 108
6.4.3 PINB - The Port B Input Pins Address . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.4.4 PORTC - The Port C Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
6.4.5 DDRC - The Port C Data Direction Register . . . . . . . . . . . . . . . . . . . . . 108
6.4.6 PINC - The Port C Input Pins Address . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4.7 PORTD - The Port D Data Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
6.4.8 DDRD - The Port D Data Direction Register . . . . . . . . . . . . . . . . . . . . . 109
6.4.9 PIND - The Port D Input Pins Address . . . . . . . . . . . . . . . . . . . . . . . . . . 109

7 Timer Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115


7.1 Pulse Width Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
7.1.2 Demodulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
7.1.3 Modulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
7.2 Input Capture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.3 Pertinent Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
7.3.1 TCCR0A - Timer/Counter0 Control Register A . . . . . . . . . . . . . . . . . . 120
7.3.2 TCCR0B - Timer/Counter0 Control Register B . . . . . . . . . . . . . . . . . . . 122
7.3.3 TCNT0 - Timer/Counter0 Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.3.4 OCR0A - Output Compare0 Register A . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.3.5 OCR0B - Output Compare0 Register B . . . . . . . . . . . . . . . . . . . . . . . . . . 123
7.3.6 TCCR1A - Timer/Counter1 Control Register A . . . . . . . . . . . . . . . . . . 123
7.3.7 TCCR1B - Timer/Counter1 Control Register B . . . . . . . . . . . . . . . . . . . 125
7.3.8 TCCR1C - Timer/Counter1 Control Register C . . . . . . . . . . . . . . . . . . 126
7.3.9 TCNT1H and TCNT1L - Timer/Counter1 Register . . . . . . . . . . . . . . 127
7.3.10 OCR1AH and OCR1AL - Output Compare1 Register A . . . . . . . . . . 127
7.3.11 OCR1BH and OCR1BL - Output Compare1 Register B . . . . . . . . . . . 128
7.3.12 ICR1H and ICR1L - Input Capture1 Register . . . . . . . . . . . . . . . . . . . . 128
7.3.13 TCCR2A - Timer/Counter2 Control Register A . . . . . . . . . . . . . . . . . . 128
7.3.14 TCCR2B - Timer/Counter2 Control Register B . . . . . . . . . . . . . . . . . . . 130
7.3.15 TCNT2 - Timer/Counter2 Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7.3.16 OCR2A - Output Compare2 Register A . . . . . . . . . . . . . . . . . . . . . . . . . 132
xiv
7.3.17 OCR2B - Output Compare2 Register B . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.3.18 ASSR - Asynchronous Status Register . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
7.3.19 GTCCR - General Timer/Counter Control Register . . . . . . . . . . . . . . . 133

8 Analog Input Ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135


8.1 Analog-to-Digital Converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 135
8.1.1 ADC Peripheral . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
8.2 Analog Comparator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
8.3 Pertinent Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
8.3.1 ADMUX - ADC Multiplexer Selection Register . . . . . . . . . . . . . . . . . . 140
8.3.2 ADCSRA - ADC Control and Status Register A . . . . . . . . . . . . . . . . . . 142
8.3.3 ADCH and ADCL - ADC Data Register . . . . . . . . . . . . . . . . . . . . . . . . 143
8.3.4 ADCSRB - ADC Control and Status Register B . . . . . . . . . . . . . . . . . . 143
8.3.5 DIDR0 - Digital Input Disable Register 0 . . . . . . . . . . . . . . . . . . . . . . . . 144
8.3.6 ACSR - Analog Comparator Control and Status Register . . . . . . . . . . . 144
8.3.7 DIDR1 - Digital Input Disable Register 1 . . . . . . . . . . . . . . . . . . . . . . . . 145

9 Interrupt Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147


9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
9.1.1 Context . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148
9.1.2 ISR and Main Task Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
9.1.3 ATmega328P Interrupts in C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
9.2 Pertinent Register Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
9.2.1 EICRA - External Interrupt Control Register A . . . . . . . . . . . . . . . . . . . 154
9.2.2 EIMSK - External Interrupt Mask Register . . . . . . . . . . . . . . . . . . . . . . . 154
9.2.3 EIFR - External Interrupt Flag Register . . . . . . . . . . . . . . . . . . . . . . . . . . 155
9.2.4 PCICR - Pin Change Interrupt Control Register . . . . . . . . . . . . . . . . . . 155
9.2.5 PCIFR - Pin Change Interrupt Flag Register . . . . . . . . . . . . . . . . . . . . . 155
9.2.6 PCMSK2 - Pin Change Mask Register 2 . . . . . . . . . . . . . . . . . . . . . . . . . 156
9.2.7 PCMSK1 - Pin Change Mask Register 1 . . . . . . . . . . . . . . . . . . . . . . . . . 156
9.2.8 PCMSK0 - Pin Change Mask Register 0 . . . . . . . . . . . . . . . . . . . . . . . . . 156
9.2.9 TIMSK0 - Timer/Counter0 Interrupt Mask Register . . . . . . . . . . . . . . . 157
9.2.10 TIFR0 - Timer/Counter0 Interrupt Flag Register . . . . . . . . . . . . . . . . . . 157
9.2.11 TIMSK1 - Timer/Counter1 Interrupt Mask Register . . . . . . . . . . . . . . . 158
9.2.12 TIFR1 - Timer/Counter1 Interrupt Flag Register . . . . . . . . . . . . . . . . . . 159
9.2.13 TIMSK2 - Timer/Counter2 Interrupt Mask Register . . . . . . . . . . . . . . . 159
9.2.14 TIFR2 - Timer/Counter2 Interrupt Flag Register . . . . . . . . . . . . . . . . . . 160
Exploring the Variety of Random
Documents with Different Content
continuance in Sin the soul be subjected to wound after wound, and
its voice be never listened to, then finally it will die.
Fifth Sunday in Lent.
THE DEADLY VICES.
1. Certain Vices go by the name of Capital or Deadly Vices, because
they lie at the head or source of all sin; and because they mortally
affect the soul.
But they are not in themselves acts, but principles or springs out of
which sins issue.
They are reckoned as seven in number, but neither does Scripture
indicate this number, nor has the Church come to any decision on
this point. It is rather common sense, and common observation, that
have led to this classification, and it is a classification simple and
intelligible, and of practical use.
These seven Capital Vices are seven mothers who, when taken into
the heart, settle there, and produce large families of sins. They are
Vices, that is to say, they are dispositions towards evil, disordered
inclinations left in us by original sin, whence spring up in us, by the
consent of the will, large crops of bad actions, i.e., of sins. Vice is a
habitual disposition towards evil. Sin is the action produced by this
disposition when it has seduced the heart into giving consent to it.
Vice may exist without sin, and sin can exist without vice. That is to
say, there may be a vicious inclination which cannot manifest itself in
act, because the opportunity is wanting. A sin may be committed
without vicious inclination, out of carelessness, or against the
inclination which is towards good, through the weakness of the
nature and debility of the will.
Everyone has, more or less, the roots of vices in him, though in
some they are far stronger than in others, and in some individuals
certain vicious propensities are stronger than other vicious
propensities. One man may have a natural proclivity towards pride,
and this very inclination towards pride may neutralize in him the
inclination towards indolence.
2. The seven Capital Vices are:—
1. Pride. 2. Avarice. 3. Luxury. 4. Envy. 5. Gluttony. 6. Anger. 7.
Indolence.
Of these Pride, Avarice, and Envy, are vices of the soul; Luxury,
Gluttony, Anger, are vices of the body. Indolence is a vice of the soul
and of the body.
Of Pride it is said, “Everyone that is proud in heart is an abomination
to the Lord.” (Prov. xvi. 5.) “God resisteth the proud.” (James iv. 6.)
“The fear of the Lord is to hate evil; pride, and arrogancy, and the
evil way, and the froward mouth do I hate.” (Prov. viii. 13.)
Of Avarice it is said, “Know ye not that the unrighteous shall not
inherit the Kingdom of God,” and S. Paul says that among these are
“the covetous” who “shall not inherit the Kingdom of God.” (1 Cor. vi.
10.) “No covetous man, who is an idolater, hath any inheritance in
the Kingdom of Christ and of God.” (Eph. v. 5.) David speaks of “the
covetous, whom God abhorreth.” (Ps. x. 3.)
Of Luxury, there are many and strong denunciations in Scripture, it is
one of those conditions which, like avarice, shuts out from the
Kingdom of God. (1 Cor. vi. 10.) S. John saw the luxurious shut out
from the gates of the New Jerusalem. See also Gal. v. 19.
Of Gluttony, that is of indulgence to excess in eating and drinking,
the same is said. “The works of the flesh are manifest, which are
these—drunkenness, revellings, and such like, of which I tell you
before, as I have also told you in time past, that they which do such
things shall not inherit the Kingdom of God.” (Gal. v. 21.)
Of Envy it is the same, “Envyings,” are included among the works of
the flesh.
So also is Anger.
Indolence is the torpor of the soul and body, which will not exert
itself to do what is right, or to resist what is wrong. It is a state of
indifference to the true ends for which man has been made, and in
Scripture is called sleep—“Awake thou that sleepest, and arise from
the dead.”
Fifth Monday in Lent.
IN WHAT THE VICES ARE ROOTED.
The soil in which the Seven Vices find their root is Self-love, or
rather in an undue and disordered love of Self. If we really loved
ourselves we would seek to mortify and kill all the vices in us; but it
is through undue and irrational self-love that the vices find root and
opportunity to grow and flourish.
1. Self-love is not in itself sinful. God has planted in every man a
love for himself. It is part of the nature of every man and of every
intelligent creature to take care of self, and seek those things which
conduce to its welfare. God has even set self-love as the measure to
us of the love we should bear to our fellows. (Matt. xix. 19.)
2. Self-love becomes sinful when it is excessive and unreasonable.
When, for instance, the love of self makes a man disregard another’s
need or comfort. When, moreover, it becomes a dominating passion
in the soul, obscuring and even extinguishing the love of God. When
it seeks wrong ends for self, the indulgence of selfish pleasures,
selfish comforts, passion, glorification. Then self-love is sinful. When
a person takes no interest in any subject but what concerns self, has
no talk save of what touches self, sees everything in the light in
which it affects self, then self-love is unduly great.
Moreover, self-love may be disordered when it seeks for its end apart
from God, in its pleasures, in its self-glorification, in its self-
righteousness. Some people dethrone God and set up self in His
place, and make self-interest their only law, and self their only law-
giver. Again, self-love becomes sinful when it sees good where good
is not, and takes the appearance for the reality.
Self-love is disposed to self-delusion whenever it is allowed to
consider itself too highly.
3. Self-love once excessive and unreasonable, draws on to pride,
avarice, luxury, gluttony, anger, indolence, because it shows man his
supreme good in honours that flatter, riches and pleasures that puff
up and indulge self-love, revenge against such as offend self-love,
and that neglect of duty which comes so easy to those who give way
to self-love. All the Seven Vices minister to self-love, pamper and
feed it, assist in its growth, and tend to make it take the place of
God in the heart.
Self-love is harmless so long as it does not encourage the growth of
these noxious vices. We must therefore be very watchful of
ourselves, and hold our love of self under severe control, never
allowing it to become a soil in which vices may luxuriate, but seeing
that it be a garden plot in which Christian graces spring up, which it
well may, for the same soil that grows weeds will grow flowers.
4. Self-control, self-renunciation, are required of us by Christ. “If any
man will come after Me, let him deny himself, and take up his cross,
and follow Me.” (Matt. xvi. 24.) The true love of self has a far eye
and looks to eternity, and seeks those things that are above, not the
things that minister to self-love below; seeks the salvation of the
soul, not the pampering of the flesh and the flattery of pride. And
the only way of obtaining the imperishable riches and unfading joys,
is by resisting the inclinations of the carnal nature towards such as
are for a time, and perish in the using. There is a true love of self
and a false love of self; or rather love may be directed towards the
elevation of the better self, or to the degradation of the inferior self.
It is necessary to distinguish between the elements that make man,
Body, Soul, and Mind, and to seek those things which minister to the
superior elements—Mind and Soul, not to the animal part of man—
Body. Or again, not to serve only the Mind and neglect the Soul, but
to seek the welfare of the Soul first of all.
Fifth Tuesday in Lent.
PRIDE.
1. Pride is the love and estimation man has for himself beyond
measure. Every man should have a proper pride in himself as a
creature of God, an heir of everlasting life, and so maintain his
dignity and self-respect, not degenerating into buffoonery, and
making himself a laughing-stock to men.
But Pride must be within due limits. Let no man think more highly of
himself than he ought to think.
2. There are five ways in which Pride may become excessive and
sinful.
(a) When a man is puffed up with self-esteem because of the natural
gifts he has received, as though they came from himself, and were
not the unmerited gift of God. Thus a girl may become vain and
conceited because she has good hair or eyes, and is esteemed a
beauty. A man because he has wealth. He becomes purse-proud. Or
because he has great abilities. Or because he has great strength and
health. This leads to vain boasting, to an insolent demeanour, to
great self-opinionativeness.
(b) When a man regards what successes he has met with as due to
his merits. Success may be, and probably is, due in most cases to
frugality, sound judgment, caution at one time and daring at
another; but there is ever in it an element of the unforeseen, due to
God’s ordering. Moreover, the good qualities, the prudence, frugality,
and so on, in the man are the growth of good elements implanted in
him by God. A man must always acknowledge God as the Giver of all
good things, recognize His hand in the inception and the carrying
out of whatever succeeds, and must not attribute it solely to himself.
The thought of self drives the thought of God out of the mind.
(c) When a man boasts himself of what he has not. When, that is, in
order to flatter his self-pride before others, he pretends to be, or to
have what he is not, or has not got. Thus living under false
appearances, living beyond one’s income, are due to Pride.
(d) When a man despises others. Every man who looks down on,
disparages, and regards others as common and vile, is guilty of
Pride.
The rich have no occasion to despise the poor, those of one social
class to talk contemptuously of those of another, or as being
common people, as Nobodies. With God nothing is common, and not
one of His creatures is a Nobody. Moreover, it is possible to sin
through pride if those who have committed no mortal sins despise
such as have sinned. Spiritual Pride is the worst kind of Pride.
3. Pride produces a good many children, all bad when overgrown.
(a) Ambition. The desire to distinguish oneself above others.
Harmless when moderate, evil when excessive.
(b) Vain-glory. The desire to make parade of those qualities one has,
and to attribute to oneself qualities one has not. Always bad.
(c) Ostentation. The affectation of making display of those
advantages we possess—wealth, cleverness, knowledge, &c. Always
not only bad, but vulgar.
(d) Contempt for others, leading to disparaging what is good in
others, and exaggerating their faults. Never other than bad.
(e) Presumption, which impels to attempt what is beyond one’s
powers. It is not wrong to have self-confidence in what one has. It is
wrong when one presumes on what one has not.
(f) Hypocrisy, which seeks to show to the world a better face than
what one really has, to pretend to be what one is not. Ever bad.
(g) Obstinacy, which follows self-determination as if that must be
right; and a stubbornness which does not suffer a man to give way
when his reason has been convinced that he is wrong.
(h) Disobedience, which follows on self-conceit, making a man follow
his own wishes and opinions, and disobey just commands, because
he desires independence, or because he despises his superiors and
those in authority over him.
Sixth Wednesday in Lent.
AVARICE.
1. Avarice or Covetousness is a disorderly and unreasonable and
excessive attachment to the things of this world, especially to
money.
Now the love of the good things of this world is by no means sinful
in itself, it is legitimate. God gives them to us to enjoy. God gives to
us earthly things to be possessions, to keep, and to enlarge, and
multiply. To throw away wantonly what has been given to us is
sinful. For instance, it is sinful to squander money in extravagance,
in horse racing, in gambling. Riches are a trust, land and houses are
a trust, given us from God, and we must not diminish what we have
received, in amount and value, but endeavour to make them more.
It is a token of gratitude to God for this gift that we appreciate
them, and use them profitably.
2. Worldly goods are given to us to satisfy the necessities of life, not
only in the matter of eating, and drinking, and clothing, but of our
mental and spiritual life also. Our worldly goods are given to us to
enable us to cultivate art, and science, and literature, all that goes
towards the furtherance of the amenities of life: music, painting,
architecture, sculpture, horticulture, &c.
Worldly goods are given to us that with them we may do what we
can to mitigate the miseries of the poor and suffering, and to
advance God’s Kingdom, and enrich and adorn His Sanctuaries and
His Service. Consequently we are using our riches aright when we
seek out means of relieving distress, when we assist in the
propagation of the Gospel among the heathen, and when we build
and decorate Churches, and provide for the beautiful musical
rendering of the worship of God.
3. Avarice is a mortal vice when we:—
(a) Desire the good things of this world for the sole gratification they
yield to our senses, when they minister to our luxury. When we love
them for a selfish reason, and value them only as they minister to
the comfort, ease, indulgence, and pampering of self.
(b) Avarice is a sin when we desire the good things of this world
inordinately. “Love not the world, neither the things that are in the
world. If any man love the world, the love of the Father is not in
him. For all that is in the world, the lust of the flesh, and the lust of
the eyes, and the pride of life, is not of the Father, but is of the
world.” (1 John ii. 15, 16.)
Excessive love of the things of this world becomes idolatry. (Eph. v.
6.)
(c) Avarice is a sin when it agitates the mind, and occupies it with
excessive anxiety after the good things of this world. “Take no
thought for the morrow,” says our Lord, “for the morrow shall take
thought for the things of itself.” “Seek ye first the Kingdom of God,
and His righteousness; and all these things shall be added unto you.”
(Matt. vi. 33, 34.) That is to say, the mind is to be mainly occupied
with the true end of life, and strain for that, and the striving after all
material interests must be kept in subordination to that.
(d) Avarice, or Covetousness, has several daughters. It produces in
man—1. Callousness to distress. He loses feeling for the distress of
the poor and suffering. He begrudges everything given to them as
something taken from himself. 2. Dishonesty. In order to increase
wealth, the Conscience is hushed to pass over certain fraudulent or
dishonest acts whereby money may be gained unfairly, by false
representation, by selling a thing at what is beyond its worth, &c. 3.
Unrest. The mind is engrossed by the cares and anxieties of the
pursuit of wealth, so that no good seed can grow in it. The calm and
peace of a Conscience at rest in God pursuing the true end is gone,
and is replaced by constant uneasiness as to how certain
speculations will turn out, what profit will come from a certain sale,
or how certain losses are to be made up.
Sixth Thursday in Lent.
LUXURY.
1. Luxury incites to the indulgence of the senses excessively, beyond
what God’s law permits. As a vice, it consists in the love of what is
sensuous, and the inclination to yield to the pleasures of the sense.
It leads to forgetfulness of God and idolatry. That is to say, to the
enthronement of self in the place of God. Everything is made to give
way to the indulgence of the pleasures and caprices of self. God
exacts of us the homage of the entire man—body, soul and spirit;
luxury corrupts the body so that it can no longer be presented holy
and without blame to God; stains and enervates the soul, and dulls
the mind, filling it with lassitude and indifference.
It leads to sacrilege, for sacrilege is the profanation of that which is
dedicated to God. Now, man’s body is the temple of the Holy Ghost,
and S. Paul shews that sensuality is a defilement of this temple.
Moreover, Christ took human nature upon Him to restore human
nature, to purify it, and if we by indulgence desecrate the body, we
are dishonouring that nature which Christ stooped to assume.
2. Luxury indulged in becomes a servitude. He that doeth sin is the
servant of sin. (John viii. 13.) The more that the carnal nature is
yielded to, the more exacting it becomes. It is never satisfied, it is
ever crying out for fresh pleasures, and even when the faculty of
enjoyment is over, the burning craving after new pleasures remains.
Luxury indulged in gives the Evil One power over us. At first he
advised, suggested evil, then he commands as a master, and will be
obeyed. The sinner groans in his bondage and desires to escape, but
remains in chains, his efforts to escape are powerless.
Luxury indulged in weakens the power of resistance. The sinner
becomes with every sin yielded to more frail and more cowardly. His
will becomes more powerless every time he yields, he makes the
next fall more easy, recovery more difficult.
3. Luxury is not merely the yielding to gross sins of the flesh. It is a
root of inclination in man to yield to and pamper the body in many
ways not in themselves sinful. Any excessive indulgence in pleasure,
in ease, in dress, in entertainments, in distractions, in æstheticism,
may be, and often is, mortal vice. To take a simple case, the reading
of novels. A novel may be read as a distraction from laborious
thought, or painful thought. But to make fiction the main nutriment
of the mind and imagination is to indulge in the vice of luxury.
Man is sent into this world to do some good to others, to fill some
social gap, and to educate his mind, discipline his body, and cultivate
his soul. But luxury bids him distract his mind from serious pursuits,
and seek distraction as an end. Luxury, instead of bracing, enervates
the body, and it neglects the soul, if it does not cover it with stains.
4. Gross indulgence in luxury, and long continuance in luxurious
living degrades the heart. The heart is rendered incapable of
responding to noble thoughts.
It blinds the mind to Divine things. As the pure in heart see God, the
impure have their understanding darkened to Divine things.
It chokes the spiritual life. To the luxurious prayer gives disgust,
religious counsel irritates.
It hardens the heart, it leads from sin to sin, till sin becomes a habit,
and habit becomes impenitence. Then the grace of God leaves the
soul entirely, and spiritually the soul is dead.
Sixth Friday in Lent.
ENVY.
1. Envy is a sadness which affects the mind on the contemplation of
advantage accruing to a fellow-being, and which we resent as
though what was his good was our ill. Or else it is a gladness which
we feel when we see or hear of some disadvantage happening to a
fellow-being. Or again, it may be a dissatisfaction at his having some
natural gifts or divine favours accorded to him which we are without,
or a satisfaction at his having certain natural defects, faults, or
infirmities.
2. There is no sin in the feeling of the heart when we are sad at the
success of another, which has not fallen to us, so long as it does not
embitter us, and so long as it serves to spur us to activity. Emulation
is not sinful. On the contrary, God allows of inequalities, in order to
stimulate us to use our energies, and exercise our faculties to the
utmost. Emulation is only sinful when with it goes loss of charity.
There is no sin in the feeling of the heart when we are sad or wrath
at persons obtaining advantages which they do not deserve. This is
Indignation, and springs out of a wounded sense of justice. But such
indignation must not prompt us to disparage, backbite, and injure
those who have succeeded without just cause for success.
There is no sin in the feeling of the heart when we are disconcerted
at certain persons obtaining positions of trust and authority which
we believe they will misuse. This is Fear of Evil, and is legitimate. At
the same time, as we cannot see the hearts and measure the
understandings of others, it is possible we may undervalue them,
and that they will do better than we have thought probable.
There is no sin in the feeling of the heart when we feel glad that a
person whom we deem unworthy has failed to obtain, or has lost an
employment for which he was incapable.
Nor is there anything wrong in the feeling of satisfaction at the
punishment of an evil-doer.
3. Envy is that gall of the heart which is the reverse of charity. Envy
is bred of self-esteem, and it hates to see others better, happier,
more esteemed, more prosperous than self. It is selfish egoism,
desiring to possess all advantages itself. It is a baseness of the soul,
which cannot endure to see anything superior to its own mean self.
It is a falsity of judgment, for it interprets awrong everything done
by the person it envies. It is hypocritical, for it knows the despicable
quality of its emotions, and veils them under all kinds of disguises.
4. It is the most distressing of spiritual maladies. It is to the soul
what rust is to iron, canker to a tree, corroding and destroying all
happiness, brightness, amiability.
It poisons the entire life.
It is, moreover, the fruitful mother of many sins.
It produces (a) slander, backbiting, malicious words, (b) uncharitable
and cruel acts of animosity and vengeance.
It is a vice most hateful to God. “Envy,” says Solomon, is “the
rottenness of the bones.” (Prov. xiv. 30.) “Though I bestow all my
goods to feed the poor, and though I give my body to be burned,
and have not charity, it profiteth me nothing,” says S. Paul. (1 Cor.
xiii. 3.) It is one of the works of the flesh that excludes from the
kingdom of God. (Gal. v. 21.) “If ye have bitter envying and strife in
your hearts, glory not ... this ... is earthly, sensual, devilish. For
where envying and strife is, there is confusion and every evil work.”
(James iii. 15, 16.)
5. One belief among theologians is that the Devil fell through Envy;
when he knew for what God had created man, he was filled with
jealousy of man, and therefore revolted. As charity is the greatest of
virtues, and sweetens and glorifies the whole life, and is that virtue
most near to Christ, so is Envy the greatest of vices, souring and
darkening the whole life, and bringing most into likeness to the
Devil.
Sixth Saturday in Lent.
GLUTTONY.
1. Gluttony is the vice of greedy love of eating and drinking beyond
measure. If it be a love of eating too much it is greediness; if a love
of eating and drinking only choice and palatable things, then it is
daintiness. Now God requires us to eat and drink what is necessary
for our life and health, and He gives to us a sensation of pleasure in
eating and drinking in order to encourage us to eat and drink what is
good and healthful.
Gluttony is the opposite vice to the virtue of temperance.
Some people are particular not to drink fermented liquors, but gorge
themselves with food. They are quite as guilty of excess in one way
as those who drink beyond measure. The gifts of God are bestowed
to be used, and used in moderation. To despise and reject any gift of
God as in itself bad is to sin against God. So S. Paul speaks of those
who forbad meats, and so nowadays some intemperate advocates of
temperance forbid all fermented liquors as in themselves bad. Sin
does not exist in eating and drinking, but in eating and drinking
immoderately.
2. There is sin when (a) one eats and drinks in excess of what
nature requires, merely for the sake of the pleasure of eating and
drinking.
(b) One eats or drinks with daintiness, picking and choosing, and
disparaging food or drink if it be not quite what suits our pampered
tastes.
(c) One spends too much time, or thought, or money, over food and
drink.
(d) One disorders the health, and confuses the mind, through
overmuch eating and drinking.
3. There is a virtue in self-denial in eating and drinking. Our Lord
Himself exhorts to fasting (Matt. vi. 16), and Himself set us the
example to fast. It must, however, never be done to excess, so as to
injure the health. And as it is well to abstain from food, so is it well
to abstain from intoxicating drinks, if done merely as an act of self-
denial, and to avoid scandal.
4. Gluttony or Drunkenness is the fruitful mother of several evil
children.
(a) The degradation of the superior faculties, which are weakened
by surfeiting and drunkenness. The mind is abased, and the soul
smothered by excessive eating and drinking.
(b) Forgetfulness of Salvation. The soul becomes so lost in the
grossness of the life led by the glutton, and the gourmand, and the
drunkard, that it does not care for the things of the life to come.
(c) Laxity of Morals. When the thoughts are given up to pampering
the animal man in one particular, the power to resist temptation to
indulge the animal appetites in other particulars is weakened, if not
lost.
(d) Passion. The glutton and the drunkard are liable to give way to
explosions of rage and anger, to quarrels and discords. Self-restraint
being sacrificed in one quarter is lost in another.
Palm Sunday.
ANGER.
1. Anger is an agitation of the heart against persons or things that
displease us, impelling us to reject them and injure them. It urges us
to avenge ourselves on them for the wrong they have done, or that
we imagine they have done to us.
Anger is not necessarily in itself sinful. It is legitimate when it is just,
when the feeling is moderate, when the desire of punishment is
proportioned to the offence, and when it is soon passed.
It is sinful when it is unjust, excessive, vengeful, and lasting.
We feel angry when we see a wrong done, the weak oppressed, the
truth spoken against, religion mocked. Such a feeling is right, it is
righteous zeal. But Anger must not be allowed to get the dominion
over us. That is what the Apostle says when he bids us, “Be ye
angry, and sin not.”
2. Anger is criminal in its object, when it seeks vengeance on a
person for a wrong he has not really done, or in excess of his
deserts.
Anger is criminal in its means, when it goes about to avenge a
wrong by some illicit means, as by slander, by bringing hurt upon the
person who has given the offence in a secret, underhand way.
Anger is criminal in its motive, when it pursues the offender
remorselessly, even though he deserves punishment.
Anger is criminal in its motions, if they be allowed to pass the
bounds of moderation, and obscure the judgment, that is to say, if it
become a blazing passion.
Anger is criminal in its expression, when it impels to extravagant,
insulting, false words, or violent acts.
3. Let us now return to the consideration of the four qualities of
Anger that justify or condemn it.
(a) It is sinful if it be unjust, and lawful if just. We must, therefore,
be very careful not to allow our eyes to be blinded by passion so as
to judge wrongfully. We are very liable to mistake, and may suppose
a thing is done against us intentionally, when it has been done
accidentally. We must, therefore, not be impulsive in our Anger.
(b) It is sinful when excessive. We must not give way to the feeling
of Anger, so as to allow it to grow out of indignation at the sense of
wrong done into a hot personal passion that, like a whirlwind, will
sweep us away with it.
(c) It is sinful when vengeful. God says, “Vengeance is mine, I will
repay.” We must seek only the redress of the wrong, not the injury
of the wrong doer. We must seek his good, not his hurt, in the
exercise of punishment. That makes all the difference between
retribution and revenge.
(d) It is sinful when lasting. “Let not the sun go down on your
wrath,” is S. Paul’s rule. If we bear anger and malice in the heart,
the longer we harbour it the more unreasonable it grows. Anger
must be soon over, ready to die out at once when the opportunity
presents itself for forgiveness.
Monday in Holy Week.
SLOTH.
1. Sloth is that love of indolence, or dislike to exertion, which
induces man to neglect his duties.
The will is given to man as a determining faculty to impel him to
action in the right course, and to hold him back from activity in the
wrong direction. Sloth is that inertness which holds back the will
from forming a determination, and therefore usually holds man back
from fulfilling his duties. It may hold him back from doing what is
wrong, and so may be of a negative advantage, and yet it so saps
the life of the will as to make it incapable of doing any good, that it
would in some cases be better in the end for a man to have chosen
what is wrong, and to have repented, than to have remained inert in
the presence of a question set before him to decide upon.
It cannot be sufficiently impressed on Christians that they have
positive duties, that they are not called on to be a kind of moral
jelly-fish, but to a life of activity, and of activity healthy and well-
directed. It is in order that they may live this life of healthy, well-
directed activity, that Conscience is given them. Nor can any man
shirk his duties without mortal sin, for he is going contrary to the
Will of God, and frustrating the intention of God in sending him into
the world. There is a place for every man, there is work for every
man, a line for every man to walk along, and Conscience to direct,
and will to determine, are given to every man to enable him to take
his place, do his work, follow his course. He may take the wrong
place, do the wrong work, and follow the wrong road, and he sins
when he so does. But he also sins, and sins quite as gravely, when
he refuses through indolence to take his proper place, and fulfil his
predestined duties.
2. Every man has faculties of some sort, and for some end. He has
intellectual powers, manual dexterity, a sensitive eye or ear, and so
on, and it is the duty of every man to come early and clearly to a
perception of what his special abilities are, and then to cultivate
them to his utmost. So is he fulfilling God’s will. But if he says, “I am
a man of private means, there is no occasion for me to exert my
intellect to acquire knowledge, to work at painting, study music,
follow mechanics,” and so he does not develop his natural gift, he
sins against God, he is wasting his talent, through sloth.
Again, no man is justified in half doing what he is set to do. A good
many men and women are content to obtain a smattering of
knowledge, and to dabble in the fine arts, to trifle with science,
merely so as to be able to chatter in society about these things. But
if anyone has a faculty enabling him to do anything; if anyone has a
task set him to do, he must do it thoroughly; do it “as unto the Lord,
and not unto men.” The servant must not half do his work, the
tradesman leave the article he turns out unfinished off, nor the man
of culture be content with a smattering of knowledge. All must alike
make full exercise of their talents. What their hands or minds find to
do, they must do well, or they sin through the vice of sloth.
3. Sloth is hateful to God. “The Kingdom of Heaven suffereth
violence,” said Christ. The violent, i.e., the active, take it by storm.
The unprofitable servant is condemned because he did not put his
talent to usury.
The barren fig-tree was cursed because it produced no fruit.
4. Sloth is the fruitful mother of vicious children.
(a) Indolence, and loss of time, and for the use of our time we must
give account.
(b) Cowardice, which makes us shrink from doing what is right
because we fear it will give us trouble or inconvenience.
(c) Inconstancy, which is the changing about from one course to
another, to avoid present discomfort, instead of acting directly in
accordance with the principle.
(d) Deadness of heart to God’s calls.
Tuesday in Holy Week.
THE SACRIFICE FOR SIN.
1. We have considered Conscience as the faculty by which we
discern between Good and Evil, and then have considered Sin itself.
Now we will briefly turn our attention to the Sacrifice offered by
Christ in expiation for the Sins of the World.
If Christ had not come to release us of the guilt of sin, and to
strengthen us to overcome the weakness produced by sin, we could
have no hope of salvation.
2. It is not a matter on which we will tarry, to ask, Why it is so, but
we will accept the fact that by God’s Will, transgression of His
Commandment carries with it guilt, and can only be expiated by
suffering. That it should carry with it guilt is indeed not a matter to
perplex us, for guilt is the sense of transgression and the privation or
stain that attends it, together with the sense of alienation from God.
But that sin can only be expiated by suffering, is a law of God
concerning which we will not now argue, but accept it. We see that
a sense of sin has ever impressed on mankind consciousness of guilt
before God, and a conviction that only through suffering could that
guilt be done away.
The Sacrifices inexplicable in themselves and even absurd, find their
signification in the consciousness of guilt: men felt that they were
alienated from God, sinful before God, and they sought by Sacrifice,
i.e., by suffering, to atone for their guilt.
The idea of Sacrifice contained in it these elements:
(a) It must be one of blood. Suffering and the shedding of blood was
considered expiatory. “Without shedding of blood was no remission.”
(Heb. ix. 22.)
(b) It must be either a human sacrifice, or it must be the sacrifice of
that which was most useful, essential to man: not of a wild beast,
for instance, but of a tame beast of domestic utility.
(c) It must be innocent and pure, without defect or spot. It was
sometimes the first-born lamb or calf.
(d) It must be, if possible, voluntary. A Sacrifice was thought to lose
half its efficacy unless it were a free-will offering. Among Greeks and
Romans, water was poured into the ears of oxen brought to
sacrifice, to make them nod their heads, and so give an appearance
of consent to their death.
(e) It must be in part consumed by the fire, in part by the offerer.
The fire was the symbol of God accepting; the participation in the
sacrifice showed the man who offered that he received the benefits
of the Sacrifice.
3. Sacrifice was not only expiatory, but it was also vicarious; that is
to say, from the beginning man saw that the innocent might die for
the guilty. Now this could only be so seen because indistinctly the
human Conscience looked to the One Sinless Victim Who would by
His Sacrifice of Himself, put away the sins of the world. But for this it
would have been unreasonable.
It was, however, an universal belief that the just might suffer for the
unjust, the blameless for the guilty, and that was why the sacrificer
sought out the spotless victim as the victim.
This belief also was the occasion of numerous sublime heroic acts of
self-devotion in the heathen world, when one man offered himself
for the fault of all the people: as when Codrus died for his people,
Curtius plunged into the gulf in the Forum, Decius offered his breast
to the weapons of his enemies.
It was this belief which caused sacrifices to be multiplied, and yet it
was certain that these numerous sacrifices never really took away
the sense of guilt that weighed on mankind. “The law, having the
shadow of good things to come, and not the very image (i.e.,
reality) of the things, can never with these sacrifices which they
offered year by year continually, make the comers thereunto perfect.
For then would they not have ceased to be offered, because that the
worshippers once purged should have no more conscience of sin.
But in those sacrifices there is a remembrance (or recapitulation)
again made of sins every year. For it is not possible that the blood of
bulls and of goats should take away sins.” (Heb. x. 1-4.)
Wednesday in Holy Week.
THE SACRIFICE OF CHRIST.
1. As the sin of the world was infinite, it was not possible that any
sacrifice that man could offer could put away the guilt of sin.
Therefore our Lord Jesus Christ came down from Heaven to make a
full, perfect, and sufficient Sacrifice for sin. He died the Just for the
unjust, the Sinless for the guilty, to reconcile us to God by the taking
away of the guilt of our transgression.
2. Christ sacrificed for this purpose everything that He had,
withholding nothing, so that the oblation might be complete. In the
Garden of Olives He yielded up His Soul to sorrow even unto death,
feeling the natural shrinking from death; endured the revulsion and
loathing that accompanied the sense of the vileness and hatefulness
of the sins He took upon Him; and by the sense of pain that the
presence of sin brings on the soul.
He suffered the bereavement of friends, their cowardice and
desertion; the betrayal by Judas, the denial by Peter.
He suffered the privation of His liberty, for He was made fast, and
was dragged away by the soldiers and servants.
Before His judges He suffered in His honour. He was buffetted and
mocked, and smitten in the face, and spit upon, and exposed to the
multitude as a criminal.
He suffered in His reputation. The robber, Barabbas, was chosen in
His place.
He was publicly condemned as a criminal. He was made to bear His
Cross, and was crucified between two thieves.
He suffered in His Body. He was scourged. He was crowned with
thorns, and then smitten over the head. He was tormented by the
driving of the nails through His hands and feet. He was tortured by
suspension on the Cross; by thirst and fever.
He was despoiled of His garments, and exposed in nakedness to the
derision of His enemies.
He was deprived of the succour of His mother, and of His faithful
friends in the agony of death.
Finally, He gave up His life, when He had suffered in every way He
could suffer, and with a loud cry died.
3. Our Lord Jesus Christ on the Cross by His suffering expiated our
guilt.
Our Lord Jesus Christ on the Cross died as a vicarious sacrifice for
us.
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!

ebookultra.com

You might also like