Unformatted text preview:

Micro Controllers An Overview Anil Aswani December 1 2005 1 Introduction With the advent of low cost processors and accessories the ability to do control digitally has become increasingly feasible this has led to a dramatic change in the way controllers are designed tested and implemented Moreover these digital controllers are usually more robust and easier to design than their analog counterparts A micro controller MC is the processor that is used to do the digital control Specially designed MC s often include built in peripherals such as memory analog digital convertors and timers to deal with the practicalities of doing MC design A controller is a program written on the MC that does the control The controller must be able to read information from the outside world process the information and output a control signal based on the information Digital controller design has a unique set of constraints which must be met The controller must be 1 Functional The MC must be able to do the control This means that it must be fast enough to sample the reference and feedback signals process the signals and output a control signal that stabilizes the system and meets the design constraints The requirement of a low system time delay due to the controller is inherent in these constraints 2 Cheap Many times cheaper MC s have limited computation abilities they are unable to do floatingpoint computations This means that computations must be done with fixd point computations Also the amount of memory and the speed of the MC are minimal 3 Fast Many systems use a single MC to do multiple tasks Thus a single controller on a MC must behave nicely First the controller should not use significant computation power Second the controller should be modular in terms of memory usage and other MC peripherals usage These constraints and the overall flow of MC design will be explained further in this overview 2 MC Paradigm A MC must be able to take signals from the outside world process the signals and output control signals The transition between the outside world outside the MC and the inside world inside the MC is an important one to understand Conceptually we start with analog signals pass the analog filter through an anti aliasing filter sample and quantize the signal process the digital signal in the MC reconstruct the signal with a zero order hold The reconstructed analog signal can be passed through an optional anti imaging filter This process is seen in Figure 1 The sampling must be fast enough to be able to do the control The difficulties arise through having to satisfy the Nyquist rate keep the system time delay low The theoretical minimum sampling rate is given by the Nyquist rate but in practice we sample several times faster than the Nyquist rate Unfortunately we are limited in how fast we sample by how much data the MC can process and by the sampling abilities of the MC Moreover we need to keep the system time delay low System time delays add a phase lag which can lead to instability if the phase lag time delay is large 1 Micro Controller Reference Input Anti Alias Filter Sampler Quantizer Micro Controller Control Law Zero Order Hold Anti Imaging Filter Optional Plant Output Sensors Figure 1 The Micro Controller Paradigm 3 Controller Flow The program flow of the controller is non linear The difficulties arise with the need to sample data and process the data at the same time There are two approches to this problem one approach uses interrupts and the other uses high level MC functions written by the MC manufacturer Interrupts can be thought of as event driven programming In other words when a special event occurs e g the timer counts down to zero the interrupt stops the program and calls a special function After this special function finishes the processor goes back to the last position in the original program and continues running With interrupts two approaches can be used for the controller flow One approach is to process and implement the control laws as a function called from inside the interrupt The pseudo code for this approach is interrupt on timer reaches zero turn off interrupts initiate adc conversion reset timer turn on interrupts interrupt on adc conversion completes turn off interrupts read sample process sample implement control law includes output turn on interrupts main setup timers setup peripherals while 1 process data The approach using the high level MC functions and the other approach using the interrupts are essen2 tially the same In this approach the interrupt or high level function is used to grab data from the outside world and then the processing is done inside the main loop of the code Using these high level functions it is important to set the sampling rate and the rate of the control law The pseudo code for this method is main setup timers setup peripherals while 1 set rates read data from outside using interrupts or high level functions process data Modular programming is important because in many systems there are multiple controllers on a single MC For instance in a car the MC will have a controller for cruise control another controller for the fuelinjection system and so on Therefore the controller has to be written in a way that it is able to run with other controllers This means the controller should use as little processing power as possible should minimize peripheral usage and use memory carefully i e not overwrite the memory of other controllers An increasingly difficult problem to deal with is that different controllers require different input sampling rates and different output rates This difficulty is compounded by the need to share multiple data streams across different controllers Dealing with this problem requires careful planning and organization of the controllers on a single MC Interestingly this is also an area of active research because of the ever increasing complexity of these systems 4 Peripherals MC s often include several built in peripherals including timers memory and analog digital convertors The timers are usually used to set the sampling rate and the output rate but they can also be used to get a measurement of the time in seconds elapsed between different events The analog digital convertors often require careful use since the bits these convertors input and output do not always match up between each other and with the integer representation used by the MC For instance the MC we use in the lab has 16 bit integers a 10 bit analog digital


View Full Document

Berkeley ELENG C128 - Micro-Controllers: An Overview

Loading Unlocking...
Login

Join to view Micro-Controllers: An Overview and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Micro-Controllers: An Overview and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?