0% found this document useful (0 votes)
51 views11 pages

11.chapter 2

Uploaded by

koyahsu tint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views11 pages

11.chapter 2

Uploaded by

koyahsu tint
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

CHAPTER 2

BACKGROUND THEORY OF ROLL COUNTER GENERATOR SYSTEM

This chapter describes the background theory of roll counter generator for all
electronic devices using 7 segment display, PIC18F452 microcontroller, capacitors,
resistor, LED, crystal oscillator and push bottom.

2.1. PIC18F452 Microcontroller


The PIC18F452 is, as with all the other18F series parts, optimized for using C.
It has a 31 deep hardware stack and linear memory so the user doesn’t have to make
adjustments for the hardware when coding in C. The 18F452 has 16k of program
memory and 1536 Bytes of RAM and because the RAM is linear that can declare a
large array which is not possible if the user use devices with banked memory (16F
series).
Banked memory occupies the same memory address space and you switch
from one bank to another using some program code (in other devices).It is packaged
in a 40 pin DIP other packages are PLCC and TQFP for surface mount) and it can be
programmed in circuit using ICSP. As with the other 18F devices it has an 8 bit
hardware multiplier (8x8).
The PIC 18F452 is pin compatible with 40-pin PIC16C7X devices. It also has
a 4x internal phase locked loop oscillator - so the user can supply an external clock
signal of 10MHz and it will run at 40MHz internally but remember that the maximum
internal instruction rate is Fosc/4 so even with the PLL active. This microcontroller is
exceptionally powerful and ideal for C programming...but the 18F2550/18F4550 are
similar and have a built-in USB interface. The PIC18F452 has many features and are
described as follows. These are
 High-Performance RISC CPU
 Source code compatible with the PIC16 and PIC17 instruction sets
 Linear program memory addressing to 32 Kbytes
 DC - 40 MHz osc./clock input
4

 16-bit wide instructions, 8-bit wide data path


 8 x 8 Single Cycle Hardware Multiplier
 16 kBytes Flash Program Memory
 1536 Byte RAM Data Memory
 256 Byte RAM Data Memory
 High current sink/source 25mA/25mA
 3-wire SPI (supports all 4 SPI modes)
 I²C Master and Slave mode
 Addressable USART Module supports RS-485 and RS-232
 Parallel Slave Port (PSP) module
 Eight Channel 10-bit Analog-to-Digital Converter
This powerful 10 MIPS (100 nanosecond instruction execution) yet easy-to-
program (only 77 single word instructions) CMOS FLASH-based 8-bit
microcontroller packs. Microchip's powerful PIC® architecture into 40- or 44
package and is compatible with the PIC16C5X, PIC12CXXX, PIC16CXX and
PIC17CXX devices and thus providing a seamless migration path of software code to
higher levels of hardware integration.

Figure 2.1. PIC18F452 Microcontroller


5

The PIC18F452 features a 'C' compiler friendly development environment,


256 bytes of EEPROM, Self-programming, an ICD, 2 capture/compare/PWM
functions, 8 channels of 10-bit Analog-to-Digital (A/D) converter, the synchronous
serial port can be configured as either 3-wire Serial Peripheral Interface (SPI™) or the
2-wire Inter-Integrated Circuit (I²C™) bus and Addressable Universal Asynchronous
Receiver Transmitter (AUSART). All of these features make it ideal for
manufacturing equipment, instrumentation and monitoring, data acquisition, power
conditioning, environmental monitoring, telecom and consumer audio/video
applications.

2.2. Seven Segment Display


Seven segment displays are the output display devices that provide a way to
display information in the form of image or text. For displaying the images or text in a
proper manner, some types can show only alphanumeric characters and digits. But,
some displays can also show characters and images. Most commonly used displays
along with the microcontrollers are LCD, LEDs and seven segment display, etc.
An LED or Light Emitting Diode is a solid state optical pn-junction diode
which emits light energy in the form of photons. The emission of these photons
occurs when the diode junction is forward biased by an external voltage allowing
current to flow across its junction. The actual color of the visible light emitted by an
LED, ranging from blue to red to orange, is decided by the spectral wavelength of the
emitted light which itself is dependent upon the mixture of the various impurities
added to the semiconductor materials used to produce it. But the main advantage of
light emitting diodes is that because of their small die size, several of them can be
connected together within one small and compact package producing what is
generally called a 7-segment Display.
The 7-segment display, also written as “seven segment display”, consists of
seven LEDs (hence its name) arranged in a rectangular fashion as shown. Each of the
seven LEDs is called a segment because when illuminated the segment forms part of a
numerical digit (both Decimal and Hex) to be displayed. An additional 8th LED is
sometimes used within the same package thus allowing the indication of a decimal
point, (DP) when two or more 7-segment displays are connected together to display
numbers greater than ten.
6

Each one of the seven LEDs in the display is given a positional segment with
one of its connection pins being brought straight out of the rectangular plastic
package. These individually LED pins are labeled from a through to g representing
each individual LED. The other LED pins are connected together and wired to form a
common pin.
So by forward biasing the appropriate pins of the LED segments in a particular
order, some segments will be light and others will be dark allowing the desired
character pattern of the number to be generated on the display. This then allows us to
display each of the ten decimal digits 0 through to 9 on the same 7-segment display.
The displays common pin is generally used to identify which type of 7-segment
display it is. As each LED has two connecting pins, one called the “Anode” and the
other called the “Cathode”, there are therefore two types of LED 7-segment display
called: Common Cathode (CC) and Common Anode (CA).
The difference between the two displays, as their name suggests, is that the
common cathode has all the cathodes of the 7-segments connected directly together
and the common anode has all the anodes of the 7-segments connected together and is
illuminated as follows.
The Common Cathode (CC) – In the common cathode display, all the cathode
connections of the LED segments are joined together to logic “0” or ground. The
individual segments are illuminated by application of a “HIGH”, or logic “1” signal
via a current limiting resistor to forward bias the individual Anode terminals (a-g).
7

Figure 2.2. Common Cathode (CC)


The Common Anode (CA) – In the common anode display, all the anode
connections of the LED segments is joined together to logic “1”. The individual
segments are illuminated by applying a ground, logic “0” or “LOW” signal via a
suitable current limiting resistor to the Cathode of the particular segment (a-g).

Figure 2.3. Common Anode (CA)

In general, common anode displays are more popular as many logic circuits
can sink more current than they can source. Also note that a common cathode display
8

is not a direct replacement in a circuit for a common anode display and vice versa, as
it is the same as connecting the LEDs in reverse and hence light emission will not take
place. Depending upon the decimal digit to be displayed, the particular set of LEDs is
forward biased. For instance, to display the numerical digit 0, we will need to light up
six of the LED segments corresponding to a, b, c, d, e and f. Thus the various digits
from 0 through 9 can be displayed using a 7-segment display as shown.

2.3. Random Generator


Random Number Generator is a piece of software that the user can use to
easily create random numbers between any intervals. They can have both positive and
negative values. It's practical whenever the user need to generate random numbers on
the spot for various purposes, such as picking the winner of a contest by ID. The
earliest methods for generating random numbers, such as dice, coin flipping and
roulette wheels, are still used today, mainly in games and gambling as they tend to be
too slow for most applications in statistics and cryptography.
Random number generators are very useful in developing Monte Carlo-
method simulations, as debugging is facilitated by the ability to run the same
sequence of random numbers again by starting from the same random seed. They are
also used in cryptography – so long as the seed is secret. Sender and receiver can
generate the same set of numbers automatically to use as keys.
Random number generators are important in many kinds of technical
applications, including physics, engineering or mathematical computer studies (e.g.,
Monte Carlo simulations), cryptography and gambling (on game servers).
There are two principal methods used to generate random numbers. The first
method measures some physical phenomenon that is expected to be random and then
compensates for possible biases in the measurement process. Example sources include
measuring atmospheric noise, thermal noise, and other external electromagnetic and
quantum phenomena. For example, cosmic background radiation or radioactive decay
as measured over short timescales represents sources of natural entropy.
9

Figure 2.4. Examples of Random Number Generator

The speed at which entropy can be harvested from natural sources is


dependent on the underlying physical phenomena being measured. Thus, sources of
naturally occurring "true" entropy are said to be blocking – they are rate-limited until
enough entropy is harvested to meet the demand. On some Unix-like systems,
including most Linux distributions, the pseudo device file /dev/random will block
until sufficient entropy is harvested from the environment. Due to this blocking
behavior, large bulk reads from /dev/random, such as filling a hard disk drive with
random bits, can often be slow on systems that use this type of entropy source.
The second method uses computational algorithms that can produce long
sequences of apparently random results, which are in fact completely determined by a
shorter initial value, known as a seed value or key. As a result, the entire seemingly
random sequence can be reproduced if the seed value is known. This type of random
number generator is often called a pseudorandom number generator. This type of
generator typically does not rely on sources of naturally occurring entropy, though it
may be periodically seeded by natural sources. This generator type is non-blocking, so
they are not rate-limited by an external event, making large bulk reads a possibility.

2.4. Crystal oscillators


Crystal oscillators were invented in the 1920s.Cady made one of the first one
in 1921. Miller patented both his own and Pierce’s circuits in 1930 .Quartz exhibits a
piezoelectric effect, that is, applying a voltage to the opposing surfaces of a piece of
properly oriented quartz will make it change shape mechanically (and vice versa). A
quartz crystal is a small, thin piece of quartz with two opposite surfaces metallized to
10

make electrical connections. Its physical dimensions are tightly controlled since they
control oscillation frequency. Putting an external capacitor in series with the crystal’s
internal motional capacitance C, reduces the net total series capacitance of the two
and thereby raises the crystal’s series-resonant frequency. In practice, specifying
parallel resonance simply tells the manufacturer to, set the crystal’s series resonance a
little lower than the frequency resisted by the user, so that when the crystal is put in
series with (or parallel with) a small capacitor, the crystal’s resonant frequency will be
what the user wants.

Figure 2.5. Crystal oscillators


Crystals can be manufactured for oscillation over a wide range of frequencies,
from a few kilohertz up to several hundred megahertz. Many applications call for a
crystal oscillator frequency conveniently is related to some other desired frequency,
so hundreds of standard crystal frequencies are made in large quantities and stocked
by electronics distributors. Crystal Q is important because it controls the short-term
frequency stability of the oscillator; the basic mechanism of how it does this is as
follows. A mechanical or electronic device that works on the principles of oscillation
is an oscillator.
In other words, oscillator can be defined as the periodic fluctuations between
two things based on changes in energy. The practical applications of oscillators
include Computers, clocks, watches, radios etc. The clock frequency (also called as
clock speed) is usually specified in megahertz (MHz) frequency. A quartz crystal
determines the frequency at which an oscillator works. A crystal's frequency
characteristic depends on the shape or "cut" of the crystal. An oscillator crystal has
two electrically conductive plates, with a slice or tuning fork of quartz crystal
sandwiched between them.
11

2.5. Light Emitting Diode (LED)


A light-emitting diode (LED) is a semiconductor light source that emits light
when current flows through it. Electrons in the semiconductor recombine with
electron holes, releasing energy in the form of photons. The color of the light
(corresponding to the energy of the photons) is determined by the energy required for
electrons to cross the band gap of the semiconductor. White light is obtained by using
multiple semiconductors or a layer of light-emitting phosphor on the semiconductor
device.
Appearing as practical electronic components in 1962, the earliest LEDs
emitted low-intensity infrared light. Infrared LEDs are used in remote-control circuits,
such as those used with a wide variety of consumer electronics. The first visible-light
LEDs were of low intensity and limited to red. Modern LEDs are available across the
visible, ultraviolet, and infrared wavelengths, with high light output. Early LEDs were
often used as indicator lamps, replacing small incandescent bulbs, and in seven-
segment displays. Recent developments have produced high-output white light LEDs
suitable for room and outdoor area lighting. LEDs have led to new displays and
sensors, while their high switching rates are useful in advanced communications
technology.

Figure 2.6. Internal Structure of LED

LEDs have many advantages over incandescent light sources, including lower
energy consumption, longer lifetime, improved physical robustness, smaller size, and
faster switching. LEDs are used in applications as diverse as aviation lighting,
12

automotive headlamps, advertising, general lighting, traffic signals, camera flashes,


lighted wallpaper, and plant growing light and medical devices. Unlike a laser, the
color of light emitted from an LED is neither coherent nor monochromatic, but the
spectrum is narrow with respect to human vision, and functionally monochromatic.
LED has many features and described as follows. These are
 Very bright and about 20 degree LED beam.
 Pack of 25 clear Red LED
 5mm diameter
 640nm wavelengths
 1.8-2.2V forward voltage,20mA current
 1500 mcd typical brightness
 Maximum continuous current-30mA

2.6. Power Supply


In this project, DC 5V supply is used. There are two kinds of power supplies,
AC and DC. If the circuit can be used AC supply, transformer, diodes, capacitors,
resistors, and etc need to convert DC. If DC supply is used, there is no need other
components in the path of supply. An electrical battery is one or more electrochemical
cell that converts chemical energy to electrical energy. In this project, DC 5V is
supplied to overall system. A power supply is an electrical device that supplies
electric power to an electrical load.
The primary function of a power supply is to convert electric current from a
source to the correct voltage, current, and frequency to power the load. As a result,
power supplies are sometimes referred to as electric power converters. Some power
supplies are separate standalone pieces of equipment, while others are built into the
load appliances that they power. Examples of the latter include power supplies found
in desktop computers and consumer electronics devices. Other functions that power
supplies may perform include limiting the current drawn by the load to safe levels,
shutting off the current in the event of an electrical fault, power conditioning to
prevent electronic noise or voltage surges on the input from reaching the load, power-
factor correction, and storing energy so it can continue to power the load in the event
of a temporary interruption in the source power (uninterruptible power supply).
13

All power supplies have a power input connection, which receives energy in
the form of electric current from a source, and one or more power output connections
that deliver current to the load. The source power may come from the electric power
grid, such as an electrical outlet, energy storage devices such as batteries or fuel cells,
generators or alternators, solar power converters, or another power supply. The input
and output are usually hardwired circuit connections, though some power supplies
employ wireless energy transfer to power their loads without wired connections.
Some power supplies have other types of inputs and outputs as well, for functions
such as external monitoring and control.

2.7. Summary
The background theory for roll counter system has been described in this
chapter. The basic concepts of 7 segment display and microcontroller have been
discussed.

You might also like