PIC MICROCONTROLLER

Views:
 
Category: Education
     
 

Presentation Description

No description available.

Comments

By: alaabirshaid (2 week(s) ago)

Please honey i need the ppt form could you send it to my email alaabaniirshaid@gmail.com

By: ksaranyadece (1 month(s) ago)

can u send me the ppt to ksaranyadece@gmail.com

By: soronjuaredar (2 month(s) ago)

plz send this ppt to my mail rubel.stsoft@gmail.com

By: devigovindhan10 (7 month(s) ago)

Ppt is nice... please send me.. kottivrp@gmail.com

By: vishalnagpal714 (14 month(s) ago)

pls send it on nvishal44@gmail.com

See all

Presentation Transcript

Slide 1:

PIC 16F877 MICROCONTROLLER SUBMITTED BY ANAMIKA GUPTA ME REGULAR(E.C.E) PIC 16F877

What is a Microcontroller? :

What is a Microcontroller? A single chip that contains Processor (the CPU) Non-volatile memory for the program (ROM or flash) Volatile memory for input and output (RAM) Clock An I/O control unit. Also called a "computer on a chip" Billions of microcontroller units (MCUs) are embedded each year in a large number of products from toys to automobiles. For example, a single vehicle can use 70 or more microcontrollers. . 2 PIC 16F877

Slide 3:

3 Microcontrollers are designed for embedded applications, in contrast to the microprocessor used in personal computers or other general purpose applications. PIC microcontroller chips from Microchip are the world's smallest microcontrollers. PIC 16F877

FLASH Microcontrollers:

FLASH Microcontrollers Using microcontrollers with integrated FLASH memory modules provides greater flexibility with regard to field programmability. FLASH EEPROMs are fundamentally different from One Time Programmable devices, in that FLASH modules are electrically erasable. Add robustness to reprogramability . FLASH devices can be repeatedly erased and reprogrammed while installed in the user application. Reduced programming time and reduce cost. 4 PIC 16F877

PIC Architecture :

PIC Architecture Peripheral interface controllers is a family of microcontrollers by Microchip Technology. Programming a PIC processor is much easier ,have attractive features and they are suitable for a wide range of applications. Harvard architecture. Use of separated program and data memories. Make data and address buses separate allowing increased data flow to and from the CPU. Data and address busses can be different widths . 5 PIC 16F877

Feature of 16F877 :

Feature of 16F877 8 kbytes of FLASH Program Memory. 368 bytes of Data Memory (RAM ). 256 bytes of EEPROM Data Memory. 33 input or output pins. 20 MHz operating speed(200 ns instruction cycle) High performance RISC CPU. Only 35 simple word instructions. All single cycle instructions except for program branches which are two cycles. Power on Reset (POR). Power-Up Timer (PWRT) and oscillator start-up timer. Low power- high speed CMOS 8-bit flash microcontroller . 6 PIC 16F877

Feature of 16F866 …….:

Feature of 16F866 ……. Wide operating voltage range (2.0 – 5.56)volts. Low power consumption . Synchronous Serial Port (SSP) with SPI (master code) and I2C (master/slave). PICs have different on-board peripherals. Some common peripherals are: Analog to Digital Converters (ADC) Serial communications: UART ,SPI, I 2 C Timers and counters (8 and 16bit) Watchdog timers, Brown out timers. 7 PIC 16F877

Pin Diagram PIC 16F877:

Pin Diagram PIC 16F877 8 PIC 16F877

PIC Block Diagram:

PIC Block Diagram 9 PIC 16F877

PIC 16F877 Block Diagram:

PIC 16F877 Block Diagram 10 PIC 16F877

CPU :

CPU A PIC CPU consists of several sub units such as instruction decoder, ALU, accumulator, control unit, etc. It normally supports Reduced Instruction Set Computer (RISC) architecture, a type of microprocessor that focuses on rapid and efficient processing of a relatively small set of instructions. RISC design in which most of the instructions a computer decodes and executes are simple. 11 PIC 16F877

These RISC structure gives the following advantages:

These RISC structure gives the following advantages The RISC structure only has 35 simple instructions as compared to other. The execution time is same for most of the instructions (except very few numbers). The execution time required is very less (5 million instructions/second (approximately). 12 PIC 16F877

Memory :

Memory The memory in a PIC chip used to store the data and programs temporary or permanently. As like normal microcontrollers, the PIC chip also has certain amount of RAM, ROM, EEPROM, other flash memory, etc. A PIC Chip normally contains a certain amount of flash memory. ALU Perform operations on temporary working register and register file. 8 bit wide ALU. One of the operand is normally in W register and the other one is either a fine register on an immediate constant. Effect various flags ,namely,carry,digit carry, zero in Status register .. 13 PIC 16F877

Bus :

Bus BUS is the communication or data transmission/reception path in a microcontroller unit. In a normal microcontroller chip, two types of  buses are normally available. 1)  Data bus Data bus is used for memory addressing. The function of data bus is interfacing all the circuitry components inside the PIC chip. 2) Addressbus Address bus mostly used for memory addressing. The function of address bus is to transmit the address from the CPU to memory locations. 14 PIC 16F877

Power on reset:

Power on reset The task of POR is ensuring that the processor starts at known address when power is first on. The reset function will set the program counter to the starting address. Power up timer A special timer that delay the start of program execution after the PIC has been reset on power. This time delay allows V DD to rise to the required level. Brown out delay When the power supply drops below a certain voltage(4 v in case of PIC),it causes PIC to reset. PIC 16F877 15

WDT:

WDT A watch dog timer is a simple timer circuit that performs a specific operation after a certain period of time if something goes wrong. Suppose we have written a program which is compiled successfully and when we simulate it every time seems to work fine. Then we program the PIC. However after a long period of time the program gets stuck somewhere . What needs it this case is some kind of reset if the program is gets stuck. This is a purpose of a watchdog timer circuit. When the WDT is enable, a counter starts at 00 and increment by 1 unit until it reaches FF. PIC 16F877 16

WDT…..:

When it goes from FF to 00 the PIC will be reset, irrespective of what it is doing. The only way we can stop the WDT, from resetting the WDT back to 00 throughout the program which is done by the processor. Which indicates that the processor functioning is going on. Watchdog timer is thus increases the system reliability. PIC 16F877 17 WDT …..

ICD:

ICD One the great advantages of PIC 16F877 the In-Circuit Debugger (ICD). With the ICD we can watch our program run in the chip/module and find any bugs or programming mistakes as they happen. It's like making everything happen in slow motion so you can see where the error occurred. To use ICD we simply press the DEBUG button. Debug add a block of code to our program that is used by the ICD. The added ICD block of code sends variable values, internal register values and other details to the PC through the programming cable. The ICD, will display that data ,by using the ICD debug tool. 18 PIC 16F877

CPU Register:

CPU Register W or Working Resister(8-bits) STATUS Resister(8 bits) FSR(File Selection Register(8 bits) PCLATH(Program Counter Latch) (5 bits) PCL(Program Counter Byte)(8 bits) 19 PIC 16F877

W or Working Resister:

W or Working Resister 8 bits wide Contains one of the source operands during the execution of instructions. Serve as the destination for the result of the operation. Only used for ALU operations. . 20 PIC 16F877

Status Register :

Status Register Status register is an eight bit register that contains the arithmetic status of the arithmetic logic unit (ALU), the reset status and the bank select bits for the data memory. The detailed explanation of status register is given below. Carry bit(C) When two 8-bit operands are added ,a 9 bits result occurs,because the result of addition may exceeds 256(FFH). The 9 th bit is copied in the Carry bit. Bit 0 (C): Carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF instructions) 1 = A carry-out from the Most Significant bit of the result occurred 0 = No carry-out from the Most Significant bit of the result occurred. 21 PIC 16F877

Slide 22:

Digit carry(DC) This bit indicates a Carry from the lower 4 bits,during 8 bit addition. If set,it means there is a carry from the 3 rd bit to 4 th bit position. Bit 1 DC: Digit carry/borrow bit (ADDWF, ADDLW, SUBLW, SUBWF instructions) (For borrow, the polarity is reversed) (1 = A carry-out from the 4th low order bit of the result occurred 0 = No carry-out from the 4th low order bit of the result. 22 PIC 16F877

Slide 23:

Zero(Z) Many arithmetic and logic instructions affect the zero flag. Decf instruction can be used to decrement a variable in RAM, and if result is zero,Zbit is set, otherwise cleared. Bit 2, (Z): Zero bit 1 = the result of an arithmetic or logic operation is zero 0 = the result of an arithmetic or logic operation is not zero.) TO and PD(active low) Used along with the SLEEP mode of PIC. During the sleep mode the microcontroller save lots of power. After coming out of this mode, the CPU can check these two status bits to determine which kind of event is responsible to bring it out of the SLEEP mode. Bit 4, (TO): this is a time-out bit used for timing and counting, sleep and reset functions. 1 = after power-up, CLRWDT instruction or SLEEP instruction 0 = A WDT time-out occurred 23 PIC 16F877

Slide 24:

Bit 3, (PD): Power-down bit 1 = after power-up or by the CLRWDT instruction 0 = by execution of the SLEEP instruction RP0 and RP1 There are four memory banks ,each of 128 bytes in size. For bank selection 2 bits are needed, making the effective address 9-bit wide . 24 PIC 16F877

Direct addressing mode :

Direct addressing mode Microchip has provided only direct addressing mode for the register file with 7-bits address plus remaining 8 th and 9 th bits frozen in the STATUS REGISTER bits RP1:RP2. 11 = Bank 3 (180h-1FFh) 10 = Bank 2 (100h-17Fh) 01 = Bank 1 (80h-FFh) 00 = Bank 0 (00h-7Fh) As shown in figure 25 PIC 16F877

Use of RP1:RP0 bits in direct addressing mode:

Use of RP1:RP0 bits in direct addressing mode 26 PIC 16F877

Indirect addressing mode :

Indirect addressing mode IRP bit is used for indirect addressing. The IRP bit allows selecting either 1= Bank 2 & bank 3 0= Bank 0 & bank 1 The IPR bit and FSR decide the effective 9 bit address. As shown in figure 27 PIC 16F877

Use of IPR bits in indirect addressing mode:

Use of IPR bits in indirect addressing mode 28 PIC 16F877

FSR (File Selection Register):

FSR ( File Selection Register ) FSR is the pointer used for indirect memory addressing in the whole register file. In PIC every instruction that can be used for direct addressing may also be used in a different way for indirect addressing. The only difference in indirect addressing mode is that one has to write the address byte in FSR . 29 PIC 16F877

PCLATH (Program Counter Latch):

PCLATH (Program Counter Latch) Different from the program counter. Any write to PCL will cause the contents of PCLATH to be transferred to the 13 bit PC higher locations. 30 PIC 16F877

PCL:

PCL 31 Program Counter byte. PCL is the lower byte of the PC. Cause PCLATH contents to be transferred to the PC higher bit locations. PC of PIC is associated with an 8-level stack. PC always points to the next instruction to be executed. In case of call to subroutines, the returned address is pushed onto the stack. After the return from called subroutine, this return address is retrieved. Stack width and PC width should be same . PIC 16F877

Power Control Register:

Power Control Register Contains the flags which can differentiate between the type of reset occurred namely Power on reset Brown out reset 32 PIC 16F877

Option_Reg Register:

Option_Reg Register Bit 7 (RBPU): This is a PORT B Pull-up Enable bit. 1 = PORTB pull-ups are disabled. 0 = PORTB pull-ups are enabled by individual port latch values. Bit 6 (INTEDG): This is an Interrupt Edge Select bit. This bit decided if the interrupt is on either rising edge or falling edge. The function of this bit is given below. 1 = Interrupt on rising edge of RB0/INT pin. 0 = Interrupt on falling edge of RB0/INT pin. 33 PIC 16F877

Slide 34:

Bit 5 (T0CS): this is a timer-0(TMR0) Clock Source Select bit and its function is given below. 1 = Transition on RA4/T0CKI pin. 0 = Internal instruction cycle clock. Bit 4 (T0SE): TMR0 Source Edge Select bit which select the timer 0 source edge. 1 = Increment on high-to-low transition on RA4/T0CKI pin. 0 = Increment on low-to-high transition on RA4/T0CKI pin. Bit 3 (PSA ): Prescaler Assignment bit. 1 = Prescaler is assigned to the Watch Dog Timer (WDT). 0 = Prescaler is assigned to the Timer0 module.) Bit 2-0 (PS2:PS0): Prescaler Rate Select bits 34 PIC 16F877

Stack :

Stack The entire PIC chip has an area for storing the return addresses. This area or unit called Stack is used in some Peripheral interface controllers. The hardware stack is not accessible by software. But  for most of the controllers, it can be easily accessible. 35 PIC 16F877

Input/output ports :

Input/output ports PIC 16F877 series normally has five input/output ports. They are used for the input/output interfacing with other devices/circuits. Most of these port pins are multiplexed for handling alternate function for peripheral features on the devices. The PIC 16F877 chip basically has 5 input/output ports. PORT A PORT B PORT C PORT D PORT E 36 PIC 16F877

Memory Organization of PIC16F877 :

Memory Organization of PIC16F877 PIC microcontrollers have separated memory and data memory with separated address and data buses. The memory of a PIC 16F877 chip is divided into 2 sections. They are Program memory Data memory 37 PIC 16F877

Program memory:

Program memory Program memory contains the programs that are written by the user. The program counter (PC) executes these stored commands one by one. Usually PIC16F877 devices have a 13 bit wide program counter that is capable of addressing 8K×14 bit wide flash program memory space. That can be electrically erasable /reprogrammed. This memory is primarily used for storing the programs that are written (burned) to be used by the PIC. 38 PIC 16F877

Program memory map of 16F877:

Program memory map of 16F877 39 PIC 16F877

Program memory……:

Program memory…… Program counters (PC) is used to keep the track of the program execution by holding the address of the current instruction. The counter is automatically incremented to the next instruction during the current instruction execution. Each time the main program execution starts at address 0000 – Reset Vector. The address 0004 is “reserved” for the “interrupt service routine” (ISR). 40 PIC 16F877

PIC16F87XA Data Memory Organization:

PIC16F87XA Data Memory Organization Data memory is divided in two four banks, Each bank holds 128 bytes of addressable memory. Contain GPR and SPR. The banked arrangement is necessary because there are only 7 bits are available in the instruction word for the addressing of a register, which gives only 128 addresses. The selection of the banks are determined by control bits RP1, RP0 in the STATUS registers Together the RP1, RP0 and the specified 7 bits effectively form a 9 bit address. 41 PIC 16F877

Slide 42:

42 PIC 16F877

Advantages of PIC Controlled System :

Advantages of PIC Controlled System Reliability The PIC controlled system often resides machines that are expected to run continuously for many years without any error and in some cases recover by themselves if an error occurs. Performance Many of the PIC based embedded system use a simple pipelined RISC processor for computation Power consumption A PIC controlled system operates with minimal power consumption without sacrificing performance.. Memory Most of the PIC based systems are memory expandable and will help of this we can easily adding more and more memory according to the usage and type of application. 43 PIC 16F877

Slide 44:

THANK YOU PIC 16F877