190 likes | 251 Views
Fundamentals of Programming Languages-II. Subject Code: 110010 Teaching Scheme Examination Scheme Theory: 1 Hr./Week Online Examination: 50 Marks Practical: 2 Hrs./Week. Unit-I. Microprocessors and Micro-Controllers Architectures and Programming Concepts. 1.7 PIC MICROCONTROLLER SYSTEMS.
E N D
Fundamentals of Programming Languages-II Subject Code: 110010 Teaching Scheme Examination Scheme Theory: 1 Hr./Week Online Examination: 50 Marks Practical: 2 Hrs./Week
Unit-I Microprocessors and Micro-Controllers Architectures and Programming Concepts
1.7.1 Introduction • In 1989, Microchip Technology Corporation introduced an 8-bit microcontroller called the PIC which stands for Peripheral Interface Controller. • It has RISC architecture that comes with standard features. • It has on-chip program(code) ROM, data RAM, data EEPROM, timers, ADC, and USART and I/O ports.
PIC18 has 16-bit instruction format i.e. all the instructions are of 16 bit. • PIC18 is a 8-bit microcontroller that can operate at different speeds varying from DC to 40MHz. • PIC is a RISC processor. • Analog to digital conversion with 10-bit resolution. • Power saving modes. • Controller Area Network(CAN) • SRAM & EEPROM
Harvard Architecture • Von Neumann Architecture: • Fetches instructions and data from a single memory space • Limits operating bandwidth • Harvard Architecture: • Uses two separate memory spaces for program instructions and data • Improved operating bandwidth • Allows for different bus widths
The Program Memory: It may also provide the instructions in case of internal memory access. This program memory is also connected to the instruction register through the ROM latch like system interface data bus. • 8-level Stack: A 8 level stack is provided for storing the return address in program counter. • Internal Data RAM is provided whose data lines are connected to the system data bus. The address is taken through FSR, a file select registers that provide 8 bit address required to access RAM.
ALU gets one of the input operand from W register (WREG) or IR. The other operand may be given either from a register or a memory location, and hence the other input side of ALU is connected to the internal data bus. • Different reset mechanisms • Power-on Reset (POR) • MCLR Reset during normal operation • MCLR reset during sleep • Watchdog Timer (WDT) • Programmable Brown-out Reset (PBOR) • RESET Instruction • Stack full reset • Stack Underflow Reset • Watchdog timer resets the processor if it hangs.
A configuration bit, BOREN(Brown out Reset enable), can enable or disable the Brown-out Reset circuitry. • There are five I/O ports (A, B, C, D, E) available on PIC18F877 device. • Each port has three registers for its operation • TRIS register (data direction register) • PORT register (reads the levels on the pins of the device) • LAT register (Output latch): The Data Latch (LAT register) is useful for read-modify-write operations on the value that the I/O pins are driving.
There are three timers (Timer 0 to Timer 2) of 8-10 bits with different features. Timers have features like Compare, Capture and PWM(CCP). • There is also a 10 bit Analog to Digital Converter (ADC). Hence the resolution of 1024 levels. • PIC18f877 also has an Analog Comparator. • Serial peripheral interface (SPI) port : It is a full duplex port i. e. it allows 8 bits of data to be synchronously transmitted and received simultaneously.
USART port: It is Universal Synchronous Asynchronous Receiver Transmitter. It has a USART which can be configured as a full-duplex asynchronous system that can communicate with peripheral devices such as CRT terminals and personal computers.
The PIC18 Memory Organization • There are three sections of memory in PIC18 namely program memory, data RAM and data EEPROM. • Data Memory and SFR Basics • Data memory is implemented using SRAM (static RAM). • Each location in the data memory is also referred to as a register. • The PIC18f877 microcontroller supports 368 bytes of data memory locations.
It requires 9 bits of address to select one of the data registers. • There are four banks of 128 registers each. • The banks contain the General Purpose Registers and the Special Function Registers. Bits RP1 and RP0 are the bank select bits.
Program Memory Organization • PIC18 microcontroller has a 13 bit program counter and hence is capable of addressing a 8KB program memory space.
It has a 8-entry return address stack; which is used to hold return addresses for subroutine call and interrupt processing. • The reset vector is at address 0000H. • The interrupt vector address is 0004H. • The address 0005H onwards is user memory, divided into four pages to store the programs.