biomedical signal generator chun wey …mengaku membenarkan laporan projek sarjana muda ini disimpan...

24
BIOMEDICAL SIGNAL GENERATOR CHUN WEY TONG This report is submitted in partial fulfillment of the requirements for the award of Bachelor of Electronic Engineering and Computer Engineering with Honors Faculty of Electronic and Computer Engineering Universiti Teknikal Malaysia Melaka April 2009

Upload: letu

Post on 04-Feb-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

BIOMEDICAL SIGNAL GENERATOR

CHUN WEY TONG

This report is submitted in partial fulfillment of the requirements for the award of

Bachelor of Electronic Engineering and Computer Engineering with Honors

Faculty of Electronic and Computer Engineering

Universiti Teknikal Malaysia Melaka

April 2009

Page 2: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

UNIVERSTI TEKNIKAL MALAYSIA MELAKA FAKULTI KEJURUTERAAN ELEKTRONIK DAN KEJURUTERAAN

KOMPUTER

BORANG PENGESAHAN STATUS LAPORAN PROJEK SARJANA MUDA II

Tajuk Projek : Biomedical Signal Generator Sesi Pengajian : 2008/2009

Saya CHUN WEY TONG (HURUF BESAR)

mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan syarat-syarat kegunaan seperti berikut:

1. Laporan adalah hakmilik Universiti Teknikal Malaysia Melaka.

2. Perpustakaan dibenarkan membuat salinan untuk tujuan pengajian sahaja.

3. Perpustakaan dibenarkan membuat salinan laporan ini sebagai bahan pertukaran antara

institusi pengajian tinggi.

4. Sila tandakan ( √ ) :

SULIT*

(Mengandungi maklumat yang berdarjah keselamatan atau kepentingan Malaysia seperti yang termaktub di dalam AKTA RAHSIA RASMI 1972)

TERHAD* (Mengandungi maklumat terhad yang telah ditentukan oleh

organisasi/badan di mana penyelidikan dijalankan)

TIDAK TERHAD

Disahkan oleh:

__________________________ ___________________________________ (TANDATANGAN PENULIS) (COP DAN TANDATANGAN PENYELIA)

Alamat Tetap: 1178, Lorong Malinja, Jalan Sungai Nibong, 36000 Teluk Intan, Perak Darul Ridzuan.

Tarikh: ……………………….. Tarikh: ………………………..

Page 3: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

“I hereby declare that this report is the result of my own work except for quotes as

cited in the references.”

Signature : ..................................................

Author : ..................................................

Date : ..................................................

Page 4: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

“I hereby declare that I have read this report and in my opinion this report is

sufficient in terms of the scope and quality for the award of Bachelor of Electronic

Engineering and Computer Engineering with Honors.”

Signature : …………………………………………..

Supervisor’s Name : …………………………………………..

Date : …………………………………………..

Page 5: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

To my beloved mom and dad

Page 6: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

ACKNOWLEDGEMENT

First and foremost, I would like to convey my deepest appreciation to my supervisor

Cik Noor Shahida Binti Mohd Kasim for her patience, concern, invaluable guidance and also

encouragement throughout the preparation of this thesis.

Besides that, I would like to dedicated my deepest thank to my beloved parents and

family members for their tolerance, financial and moral support while completing my

tertiary education here. Thanks to all the lecturers, friends, fellow course mate for their

pleasure opinion and encouragement.

Last but not least, my thanks to the librarians and the technician of Universiti

Teknikal Malaysia Melaka for their helping hand in providing invaluable resources.

Page 7: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

ABSTRACT

In general, biomedical signals such as electrocardiogram (ECG) and heart

sound signal play an extremely important role for doctors and other medical

practitioners to forecast and determine a patient’s well-being and condition.

Although biomedical signals are very important to predict patient’s condition but it is

so hard to get the signals from human body for study and analysis purpose. Therefore,

as a solution, a biomedical signal generator was developed in this final year project.

The objectives of this project are to build or construct a biomedical signal

generator to read the signal data such as ECG and heart sound signals by using PIC

as the simulator or processor. In this project, a SD/MMC was use as the external

memory for the signal generator to store the signals data in text file. Besides that, a

PIC18F452A was used as the processor to process or read the biomedical signals

data from the external memory that is MMC. While for the output of the signal

generator, it was observed on the LCD or on the PC using Hyper Terminal

Interfacing.

Page 8: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

ABSTRAK

Secara amnya, isyarat bio-perubatan seperti isyarat jantung dan isyarat

denyutan jantung memainkan peranan yang penting bagi doktor ataupun mana-mana

staf perubatan untuk mengenal pasti dan meramalkan keadaan dan kesihatan pesakit.

Walaupun isyarat bio-perubatan adalah sangat penting untuk meramalkan kesihatan

pesakit, tetapi ia adalah susah untuk mendapatkan isyarat-isyarat terus daripada

badan manusia untuk tujuan pembelajaran dan analisasi. Oleh itu, untuk

menyelesaikan masalah ini, satu “Biomedical signal generator” telah dibina dalam

projek sajana muda.

Objektif projek sajana muda ini adalah untuk membina “Biomedical signal

generator” untuk membaca data isyarat bio-perubatan seperti isyarat jantung dan

isyarat bunyi jantung dengan mengunakan “PIC” sebagai “processor”. Di dalam

projek sajana muda ini, “SD/MMC” akan digunakan sebagai media penyimpan luar

untuk menyimpan data isyarat dalam bentuk “text file”. Selain itu, PIC18F452 akan

digunakan sebagai “processor” untuk membaca data isyarat bio-perubatan. Untuk

output, LCD atau PC (“HyperTerminal”) akan digunakan untuk mempaparkan data

isyarat bo-perubatan tersebut.

Page 9: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

TABLE OF CONTENTS

CHAPTER CONTENT PAGE

PROJECT TITLE i

REPORT STATUS ii

DECLARATION iii

DEDICATION iv

ACKNOWLEDGEMENT vi

ABSTRACT vii

ABSTRAK viii

TABLE OF CONTENTS ix

LIST OF TABLES xi

LIST OF FIGURES xii

LIST OF ABBREVIATIONS xiv

I INTRODUCTION

1.1 Background study 1

1.2 Objective 2

1.3 Problem Statement 2

1.4 Scope 3

1.5 Project Methodology 3

1.6 Thesis Overview 4

II LITERATURE REVIEW

2.1 Biomedical Signals 5

2.1.1 Electrocardiogram (ECG) 5

Page 10: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

2.1.2 Hearts Sound Signals 7

2.1.3 Electroencephalography (EEG) 7

2.2 Microcontroller 8

2.2.1 Embedded Design 9

2.2.2 Peripheral Interface Controller (PIC) 10

2.3 External Memory 12

2.3.1 Memory Card 12

2.3.2 Contact Surface of MMC/SD 14

2.3.3 Serial Peripheral Interface (SPI) Mode 14

2.3.4 SPI Command Set 15

2.4 Recent Development in Biomedical

Signal Engineering 15

2.4.1 Interfacing Components 16

2.4.2 Findings 17

2.5 Recent Development of MMC and Microcontroller 17

2.5.1 Hyper Terminal Version 17

2.5.2 Microsoft Visual Basic (VB) Version 18

2.5.3 Schematic of the Experiments 19

2.5.4 Findings 20

III MICROCONTROLLER

3.1 Introduction to PIC18F452 21

3.2 PIC Programming 24

3.2.1 C Programming Language 25

3.3 Compiler 25

3.3.1 MikroC 26

IV METHODOLOGY

4.1 Introduction 27

4.2 Biomedical Signal 29

Page 11: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

4.3 PIC Circuit Design 30

4.4 Interfacing SD/MMC card to PIC 31

4.5 Circuit simulation using Proteus v7.2 32

4.5.1 LED Blinking Simulation 32

4.5.2 Simple Input Output Simulation 33

4.5.3 MMC-PIC Interfacing Circuit 35

4.6 MikroC Compiler 36

4.6.1 MikroC Compiler Syntax 36

4.6.2 Flowchart 39

V RESULT AND DISCUSSIONS

5.1 Introduction 40

5.2 Hardware Fabrication and Circuit Testing 41

5.2.1 Data Reading from MMC 43

5.3 Simulation Result using Proteus v7.2 45

5.3.1 Simulation Results 46

5.3.2 Data Reading from MMC in Simulation 47

5.4 Analysis and Discussions 50

5.4.1 Analysis 50

5.4.2 Discussions 53

VI CONCLUSION AND FUTURE DEVELOPMENT

6.1 Conclusion 54

6.2 Future Development 55

VII REFERENCES 56

VIII APPENDIX 57

Page 12: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

LIST OF TABLE

NO TITLE PAGE

2.1 Data Table of selected Memory Card Formats 13

2.2 SPI Command Set for Read and Write 15

3.1 Key Features of PIC18F4x2 22

4.1 Input and Output of the System 34

5.1 Switch Button Indicator 42

5.2 Legend of the Biomedical Signal Generator Circuit 45

Page 13: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

LIST OF FIGURE

NO TITLE PAGE

1.1 Example of 12 Lead ECG of a 26 year old male 2

1.2 Methodology of Final Year Project 3

2.1 Schematic Representation of Normal ECG 6

2.2 A Normal Adult 12-Lead ECG 6

2.3 A Heart Sound Signal for a Normal Heartbeat 7

2.4 Epileptic Spike and Wave Discharges Monitored with EEG 8

2.5 Examples of PICs 10

2.6 Examples of Programmers 11

2.7 Miniaturization is an Evident in Memory Card Creation 12

2.8 Contact Surface of MMC/SD 14

2.9 Block Diagram of the Pulse Detector Device 16

2.10 PIC16F877A Microcontroller Pinout 16

2.11 Hyper Terminal Screen Shot 18

2.12 Microsoft Visual Basic Screen Shot 19

2.13 Schematic of Interfacing MMC and PIC 19

3.1 Pin Diagram of PIC18F452 21

3.2 Program Memory Map and Stack for PIC18F452 23

3.3 special register function map for PIC18F452 24

3.4 Integrated Development Environments (IDE) of MikroC 26

4.1 Project Block Diagram 27

4.2 Overall Research Flows for Biomedical Signal

Generator Development 28

4.3 Two Examples of Data Saved in Text File 29

4.4 Example of ECG Signals 29

Page 14: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

4.5 Another Example of ECG Signals 30

4.6 Circuit Diagram for the Boot Loader Hardware 30

4.7 SD MMC Interface with the PIC Circuit Schematic 31

4.8 Coding for LED Blinking System 32

4.9 LED Blinking System Output 32

4.10 Simple Input Output System Schematic 33

4.11 Coding of Simple Input Output System 34

4.12 Output of the System When Button “RD2” Was Pressed 35

4.13 MMC-PIC Interfacing Circuit 35

4.14 MMC-PIC Interfacing Circuit with MMC Initialized 36

4.15 Parameters Assignment 36

4.16 Parameter Definition 37

4.17 “Read” Function Created to Extract the Text File Data 37

4.18 Main Function of the Program 38

4.19 Biomedical Signal Generator Program’s Flowchart 39

5.1 Biomedical Signal Generator 40

5.2 LCD Display 41

5.3 Button Information Display on LCD 42

5.4 Button “RB0” Pressed to Select File “normal.txt” 43

5.5 “normal.txt” Data Extracted and Displayed on LCD 43

5.6 Button “RB7 Pressed to Select “premmf1.txt” 44

5.7 Data Extract from “premmf1.txt” and Displayed on LCD 44

5.8 Biomedical Signal Generator Circuit 45

5.9 LCD Display once the MMC was Detected 46

5.10 Switch Button Information Displayed on LCD in sequence 47

5.11 Button “RB0” Pressed 48

5.12 “normal.txt” data display on LCD 48

5.13 Button “RB4” Pressed 49

5.14 “condrbbb.txt” data Display on LCD 49

5.15 Biomedical Signal Generator Circuit with Virtual Terminal 50

5.16 Biomedical Signal Generator Displayed “normal.txt” Data 51

5.17 Biomedical Signal Generator Displayed “condlbbb.txt” Data 52

5.18 MMC-PIC Interfacing Circuit 53

5.19 MMC-PIC Interfacing Circuit with MMC initialized 53

Page 15: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

LIST OF ABBREVIATIONS

ECG/EKG - Electrodiagram

EEG - Electroencephalography

PIC - Peripheral Interface Controller

PSM - Project Sajana Muda

SD - Secured Digital

USART - Universal Synchronous Asynchronous Receiver

Transmitter

DSP - Digital Signal Processing

ADC - Analog to Digital Convertor

DAC - Digital to Analog Convertor

RAM - Random Access Memory

I/O - Input or Output

ISR - Interrupt Service Routine

CPU - Central Processing Unit

ICSP - In Circuit Serial Programming

LVP - Low Voltage Programming

IDE - Integrated Development Environment

ANSI - American National Standards Institute

DRM - Digital rights management

MMC - Multi-Media Card

SPI - Serial Peripheral Interface

VB - Microsoft Visual Basic

CS - Chip Select

LCD - Liquid Crystal Display

Page 16: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

CHAPTER 1

INTRODUCTION

1.1 Background Study

Biomedical signal is or biopotential is an electric quantity (voltage or current

or field strength), caused by chemical reactions of charged ions. Another use of the

term lies in describing the transfer of information between and within cells, as in

signal transduction. Example for biomedical signal is electrocardiogram, heart sound

signal, lung sound signal, etc.

Biomedical signals such as electrocardiogram (ECG) indicates the overall

rhythm of the heart and weaknesses in different parts of the heart muscle. It is the

best way to measure and diagnose abnormal rhythms of the heart, particularly

abnormal rhythms caused by damage to the conductive tissue that carries electrical

signals, or abnormal rhythms caused by levels of dissolved salts (electrolytes), such

as potassium, that are too high or low. In myocardial infarction (MI), the ECG can

identify damaged heart muscle.

Nowadays, biomedical signals such as ECGs are easily recorded at the

bedside using portable machines. Electrodes are placed in specified positions on the

patient’s bare skin, and a simultaneous recording from all the leads is processed via a

computer and the resultant ECG printed out on standard paper.

Page 17: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

Figure 1.1 Example of 12 Lead ECG of a 26 year old male [1]

Since the biomedical signal are very important to predict patient’s condition,

therefore, a biomedical signal generator which can store data and regenerate the

signal similar with human signal for monitoring purpose was develop in this project.

1.2 Objectives

The objectives of the project are:

(I) To construct the signal generator using PIC (PIC was used as a

simulator or processor)

(II) To read the signal data from MMC

(III) To display the signal data read from MMC at LCD

1.3 Problem Statement

In real life, it is hard to get a desired biomedical signal straight from a human

body for a study and analysis purpose. As a solution to make the study and analysis

easier, a signal like ECG, EEG, heart sound signal, lung sound signal etc was

generated.

Page 18: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

Besides that, the signal generator was constructing for calibration purpose.

These are because the ECG machine needs to calibrate every half year and for safety

purpose, signal generator was use to replace human signal for calibration.

1.4 Scope

A PIC18F452 will be used as a platform or simulator to read the

biomedical signal data from MMC.

The biomedical signal data was saved in external memory like

SD/MMC memory card in a text file format.

The project will concentrate on generating ECG and the heart sound

signal first. For the further improvement, EEG signal and lung sound

signal can be added into this signal generator.

The data will be display on the LCD or on the PC using Hyper

Terminal.

1.5 Project Methodology

Start

Literature Review Data Collection

PIC Design Function?

ImproveThe PIC Design Function?

End

Function Function

Not function

Not function

Figure 1.2 Methodology of Final Year Project

The sequences of the step to complete the project are illustrated in flowchart

shows in Figure 1.2. Basically, this final year project are divided into two sections

that is PSM I and PSM II. For PSM I, research, literature review and data collections

Page 19: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

was done. Besides that, experimental design will be planned and the design will be

used to build the signal generator in PSM II. While in the PSM II, signal generator

was designed and built.

1.6 Thesis Overview

Chapter 1: Introduction of the final year project. This chapter introduces the

purpose of the signal generator and why I choose this project. Besides

that, this chapter also includes objective, problem statement, scope,

methodology of the project, and thesis overview.

Chapter 2: Literature review. This chapter mentioned the literature review that

had been done before the project is started. This chapter includes

background study, theory, research and data collections.

Chapter 3: Microcontroller. This chapter was mentioned functions, embedded

system of the PIC18F452, the programming language use to develop

the program and the compiler use to compile the program.

Chapter 4: Methodology. This chapter mentioned about method and approach

used to do the project. Besides that, this chapter also mentioned

method use to analyze the data, factors considered when choosing the

method, advantages and disadvantages of the method.

Chapter 5: Results and Discussion. This chapter mentions about the results of the

project and discussion of the projects.

Chapter 6: Conclusion and Future Development. This chapter mentioned about

the finding of the project, data conclusion and suggestion to the

project’s future improvement.

Page 20: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

CHAPTER 2

LITERATURE REVIEW

2.1 Biomedical Signals

There are many types of biomedical signals such like electrocardiogram

(ECG), heart sound signals, electroencephalography (EEG), lung sound signals and

etc.

2.1.1 Electrocardiogram (ECG)

An electrocardiogram is a recording of the electrical activity of the heart over

time produced by an electrocardiograph, usually in a noninvasive recording via skin

electrodes. [1]

Sympathetic electrical impulses in the heart originate in the senatorial node

and travel through the heart muscle where they impart electrical initiation of systole

or contraction of the heart. An ECG displays the voltage between pairs of these

electrodes, and the muscle activity that they measure, from different directions, also

understood as vectors. This display indicates the overall rhythm of the heart and

weaknesses in different parts of the heart muscle. It is the best way to measure and

diagnose abnormal rhythms of the heart, particularly abnormal rhythms caused by

Page 21: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

damage to the conductive tissue that carries electrical signals, or abnormal rhythms

caused by levels of dissolved salts (electrolytes), such as potassium, that are too high

or low.

Figure 2.1 Schematic Representation of Normal ECG [1]

Figure 2.2 A Normal Adult 12-Lead ECG [2]

Page 22: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

2.1.2 Heart Sound Signals

The heart sounds are the noises or sound that generated by the beating heart

and the resultant flow of blood through it. This is also called a heartbeat. In cardiac

auscultation, an examiner uses a stethoscope to listen for these sounds, which

provide important information about the condition of the heart. [3]

There are two major sounds heard in the normal heart sound like “lub dub”.

The “lub” is the first heart sound, commonly termed S1, and is caused by turbulence

caused by the closure of mitral and tricuspid valves at the start of systole. The second

sound, “dub” or S2, is caused by the closure of aortic and pulmonic valves, marking

the end of systole. Thus the time period elapsing between the first heart sound and

second sound defines systole (ventricular ejection) and the time between the second

sound and the following first sound defines diastole (ventricular filling).[4]

Figure 2.3 A Heart Sound Signal for a Normal Heartbeat

2.1.3 Electroencephalography (EEG)

Electroencephalography (EEG) is the measurement of electrical activity

produced by the brain as recorded from electrodes placed on the scalp. EEG signals

are amplified and digitalized for later processing. The data measured by the scalp

EEG are used for clinical and research purposes. [5]

Page 23: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

Figure 2.4 Epileptic Spike and Wave Discharges Monitored with EEG [5]

2.2 Microcontroller [6]

Microcontroller is a functional computer system on a single chip or it also

known as an integrated circuit was build where all the component of the

microcomputer system was combined together. Microcontrollers include an

integrated CPU, memory (a small amount of RAM, program memory, or both) and

peripherals capable of input and output.

In addition to the usual arithmetic and logic elements of a general purpose

microprocessor, the microcontroller integrates additional elements such as read-write

memory for data storage, read-only memory for program storage, Flash memory for

permanent data storage, peripherals, and input/output interfaces.

At clock speeds of as little as 32 KHz, microcontrollers often operate at very

low speed compared to microprocessors, but this is adequate for typical applications.

They consume relatively little power and will generally have the ability to retain

functionality while waiting for an event such as a button press or interrupt. Power

consumption while sleeping may be just nanowatts, making them ideal for low power

and long lasting battery applications.

Page 24: BIOMEDICAL SIGNAL GENERATOR CHUN WEY …mengaku membenarkan Laporan Projek Sarjana Muda ini disimpan di Perpustakaan dengan ... ECG/EKG - Electrodiagram EEG - Electroencephalography

2.2.1 Embedded Design

The majority of computer systems in use today are embedded in other

machinery, such as automobiles, telephones, appliances, and peripherals for

computer systems. These are called embedded systems where an embedded system is

a special-purpose computer system designed to perform one or a few dedicated

functions often with real-time computing constraints. Some embedded systems are

very sophisticated; many have minimal requirements for memory and program

length, with no operating system, and low software complexity. Embedded systems

usually have no keyboard, screen, disks, printers, or other recognizable I/O devices

of a personal computer, and may lack human interaction devices of any kind. For

example: embedded systems for microcontroller are interrupt and program.

Interrupts

Microcontroller has provided a real time response to events in the embedded

system that is interrupt. When certain events occur during main program is running,

an interrupt system can signal the processor to suspend processing the current

program and begin an interrupt service routine (ISR). The ISR will perform any

processing required before returning to the original instruction sequence. The

interrupt are device dependent and often include events such as an internal timer

overflow, data receive on a communication link and etc.

Program

Microcontroller program must fit in the available on-chip program memory,

since it would be costly to provide a system with external memory. Compilers are

use and assembly languages are used to turn high-level language programs into a

compact machine code for storage in the microcontroller’s memory.

Microcontrollers were originally programmed only in assembly

language, but various high-level programming languages are now also in common

use to target microcontroller. These languages are either designed especially for the

purpose, or version of general purpose such as the C programming language.