Vous êtes sur la page 1sur 20

Introduction

Chapter 1

CHAPTER 1
INTRODUCTION
The measurement of a quantity plays very important role not only in science but
in all branches of engineering, medicine and in almost all the human day to day
activities. The technology of measurement is the base of advancement of science. The
role of science and engineering is to discover the new phenomena, new relationships,
the laws of nature and to apply these discoveries to human as well as other scientific
needs. The science and engineering is also responsible for the design of new
equipments. The operation, control and the maintenance of such equipments and the
processes is also one of the important functions of the science and engineering
branches. All these activities are based on the proper measurement and recording of
physical, chemical, mechanical, optical and many other of types of parameters.
The major problem with any measuring instrument is the error. Hence, it is
necessary to select the appropriate measuring instrument and measurement procedure
which minimizes the error. The measuring instrument should not affect the quality to be
measured. The measuring instrument may be defined as a device for determining the
value of magnitude of a quantity of variable. An electronic instrument is the one which is
based on electronic or electrical principles for its measurement function. The
measurement of any electronic or electrical quantity or variable is termed as and
electronic measurement. Function generators are one of the stalwarts of electronics
testing equipment. In fact, function generators are used throughout the life cycle of an
electronic component in its development, testing, and repair. Typically, a modern
digital function generator creates electrical waveforms either in a continuous loop or a
single-shot, across a variety of frequencies.

Proposed work

Chapter 2

CHAPTER 2
PROPOSED WORK
The proposed work in the project is to design a function generator and see the
corresponding wave which is been generated in the CRO. We are designed to produce
4 different kind of waves namely sine wave, square wave, ramp wave and saw tooth
wave. The different kind of wave can be produced depending on the switch which is
been pressed. On pressing the switch, the required wave gets generated in the CRO.

2.1 WORKING PRINCIPLE


The system consists of the ARM 7 LPC2148 controller along DAC, DIP switch,
and a CRO for display purpose. When the corresponding DIP switch is pressed, the
wave gets generated in port 0.25 which is DAC output.by adjusting the CRO the wave
generated can be seen.

It uses three main principle of interfacing namely:

DIP switch for wave selection.

DAC for internal digital to analog conversion.

CRO for output purpose.

Proposed work

Chapter 2

2.2 CIRCUIT DIAGRAM

Fig 2.1 Block Diagram of LPC2148.

Fig 2.2 Block Diagram of DIP switch.

Hardware description

Chapter 3

CHAPTER 3
HARDWARE DESCRIPTION
Components required to perform the functionality of a function generator are:
1.
2.
3.
4.

ARM7 development board with LPC2148.


CRO (cathode ray oscilloscope).
In -built DAC (digital to analog converter).
In-built DIP switch.

Fig 3.1 Operational Block Diagram of function generator.

Hardware description

Chapter 3

3.1 LPC2148 MICROCONTROLLER

The LPC2148 microcontrollers are based on a 32/16 bit ARM7TDMI-S CPU with
real-time emulation and embedded trace support, that combines the microcontroller with
embedded high speed flash memory ranging from 32 kB to 512 kB. A 128-bit wide
memory interface and a unique accelerator architecture enable 32-bit code execution at
the maximum clock rate. For critical code size applications, the alternative 16-bit Thumb
mode reduces code by more than 30% with minimal performance penalty. Due to their
tiny size and low power consumption, LPC2148 are ideal for applications where
miniaturization is a key requirement, such as access control and point-of-sale.

3.2 FEATURES OF LPC2148 MICROCONTROLLER

16/32-bit ARM7TDMI-S microcontroller in a tiny LQFP64 package.


8 to 40 kB of on-chip static RAM and 32 to 512 kB of on-chip flash program
memory. 128-bit wide interface/accelerator enables high speed 60 MHz

operation.
In-System/In-Application

Programming

(ISP/IAP)

via

on-chip

boot-loader

software. Single flash sector or full chip erase in 400 ms and programming of 256

bytes in 1 ms.
Embedded ICE RT and Embedded Trace interfaces offer real-time debugging
with the on-chip Real Monitor software and high speed tracing of instruction

execution.
USB 2.0 Full Speed Compliant Device Controller with 2 kB of endpoint RAM. In

addition, the LPC2148 provide 8 kB of on-chip RAM accessible to USB by DMA.


One or two (LPC2141/2 vs LPC2144/6/8) 10-bit A/D converters provide a total of

6/14 analog inputs, with conversion times as low as 2.44 Ps per channel.
Single 10-bit D/A converter provides variable analog output.
Two 32-bit timers/external event counters (with four capture and four compare
channels each), PWM unit (six outputs) and watchdog.
5

Hardware description

Chapter 3

3.3 BLOCK DIAGRAM OF LPC2148

Fig 3.2 Block Diagram of LPC2148.

Hardware description

Chapter 3

3.4 PIN DIAGRAM OF LPC2148

Fig 3.3 pin-out diagram of LPC2148.

Peripherals used

Chapter 4

CHAPTER 4
PERIPHERALS USED
4.1 DIGITAL TO ANALOG CONVERTER

In electronics, a digital-to-analog converter is a function that converts digital data


usually binary into an analog signal like current, voltage, or electric charge. An analogto-digital converter (ADC) performs the reverse function. Unlike analog signals, digital
data can be transmitted, manipulated, and stored without degradation, albeit with more
complex equipment. But a DAC is needed to convert the digital signal to analog to drive
an earphone or loudspeaker amplifier in order to produce sound.

DACs and their inverse, ADCs, are part of an enabling technology that has
contributed greatly to the digital revolution. To illustrate, consider a typical long-distance
telephone call. The caller's voice is converted into an analog electrical signal by a
microphone, then the analog signal is converted to a digital stream by an ADC. The
digital stream is then divided into packets where it may be sent along with other digital
data, not necessarily audio. The digital packets are then received at the destination, but
each packet may take a completely different route and may not even arrive at the
destination in the correct time order. The digital voice data is then extracted from the
packets and assembled into a digital data stream. A DAC converts this into an analog
electrical signal, which drives an audio amplifier, which in turn drives a loudspeaker,
which finally produces sound.

Peripherals used

Chapter 4

4.2 DIP SWITHCH


A DIP Switch is a manual electric switch that is packaged with others in a group
in a standard dual in-line package (DIP). The term may refer to each individual switch,
or to the unit as a whole. This type of switch is designed to be used on a printed circuit
board along with other electronic components and is commonly used to customize the
behavior of an electronic device for specific situations.
DIP switches are an alternative to jumper blocks. Their main advantages are that
they are quicker to change and there are no parts to lose. There are many different
kinds of DIP switches. Some of the most common are the rotary, slide, and rocker types.
Rotary DIP switches contain multiple electrical contacts, one of which is selected by
rotating the switch to align it with a number printed on the package.

Fig 4.1 Diagram of DIP switch.

Peripherals used

Chapter 4

The slide and rocker types, which are very common, are arrays of simple single
pole, single throw (SPST) contacts, which can be either on or off. This allows each
switch to select a one-bit binary value. The values of all switches in the package can
also be interpreted as one number. For example, seven switches offer 128
combinations, allowing them to select a standard ASCII character. Eight switches offer
256 combinations, which is equivalent to one byte.
DIP switches were used extensively in ISA architecture of PC expansion cards to
select IRQs and memory addresses. They were also often used on arcade games in the
1980s and early 1990s to store settings before the advent of cheaper, battery-backed
RAM, and were very commonly used to set security codes on garage door openers as
well as on some early phones. These types of switches were used on early video
cards for early computers to facilitate compatibility with other video standards. For
example, CGA cards allowed for MDA compatibility. DIP switches have become less
common in consumer electronics. Reasons include the trend toward smaller products,
the demand for easier configuration through software menus, and the falling price of
non-volatile memory. However, DIP switches are still widely used in industrial
equipment because they are inexpensive and easy to incorporate into circuit designs,
and because they allow settings to be checked at a glance without powering the system
on.
DIP switches are still used in some remote controls to prevent interference; for example,
to control a ceiling fan that was retrofitted to a single-circuit junction box. The DIP
switches set

a different radio frequency for each transmitter/receiver pair, so that

multiple units can be installed in different rooms of the same house, or different units of
the same apartment building, without unintentionally controlling each other. Rotary
switches are also used in X10 home automation to select house and unit numbers.
Rotary switches are also used in some radio transmitters (particularly VHF and FM
broadcast) to select the DC bias used to set the voltage-controlled oscillator, which
determines the center frequency of the carrier wave output.

10

Implementation
chapter5

and

results

CHAPTER 5
IMPLEMENTATION AND RESULTS
The below picture gives a detailed description of the project results. When the DIP
switch 1 is pressed sine waveform is generated and can be seen in the CRO.similarly,
when switch 2 is pressed a square waveform is generated and ramp and saw-tooth
waveform gets displayed when switch 3 and 4 are pressed accordingly.

Fig 5.1 DIP switch been pressed for required wave form.

11

Implementation
chapter5

and

Fig 5.2 sine wave generated when switch 1 is pressed.

Fig 5.3 square wave generated when switch 2 is pressed.

12

results

Implementation
chapter5

and

Fig 5.4 ramp wave generated when switch 3 is pressed.

Fig 5.5 saw tooth wave generated when switch 4 is pressed.

13

results

conclusion

chapter 6

CHAPTER 6
CONCLUSION
The working of function generator using LPC2148 has been implemented in the
microcontroller and different types of waveform are generated and output results are
seen in the CRO.By using LPC2148 microcontroller and various other peripherals, it is
being done. But our project does not contain this comfortability of changing the values
of various parameters such as frequency and amplitude .

14

Bibliography

BIBLIOGRAPHY
1.
2.
3.
4.

www.digitalfieldsolutions.com/functiongenerator
www.nskelectronics.com
techhugger.blogspot.in/2014/12/functiongenerator.html
en.wikipedia.org/wiki/function generator

15

Appendix

APPENDIX
CODE
#include<lpc214x.h>
#include<math.h>
unsigned int a,i,d;
float b,c;
void sin_wave()
{
for(i=0;i<5000;i++)

//function to produce sine wave

{
16

Appendix

b=2.0*3.14*50;

// w=2*pi*f, where f=50Hz

c=500.0*sin(b*(i*0.0001));

// 100sin(wnT)where T=1/Fs

a=(int)c;

//typecasting to integer

a=a+512;

//converting to max value

a=a<<6;

//Shifted to place in DACR

DACR=a;
}
}
void sqr_wave()
wave

//function to produce square

{
for(i=0; i<1023; i++)
{
d=1000;

//HIGH digital value

d=d<<6;
DACR=d;
}
for(i=1024; i>=1; i--)
{
d=0;

//LOW Digital Value

d=d<<6;
DACR=d;
}
}

void ramp_wave()

//function to produce ramp wave

17

Appendix

{
for(; i<1023; i++)
{
d=i;

//x=t Ramp fn assignment

d=d<<6;
DACR=d;
}
for(; i>=1; i--)
{
d=i;

// Ramp fn assignment for down slope

d=d<<6;
DACR=d;
}
}
void swtooth_wave()

//function to produce saw tooth wave

{
for(i=0; i<=1023; i++)
{
//x=t for upslope

d=i;
d=d<<6;
DACR=d;
}
}
int main()
{
int a, b;

//All PORT1 pins made output

IO1DIR=0xffffffff;
18

Appendix

IO0DIR=0xff007fff;

//Switches are made inputs

IO0CLR=0XFFFFFFFF;

//cleared initially

PINSEL0=0x00000000;
//DAC fn chosen

PINSEL1=0X00080000;
PINSEL2=0x00000000;

while(1)
{
a=IO0PIN&0x00ff0000;

//input obtained from switches

b=a>>16;

//Right shifted to move to LSB

switch(b)
{
case 1:
{
sin_wave();
break;
}
case 2:
{

sqr_wave();
break;
}
case 4:
{

ramp_wave();
19

Appendix

break;
}
case 8:
{

swtooth_wave();
break;
}
default :break;
}
}
}

20

Vous aimerez peut-être aussi