Criteria for choosing a microcontroller A microcontroller must meet the task at hand efficiency and cost effectively. Speed. What is highest speed of.

Slides:



Advertisements
Similar presentations
EUSART Serial Communication.
Advertisements

ECT 357 Ch 18 UART. Today’s Quote: Be careful that your marriage doesn’t become a duel instead of a duet. Be careful that your marriage doesn’t become.
The 8051 Microcontroller Chapter 5 SERIAL PORT OPERATION.
Starting with serial Chapter Ten 10.1, 10.2,
Eng. Husam Alzaq The Islamic Uni. Of Gaza
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
1 ECE 263 Embedded System Design Lessons 2, 3 68HC12 Hardware Overview, Subsystems, and memory System.
Microcontroller Architecture— PIC18F Family
EEE305 Microcontroller Systems Lecture 7: Embedded C using PIC microcontrollers Serial i/o with the XC8 Teaching resources are at
Microcontroller Architecture PIC18F Family
Embedded System Spring, 2011 Lecture 3: The PIC Microcontrollers Eng. Wazen M. Shbair.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
VEHICLE THEFT INTIMATION TO THE OWNER ON HIS CELL PHONE BY GSM
Microcontroller Programming How to make something almost do something else Raffi Krikorian MAS November 2003.
Serial Communication ETEC 6416.
ECE/CS-352: Embedded Microcontroller Systems Embedded Microcontroller Systems.
Input/Output mechanisms
S4525A Peripherals & Enhanced FLASH 1 © 1999 Microchip Technology Incorporated. All Rights Reserved. S4525A Peripherals & Enhanced FLASH 1 Peripherals.
16F877A. Timer 0 The Timer0 module timer/counter has the following features: –8-bit timer/counter –Readable and writable –8-bit software programmable.
Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
AT91 Embedded Peripherals
Digital to Analogue Converter
“Describe the overview of hardware interfacing and the serial communication interface. Describe the PIC18 connections to RS232. Explain the serial port.
Microprocessors 2 lesson Subjects lesson 7 Planning Interrupts Serial communication /USART Questions.
Embedded System Design Laboratory October 4, 2002Stanford University - EE281 Lecture #3#1 Lecture #3 Outline Announcements AVR Processor Resources –UART.
Prepared by Eng. Musa Alyaman1 Chapter Seven Chapter Seven PIC16F87x.
Other Chapters From the text by Valvano: Introduction to Embedded Systems: Interfacing to the Freescale 9S12.
Example. SBUF Register SCON Register(1) SCON Register(2)
MICROCONTROLLER SYSTEMS Part 1. Figure 1.1Elements of a digital controller CPU Central Processing Unit Input Peripherals Output Peripherals ROM Read Only.
Atmel Atmega128 Overview ALU Particulars RISC Architecture 133, Mostly single cycle instructions 2 Address instructions (opcode, Rs, Rd, offset) 32x8 Register.
MCS51 - lecture 6. Lecture 6 1/32 Extending MCS51 system Built-in peripherals MCS51 family.
ATtiny23131 A SEMINAR ON AVR MICROCONTROLLER ATtiny2313.
Chapter 7 Larger Systems and the PIC 16F873A The aims of this chapter are to introduce: The architecture of the 16F873A microcontroller; The 16F873A memory.
Architecture and instruction set. Microcontroller Core Features:  Operating speed: DC - 20 MHz clock input DC ns instruction cycle Up to 8K x.
© 2009, Renesas Technology America, Inc., All Rights Reserved 1 Course Introduction  Purpose:  This course provides an overview of the serial communication.
Presented by Sadhish Prabhu
Device Overview 1.  The advantages of all PIC18Fxxxx microcontrollers:  High computational performance  High-endurance  Enhanced Flash program memory.
Features of the PIC18 microcontroller - 8-bit CPU - 2 MB program memory space (internal 32KB to 128KB) bytes to 1KB of data EEPROM - Up to 4096 bytes.
Components of a typical full-featured microcontroller.
Microcontrollers JULES CALELLA. Microcontrollers vs Microprocessors  Microprocessors – do not contain RAM, ROM, I/O  Microcontrollers – The whole package.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
CEng3361/18 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2007 Recitation 01.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
 Mini-Computer ◦ Microprocessor  The Brains  Arithmetic Logic Unit (ALU)  Control Unit  Program/ Data Storage  Peripherals (Input/Output)  Low-Cost.
USING TV REMOTE AS A CORDLESS MOUSE FOR THE COMPUTER
CORDLESS MOUSE FEATURES BY TV REMOTE USING PIC MICROCONTROLLER
16F877A.
Embedded Microcontroller Systems
PIC CONTROLLED DYNAMIC TIME BASED CITY TRAFFIC SIGNAL
INT. TO EMBEDDED SYSTEMS DEVELOPMENT
Networking of Multiple street junction signals for better traffic management Submitted by:
DTMF BASED REMOTE INDUSTRIAL LOAD AND/OR AGRICULTURAL PUMP CONTROL
Embedded Microcontroller Systems
Chapter 10 PIC18 Serial Port Programming in Assembly
Diagram of microprocessor interface with IO devices
DENSITY BASED TRAFFIC LIGHT TIMING CONTROL
SERIAL PORT PROGRAMMING
SYNCHRONIZED TRAFFIC JUNCTION SIGNALING (GET GREEN SIGNAL ALL-THROUGH AT ANY STREET JUNCTION)-A NEW CONCEPT TO EASE TRAFFIC CONGESTION IN METROS Submitted.
Project Title EVM IN PIC Under the Guidance of Submitted by.
E3165 DIGITAL ELECTRONIC SYSTEM
Atmega32 Serial Programming Basics
The Arduino Microcontroller: Atmel AVR Atmega 328
Introduction to Microprocessors and Microcontrollers
USART Universal Synchronous Asynchronous Receiver Transmitter
Serial Communication Interface
AVR – ATmega103(ATMEL) Architecture & Summary
EUSART Serial Communication.
A PROJECT ON PASSWORD BASED CONTROL SYSTEM. A PROJECT ON PASSWORD BASED CONTROL SYSTEM.
PIC Serial Port Interfacing
PIC Serial Port Interfacing
Presentation transcript:

Criteria for choosing a microcontroller A microcontroller must meet the task at hand efficiency and cost effectively. Speed. What is highest speed of microcontroller? To access the data, the address is presented to address pin, the READ pin is activated and after certin time data shows up. Packaging. Its 40 pin DIP(dual inline package) or QFP(Quad flat package). This is important in terms of space, assembling, prototyping. IEEE UMT, Presented By Farhan Ammar Ahmad

Criteria for choosing a microcontroller The amount of RAM and ROM. Power consumption. Especially for battery powered. The number of I/O pins and timers on chip. IEEE UMT, Presented By Farhan Ammar Ahmad

Types of microcontrollers There several dozen types of microcontrollers architectures and venders including PIC Intel 8051 Freescale Rabbit 2000 Ziliog eZ8 Toshiba TLCS-870 And many others types are there. But we will discuss PIC. IEEE UMT, Presented By Farhan Ammar Ahmad

PIC Microcontroller PIC stands for Peripheral Interface Controller PIC is product of Microchip Technology. IEEE UMT, Presented By Farhan Ammar Ahmad

Why PIC microcontroller? As we have discussed criteria for choosing microcontroller. PIC is very popular in industry. Wide availability Extensive collection of application notes. Availability of low cost or free development tools. Self-reprogrammable under software control We will discuss PIC16F877A. Its an 8-bit microcontroller. IEEE UMT, Presented By Farhan Ammar Ahmad

PIC16F877A IEEE UMT, Presented By Farhan Ammar Ahmad

PIC16F877A Peripheral Features Timer0: 8-bit timer/counter Timer1: 16-bit timer/counter Timer2: 8-bit timer/counter Operating speed: DC – 20 MHz clock input Up to 8K x 14 words of Flash Program Memory Up to 368 x 8 bytes of Data Memory (RAM), Up to 256 x 8 bytes of EEPROM Data Memory Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) Parallel Slave Port (PSP) – 8 bits wide with external RD, WR and CS controls IEEE UMT, Presented By Farhan Ammar Ahmad

PIC16F877A Analog Features: 10-bit, up to 8-channel Analog-to-Digital Converter (A/D) Special Microcontroller Features Self-reprogrammable under software control In-Circuit Serial Programming™ (ICSP™) via two pins Single-supply 5V In-Circuit Serial Programming Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation Programmable code protection Power saving Sleep mode Selectable oscillator options In-Circuit Debug (ICD) via two pins Enables you to view variable values, Special Function Register and EEPORM while the program is running. IEEE UMT, Presented By Farhan Ammar Ahmad

I/O ports of PIC16F877A Some pins for these I/O ports are multiplexed with an alternate function for the peripheral features on the device. There are five ports on PIC16F877A. Port A Port B Port C Port D Port E IEEE UMT, Presented By Farhan Ammar Ahmad

PORT A 6-bit wide, bidirectional port. Data direction register is TRISA. If TRISA=1 then PORTA input port vice versa. Pin PA4 is multiplexed with Timer0 module clock input to become the PA4/TOCK1 pin. Other PORTA pins are multiplexed with Analog input. On power reset these pins are analog input. IEEE UMT, Presented By Farhan Ammar Ahmad

PORTB 8-bit wide, bidirectional port. Data direction register is TRISB. If TRISB=1, then PORTB is input else output. Three pins RB3/PGM, RB6/PGC and RB7/PGD are multiplexed with in circuit debugging and low voltage programming function. RB0/INT is an external interrupt pin and is configured using then INTEDG bit OPTION_REG. IEEE UMT, Presented By Farhan Ammar Ahmad

PORTC PORTC is 8-bit wide, bidirectional port. Data direction register is TRISC. RC0/T1OSO/T1CKI Input/output port pin Timer1 oscillator output Timer1 clock input. RC1/T1OSI/CCP2 Input/output port pin Timer1 oscillator input PWM2 output. IEEE UMT, Presented By Farhan Ammar Ahmad

PORTC RC2/CCP1 Input/output port pin PWM1 output. RC3/SCK/SCL RC3 can also be the synchronous serial clock for SPI mode. RC4/SDI RC4 can also be the SPI data in (SPI mode) IEEE UMT, Presented By Farhan Ammar Ahmad

PORTC RC5/SDO Input/output port pin Synchronous Serial Port data output. RC6/TX/CK Input/output port pin USART asynchronous transmit synchronous clock. RC7/RX/DT Input/output port pin USART asynchronous receive synchronous data. IEEE UMT, Presented By Farhan Ammar Ahmad

PORTD 8-bit wide port. This port can be I/O or Parallel Slave Port. IEEE UMT, Presented By Farhan Ammar Ahmad

PORTE Three pins port. The PORTE pins become the I/O control inputs for the microprocessor port when bit PSPMODE (TRISE ) is set. RE0/RD/AN5 I/O port pin read control input in Parallel Slave Port mode analog input RE1/WR/AN6 I/O port pin write control input in Parallel Slave Port mode analog input RE2/CS/AN7 I/O port pin chip select control input in Parallel Slave Port mode analog input PORTE pins are multiplexed with analog inputs. IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming Universal Synchronous Asynchronous Receiver Transmitter (USART) module a serial communication module. USART is also known as Serial Communication Interface SCI. IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming USART can be configured full-duplex or half-duplex. Using USART you can communicate with peripherals, EEPROM or other microcontrollers IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming Data is transmitted in binary. Difficult to understand unless sender and receiver agree on same protocol. Commonly used standard protocol is RS232. IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming In asynchronous each character is placed between a start and stop bit and this is called framing. Normally ASCII characters are packed in frames. Data is transferred in bits per seconds. And widely used term is baud rate. IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming In UART mode six registers are associated with serial. 1. SPBRG (Serial Port Baud Rate Generator) 2. TXREG (Transfer Register) 3. RCREG (Receive Register) 4. TXSTA (Transmit status and control register) 5. RCSTA (Receive status and control register) 6. PIR (Peripheral Interrupt Register) IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming How to enable Asynchronous 8-bit UART mode? Calculate Baud rate and load then in SPBRG register Desired Baud Rate = Where X is valued loaded into the SPBGR and Fosc is oscillator frequency. For example Fosc=4MHz X= X= = 25 IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming TXSTA (Transmit status and control register) Load “ ” CSRC –clock source select 1 for synchronous and 0 for asynchronous TX9 – 9-bit Transmit enable 1=9-bit data and 0=8-bit data TXEN –Transmit Enable 1=Transmit Enable and 0=Transmit Disable SYNC –USART mode select 1=Synchronous and 0=Asynchronous CSRCTX9TXENSYNC0BRGHTRMTTXD9 IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming BRGH –High Baud Rate Select 0=Low speed and 1=High Speed TRMT –Transmit Shift Register Status 1=TSR empty and 0=TSR Full TXD9 -9 th bit of Transmit Data If 8-bit data option then D0=0 IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming RCSTA (Receive status and control register) Load “ ” SPEN –Serial port enable bit 1=port enable and 0=port disable RX9 -9-bit receive enable 1=select 9-bit reception and 0=select 8-bit reception SREN –Single receive enable bit Not used in asynchronous mode SPENRX9SRENCRENADDEFERROERRTXD9 IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming CREN –Continuous receive enable bit 1=enable and 0=disable ADDEN –Address delete enable bit Used with 9-bit, in 8-bit it is 0 FERR –Framing error bit 1=Framing error and 0=No framing error OERR –Overrun error bit 1=Overrun error and 0=No overrun error TXD9 -9 th bit of receive data In 8-bit mode it is 0 IEEE UMT, Presented By Farhan Ammar Ahmad

Serial Programming PIR (Peripheral Interrupt Register) RCIF –Receive Interrupt Flag bit 1=UART has received data and sitting in RCREG to be picked 0=RCREG is empty TXIF –Transmit Interrupt Flag bit 0=The TXREG register is full 1=The TXREG is empty RCIFTXIF IEEE UMT, Presented By Farhan Ammar Ahmad

Analog to Digital Conversion ADCs are most widely used devices for data acquisition. Physical world is analog but our microcontroller and microprocessors are digital. Temperature, velocity, humidity are few examples. A physical quantity is converted to electrical signal using sensor. And then analog signal is converted to digital for further processing. IEEE UMT, Presented By Farhan Ammar Ahmad

Analog to Digital Conversion Important factors are to considered when doing ADC. Resolution ADC has n-bit resolution. PIC16F877A supports 8 and 10 bit. Higher resolution ADC provides smaller step size. Step size is smallest change that ADC can detect. Step size can be control with Vref. Conversion Time Conversion time is time it takes the ADC to convert the analog input to Digital. Vref Vref is input voltage used for reference. Vref and resolution dictates the step size. For 8-bit step size =Vref/256. IEEE UMT, Presented By Farhan Ammar Ahmad

Analog to Digital Conversion Digital Data Output Dout=Vin/Step size ADC channel Many data acquisition application need more than one ADC. PIC16F877A supports 10 ADC channels. Start Conversion (SC) and End of Conversion Signals (EOC) For multiple channels, these is a single digital output register. SC and EOC is necessary. When SC is activated, ADC start converting and after conversion data is put in output register. IEEE UMT, Presented By Farhan Ammar Ahmad

Timers The Timer0 module timer/counter has the following features: 8-bit timer/counter Readable and writable Internal or external clock select Interrupt on overflow from FFh to 00h Edge select for external clock IEEE UMT, Presented By Farhan Ammar Ahmad

Thank You IEEE UMT, Presented By Farhan Ammar Ahmad