Program below illustrates the simplest way to define the ports as an input port and how to read the input from the ports and the result is observed in the simulation window. An integer x is declared and assigned a count equal to 10, The other loop executes when x is less than 10, Both these loops are embedded in the main loop. To observe the output of this connect the port 1 to LFDs.
The output can also be verified in the simulator window. Note the use of!
The port bits goes on changing one by one. However, there are many simple methods to expand the port.
Few of them tried by embedded system developers are given herewith the source URL, so that the user may adopt them for their applications. The application note explains the use I2C bus interfaced to shift registers for expansion of ports. LEDs have exponential volt age-current characteristics, that means around the operating point there is rapid increase in current for little increase in voltage.
Therefore ideally a constant current source is desirable to drive the LEDs. If an external power supply is used, then the corresponding brightness will be much better as compared to driving logic 1 through the microcontroller port pins. Three things are required for working with the LEDs: the driving voltage, the current to be passed, and the forward voltage drop across the LED. With the forward voltage drop of 3. The choice of the series resistor and its wattage is covered in many standard books.
The adavntages of LED-based street lights are reduced energy consumption, less maintenance, and better light quality . The above mentioned interfaces are based on packet-based system to deliver the data to the LED matrix. The technique has been covered in depth in this chapter. The hardware shown Section 4. The display appears as if the LED is shifting. The LED connected to the port 0 glows one by one. A software delay is used to define scrolling interval. Program 4. Here the single port pin is used as an output. Input from Pl. O is simulated.
Given below is the list of project ideas, which can be explored with little efforts by modifying the LED interfacing circuit. Just have a look at the project and it is very simple to implement on our kit. Different patterns can be created by modifying the source code. With the similar scheme even 12 LEDs can be connected by using only 4 port pins. But the same can be implemented with the little modification in the circuit diagram covered above.
These LEDs have the colors red, green, and blue. With these three colors one can mix a good number of color and fading combinations using the 8 bit PWM drive. With the three LEDs driven with logic 1 at port pins gives white color. The operating voltages for every LED is different, viz.. The timers of the microcontroller can be used to drive the particular pattern which corresponds to fading of the LEDs.
You may also use IC output which is available on the kit. There is a provision of cascading the modules according to the desired size of the font. They are really useful for testing purpose. On our kit an eight input DIP switch is provided with all its inputs available through the male connector on the board. Any port can be connected to this DIP switch by simply connecting the associated male connectors. This scheme is very useful to simulate a digital input to the microcontroller.
DIP switch status is read through port 1. LEDs are connected to port 0 to display the status read. Figure 4. Three output pins, viz. The data is passed on to the LCD using port 1. The most important thing in LCD interfacing is to apply a minimum of ns wide high to low pulse to the enable pin of the LCD.
This is used to activate the latch of Hitachi to grab the data on the port pin at that instance.
All hotels Published or motivating to understand given are concise in a time and you can mimic the telling system and raid number. Por argument, health behalf party! Ladda ned. You may as well connect LEDs to observe the output. Lee Wardlaw is that her important secret saint signed' following'.
The comments are self-explanatory. This may be due to several reasons such as timer overflowing, ADC returning data, or the signal on an input pin changing. Generally, many standard references compare the polling technique with the interrupt and concludes that the interrupt is a superior technique.
However, in microcontroller paradigm, if the developer intends to use the polling technique, then he will have to 58 Interrupts in Microcontrollers implement it in software. But the interrupt offers a flexible and time-efficient response to the external events with the least software overhead. Observe this in the simulation window of Keil IDE. Timer 0 is used for the generation of delay of a minute. The 4 seven-segment display is serially connected. Pins P3. In other words it is the time taken to service the interrupt or the longest time between when the interrupt occurs and when the microcontroller suspends the current processing context.
One of the most important issues in microcontroller- based embedded systems is the power consumption, since the system aims at remote installation with long battery life. This value is ultimately decided by the interrupt latency generally the standard values should be adopted to give prescribed baud rates in serial communication.
On the other hand, reducing the processor utilization may increase interrupt latency but may decrease the overall throughput. It offers a text-based command prompt interface on a remote device. Hyper Terminal is generally used for the local serial interface for communications or the network. In the case of the network, HyperTer- minal is simply using the telnet protocol. In order to communicate with the device, the HyperTerminal must be configured on the right COM port either COMl or COM2 and at appropriate baud rate most of the time for applications written here.
The remote host, i. A MAX chip is a very popular chip used in the circuit boards for all the applications covered in this chapter. The polarity of the capacitor is crucial which the user must note. As per the firing of the commands from the HyperTerminal the firmware residing in the microcontroller flash will invoke the appropriate control action. The following simple steps will help you to configure the HyperTerminal.
This will prompt you to create a new connection. Enter a name for the connection and click OK. Click OK. Hyperterminal-Based Control 71 5. After clicking OK or apply all, the above configuration will be loaded and the commands can be entered at the command prompt. With little modification in the hardware it is possible to go for web enabling of the embedded products by adding an Ethernet- based interface. Internet-based data logging and control, microcontroller- based server, and client applications are possible with optimized usage of resources due to packet methodology.
The commands to be emulated from the Hyper Terminal and the corresponding control action is given in the program source code. The interface is based on UN driver popularly used for many stepper motor control applications. The details are covered in may web-based resources . Hyperterminal-Based Control 75 Figure 5.
New protocols such as XIO system that communicates through mains wiring is gaining popularity. Hyperterminal-Based Control 79 Figure 5. Again the packet-based methodology has been used. The drivers for various appliance control such as lights, garage door, audio system, TV, etc. The microcontroller-based interfacing board comprises opto- isolator MOC which has built-in zero crossing detection.
The 4x4 hex keyboard enables the user to set the time and start the timer. As soon as the time set is elapsed, the unit enables the buzzer indicating the timeout. It can also be used for a housewife who wants to know if someone has arrived at the gate. An IR transceiver pair has been used for detecting the presence of the person at the front desk.
The system is also ideal for a bank cashier. The customer can place an order of the item by pressing a key corresponding to the item he or she would like to order. The other half of the unit is the LCD display which is kept in the kitchen. The item will be displayed on the LCD and subsequently served to the customer. An interrupt will be invoked in case the customer wants bill or to place an item which is not there in menu or in case of any other events.
Embedding Microcontroller in Routine Applications 95 Figure 6. This causes lots of damage to the human being as well as property. When the temperature rises the preset value set by the user, a fire is detected, and the unit sounds an alarm. There is also a provision to display the temperature on the LCD. The person who first presses the key will be detected and his or her name will be displayed on LCD.
The unit also sounds a buzzer to indicate that key has been pressed. The application is designed for eight users but can be modified easily to accommodate mode number of users. O sensor through which the number of cars are counted as they pass through the passage and interrupt the IR link. The system is able to count the cars maximum up to This device will be passed on to each and every member of the audience one by one.
A message appears on the LCD as regards to whether the lecture is satisfactory or otherwise. Accordingly the user has to press key 1 or 2. The poll will be displayed as soon as key 3 is pressed. Give high to low pulse on EL. Checks which key is pressed. Precisely we have used this property to build a laboratory type PID application to illustrate the code in Chapter 6. Recently, Freescale Semiconductor has come out with a new 8-bit HCLB8 microcontroller that offers single-chip solution for energy-efficient lighting systems. Application 8: Optimize the Electric Power Consumption in the Corridors In the long corridors of the hotels, unnecessary electricity is consumed on the lights.
Ideally when no one is there the lights should be switched off.
This problem is solved by using arrays of pairs of IR LEDs and phototransistor throughout the corridor placed at equal interval as shown in the block schematic. Value of the resistance IMD to D connected to the collector of the phototransistor decides its sensitivity. When the IR link breaks due to the person passing the corridor, a low to high going transition is detected by the port 0 lines. The corresponding bulbs connected to port 1 are made ON and OEE so as to light the corridor as the person makes his way to the other end. For instance, the servo motor control or even the temperature controller can be driven on the basis of ON time modulation.
The application may be used to interface resistive sensors like thermistor to display the temperature directly. The main advantage of the PWM-based measurement is the possibility of theoretically infinite resolution of the measurement. In the following application, the process consists of a simple heating unit based on Neon bulb. The sensor used is LM35, the output of which is conditioned by using OP The digitization is done by using ADC The end of conversion is sensed by using the port pin 3. The data is taken in using port PO. The set-point is kept at 40, but the same can be varied based on the application needs.
The LCD displays the set-point as well as current temperature. The controlling is done by using a relay driven by port line P2. The operating range of the interface is typically KHz to KHz. In many data logging applications the data needs to be collected with the time stamp. The main concern for deployment in these application sectors is security. Security has been the subject of intensive research in the context of general-purpose computing and communications systems. In computing and networking products there are established devices and algorithmic methodologies for ensuring the security of the code.
In reality, it is a new dimension that designers should consider throughout the design process, along with other metrics such as cost, performance, and power. Security processing, which refers to the computations that must be performed in a system for the purpose of security, can easily overwhelm the computational capabilities of processors in both low- and high-end embedded systems . The second case study allows the user to let in provided he or she enters the password in a given time. Research and developmental activities in embedded systems has grown in a signi?
Embedded so- ware design is not new to the world, but with the changing time, it has gained considerable momentum in the recent past, and many young engineers are strongly inclined to pursue their future in this?
The book is mainly targeted to these engineers who would like to understand in great depth the synergetic combination of hardware and software. The book is divided into eight chapters. Chapter 1 introduces a brief background about micro-controllers and explains how they are emb- dedintoproductscommerciallyavailableinthemarkettoemphasizethe importance of these in the daily life of mankind. It also gives an insight into the architectural details and embedded system concepts for s- dents projects to motivate them into this exciting? The rest of the bookconcentratesonsoftwaredevelopment.
Theintegrateddevelopment environment IDE is introduced in Chapter 2. Again the screen shots and step-by-step procedure will certainly make the students and en- neers fully understand the development process. Chapter 3 di? Again the authors explain how to successfully overcome the memory and time constraints while developing an embedded C program. Additional Product Features Number of Volumes.
Chapter 1: Microcontrollers Yesterday, Today and Tomorrow. Microcontroller applications. Growth Economics. The major players in the microcontroller chip market. Architectural trends. Jump starting your first embedded system project. Execution of Embedded System project: Is it a Gordian's knot?
Chapter 2: Integrated Development Environment. Chapter 3: Art of C Programming for microcontrollers. Chapter 5: HyperTerminal based Control. SlideShare Explore Search You. Submit Search. Successfully reported this slideshow. We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime. Exploring c for microcontrollers. Upcoming SlideShare. Like this document? Why not share! Luna and T. Matas :: Dali and ot Embed Size px.
Start on. Show related SlideShares at end. WordPress Shortcode. Omar Alkinani Follow.
Published in: Education. Full Name Comment goes here. Are you sure you want to Yes No. Kishore Cherala. Omid Shahanmehr. Show More. No Downloads. Views Total views. Actions Shares. Embeds 0 No embeds. No notes for slide.
Exploring c for microcontrollers 1. Catalogue record for this book is available from the Library of Congress. Contents vii 6. Foreword If we accept the premise that an embedded engineer is made ratherthan born, then how does one go about making a good one? Thebook is mainly targeted to these engineers who would like to understandin great depth the synergetic combination of hardware and software.
The book is divided into eight chapters. Chapter 1 introduces a briefbackground about micro-controllers and explains how they are embed-ded into products commercially available in the market to emphasize theimportance of these in the daily life of mankind. The rest of thebook concentrates on software development. The integrated developmentenvironment IDE is introduced in Chapter 2. Again the screen shotsand step-by-step procedure will certainly make the students and engi-neers fully understand the development process.
Againthe authors explain how to successfully overcome the memory and timeconstraints while developing an embedded C program. Chapter 4 givesan overview of program development for on-chip resources for MCS51family of microcontrollers. Chapters 5—8 are devoted to live case studies. I stronglyrecommend this book for intermediate programmers, electronics, electri-cal, instrumentation engineers or any individual who is strongly inclined ix 8.
I am sure thereader will experience learning embedded programming by example andlearning by doing. Last but not the least, this book will certainly be avalue addition to the world of embedded programming. This is thenodal agency in the country for receiving, processing, and distributingthe satellite and aerial remote sensing data and products. NRSA is alsoresponsible for providing end-to-end solutions for utilization of datafor geospatial applications and information services.
NRSA has a hugearchive of remote sensing data acquired through Indian and foreignsatellites and also has the capability to acquire data pertaining to anypart of the globe on demand. It is one of the important centers forpromotion of remote sensing and geographic information system tech-nologies in India. NRSA has set up satellite data processing facilitiesstarting from data reception to utilization at various centers withinIndia and across the globe. Preface The past few decades have witnessed evolution of microcontrollers.
Embedding a microcontroller in an electronics instrument orproduct requires a specialized design skill which requires a synergy ofhardware and software skills. In our day-to-day life we come across a number of embedded products. When we switch on the washing machine or send an SMS on a cell phoneone cannot prevent without thinking the mechanism and the co-workingof hardware and software in the background. The market for such smartembedded products is occupying newer and newer applications seem-ingly impossible few years back. This entails theindustry requirement of trained human resource with mixed skill setboth in hardware and software.
This bookis ideal for all those who would like to pursue their career in the excitingworld of microcontroller-based embedded systems. The hardware designed is useful for engineering graduates and prac-ticing professionals with the required knowledge and practical hands onskills to design with embedded systems. However, the prerequisite forthe book is background of theoretical aspects of architecture of micro-controllers especially the MCS family.
The book starts with initial xi Once thereader is comfortable with these primitive programs which covers almostall the on-chip resources, he or she can switch to more advanced ones. The Scope of the Book We now review the topics covered in sequence, chapter by chapter. The architectural trends and the growtheconomics emphasizes the importance of the subject. The simulationand single stepping as described in this chapter will solve all the projectintricacies of the readers. Chapter 4 deals with theprogramming of on-chip resources of MCS family microcontrollersin C.
The theoretical details of these on-chip resources such as ports,timers, etc. As the book aims at hands-onapproach, the programs for the on-chip resources have been developedand their execution is illustrated in the Keil simulation environment. The last four chapters, i. Several case studies in various application domains such as lighting,measurement and control, security, and domestic applications are devel-oped from scratch.
The hardware and software developed in the form ofcase studies also caters to a set of mini projects, which are discussed indetail from the design phase to the actual implementation on a targetsystem. There are 17 case studies given in this book on various systemsthat you may encounter in day-to-day life. Overall the hardware andsoftware developed in this book can be reused for any embedded sys-tem project and is expected to act as a rapid prototyping unit for theembedded systems industry. Thesebooks are traditional in nature, i. Most of these are already covered in the device data sheet and appli-cation notes.
In the present book all such routine features are skipped. Mastering the basic modulesand hands-on working with the projects will enable the reader to graspthe basic building blocks for most programs. Whether you are astudent using the MCS family of microcontrollers for your projectwork or an embedded systems programmer, this book will give you akick start in using and understanding the most popular microcontroller. Authors through their interaction with the undergraduate and post-graduate students as well as industry professionals have found that sucha book is the need of the microcontroller community interested in Cprogramming.
The book will bridge the gap between the microcontrollerhardware experts and the C programmers. Major Features The objective of this book is to introduce the readers to the designand implementation of an embedded system. It covers the unique require-ments and limitations of operating in an embedded environment. It alsocovers microcontrollers as the most widespread example of embeddedsystems. In particular, it focuses on the MCS family of microcon-trollers, their programming in C language, and interfacing techniques. Special emphasis is to provide hands-on experience for the readersusing a hardware and interfacing modules described in this book.
Theaim is to empower the reader to actually solve his or her problem witha practical hands-on pedagogy through the hardware and software pre-sented in this book. Acknowledgments We would like to take the opportunity to thank all those who havecontributed or helped in some way in the preparation of this text. Particular thanks must go to our heads of the institutions — ProfessorM.
We would also like tothank Mr. Kamat and Dr. Naik wouldlike to thank their respective wives for their understanding and patienceshown when the preparation of the book took time which could havebeen spent with the family. Additionally, Mr. Shelake and Mr. Parab would like to express grati-tude to their parents for their encouragement and support over the years. Kamat would like to dedicate his contribution to this book to the mem-ory of the late Professor G.
Tengshe and the late Dr. SenthilKumar, Dr. Deorukhkar for help in reviewing and critical sug-gestions.