Embedded Systems • From automotive industries and controlling home appliances to industrial instruments, remote sensors, electrical door locks and safety devices microcontrollers play a important part . • It is also ideal for smart cards as well as for battery supplied devices because of its low consumption.
• An embedded system uses either a microprocessor or microcontroller to do one specific task only • For example: – CD-ROM – Printer – Microwave – Climate Control …etc
General Purpose MicroProcessor System
CPU General purpose Micro processor
RAM
ROM
I/O Ports
Timer
Serial Com port
Microcontroller
CPU
I/O
RAM
ROM
Timer
Serial Com Port
• EEPROM memory makes it easier to apply microcontrollers to devices where permanent storage of various parameters is needed (codes for transmitters, motor speed, receiver frequencies, etc.). • Low cost, low consumption, easy handling and flexibility make PIC16F84 applicable even in areas where microcontrollers had not previously been considered (example: timer functions, interface replacement in larger systems, coprocessor applications, etc.).
Choosing a microcontroller • Meeting the computing needs of the task at hand effectively and cost effectively. • Availability of software development tools such as compilers, assemblers and debuggers • Wide availability and reliable source of the microcontroller
1.Criteria for choosing the microcontroller • • • • • • •
Speed Packing Power consumption RAM/ROM I/O ports Up gradation Cost per unit
Address bus and Data Bus are seperate
Address bus and data bus are the same
• In Harvard architecture, data bus and address bus are separate. Thus a greater flow of data is possible through the central processing unit, and of course, a greater speed of work. • Separating a program from data memory makes it further possible for instructions not to have to be 8-bit words. PIC16F84 uses 14 bits for instructions which allows for all instructions to be one word instructions.
• PIC16F84 has a RISC architecture • Harvard architecture is a newer concept than von-Neumann's • Microcontrollers with Harvard architecture are also called "RISC microcontrollers". RISC stands for Reduced Instruction Set Computer • Microcontrollers with von-Neumann's architecture are called 'CISC microcontrollers'. Title CISC stands for Complex Instruction Set Computer.
• PIC16F84 perfectly fits many uses, from automotive industries and controlling home appliances to industrial instruments, remote sensors, electrical door locks and safety devices. It is also ideal for smart cards as well as for battery supplied devices because of its low consumption.
Port A
XT Oscillator
RC Oscillator
Reset
• Reset is used for putting the microcontroller into a 'known' condition • That practically means that microcontroller can behave rather inaccurately under certain undesirable conditions. • a) Reset during power on, POR (Power-On Reset) b) Reset during regular work by bringing logical zero to MCLR microcontroller's pin. c) Reset during SLEEP regime d) Reset at watchdog timer (WDT) overflow e) Reset during at WDT overflow during SLEEP work regime.
Ports
Ports
Port B
Port A
BSF MOVLW MOVWF BCF
03h,5 06h 85h 03h,5
;Go to Bank 1 ;Put 00110 into W ;Move 00110 onto TRISA ;Come back to Bank 0
Memory organization • Program memory – Program memory has been carried out in FLASH technology which makes it possible to program a microcontroller many times before it's installed into a device, and even after its installment if eventual changes in program or process parameters should occur. – The size of program memory is 1024 locations with 14 bits width where locations zero and four are reserved for reset and interrupt vector.
•
Data memory – Data memory consists of EEPROM and RAM memories. – EEPROM memory consists of 64 eight bit locations whose contents is not lost during loosing of power supply. EEPROM is not directly addressable, but is accessed indirectly through EEADR and EEDATA registers. – As EEPROM memory usually serves for storing important parameters (for example, of a given temperature in temperature regulators) , there is a strict procedure for writing in EEPROM which must be followed in order to avoid accidental writing. – RAM memory for data occupies space on a memory map from location 0x0C to 0x4F which comes to 68 locations. – Locations of RAM memory are also called GPR registers which is an abbreviation for General Purpose Registers. GPR registers can be accessed regardless of which bank is selected at the moment.