Example of Asyncronous Serial Comms on a PIC16F877

Size: px
Start display at page:

Download "Example of Asyncronous Serial Comms on a PIC16F877"

Transcription

1 /***************************************************************************************/ /* Example of Asyncronous Serial Comms on a PIC16F877 */ /* Target: PIC16F877 */ /* Baud: 9600 */ /* Bits: 8 */ /* Parity: none */ /* Stop bits : 1 */ /* Warning: Clock frequency dependant */ /* This example sends a message then */ /* echos lines typed on a terminal. */ /***************************************************************************************/ #pragma CLOCK_FREQ // Processor clock frequency in Hz. // Default value for PIC is (4MHz) // and for SX (50MHz). // This will not affect the comms speed! // if you use a different frequency crystal then change SPBRG // My PORT Configuration #define PortAConfig 0x00 #define PortBConfig 0xf0 #define PortCConfig 0x98 /* SCL & SDA as Inputs */ #define PortDConfig 0x00 #define PortEConfig 0x00 // USART Register bits #define CSCR 7 #define TX9 6 #define TXEN 5 #define SYNC 4 #define BRGH 2 #define TRMT 1 #define TX9D 0 #define SPEN 7 #define RX9 6 #define SREN 5 #define CREN 4 #define ADDEN 3 #define FERR 2 #define OERR 1 #define RX9D 0 #define TRMT_MASK 2 // Masks for PIR1 #define PSPIF_MASK 0x80 #define ADIF_MASK 0x40 #define RCIF_MASK 0x20 #define TXIF_MASK 0x10 // Registers for I2C char SSPSTAT@0x94; // Bank 1 char SSPCON@0x14; // Bank 0 char SSPCON2@0x91; // Bank 1 char SSPBUF@0x13; // I2C Buffer char SSPADD@0x93; // I2C Slave Address register 1

2 // Bits of SSPSTAT #define SMP 7 #define CKE 6 #define D_A 5 #define P 4 #define S 3 #define R_W 2 #define R_W_MASK 0x04 #define UA 1 #define BF 0 // Bits of SSPCON2 #define GCEN 7 #define ACKSTAT 6 #define ACKDT 5 #define ACKEN 4 #define RCEN 3 #define PEN 2 #define RSEN 1 #define SEN 0 // Bits of PIR1 #define PSPIF 7 #define ADIF 6 #define RCIF 5 #define TXIF 4 #define SSPIF 3 #define SSPIF_MASK 0x08 #define CCP1IF 2 #define TMR2IF 1 #define TMR1IF 0 // Bits of SSPCON #define WCOL 7 #define SSPOV 6 #define SSPEN 5 #define CKP 4 #define SSPM3 3 #define SSPM2 2 #define SSPM1 1 #define SSPM0 0 // Port addresses char PORTC@0x07; char PORTD@0x08; char PORTE@0x09; // USART Registers char TXREG@0x19; char RCREG@0x1a; char TXSTA@0x98; char RCSTA@0x18; char SPBRG@0x99; // Extra Ports on PIC16F877 char TRISC@0x87; char TRISD@0x88; char TRISE@0x89; 2

3 // Other regs char char char char char // ADC bits char char // Function Declarations void Setup(void); void ConfigureComms(void); void SendChar(char); char RxChars(void); // Setup the PIC // Configure the comms // Send a character // Receive a characters when RX Interrupt occurs void SendString( const char *ptr );// Send a const string char MyFlags; char BufferIndex; char RxFifo[20]; // Status flags // Yep! an index to the buffer // Receive data buffer. #define RX_BUFFER_SIZE 20 #define BufferReady 0 #define BufferReadyMask 0x01 // Bit 0 of MyFlags const char *Msg1 ="PIC16F877 RS232 Test"; 3

4 // // Start of MAIN // void main(void) Setup(); /* Setup the PIC */ BufferIndex = 0; clear_bit( MyFlags, BufferReady ); /* Clear the buffer ready flag */ SendString( Msg1 ); /* Send a message to the terminal */ while( 1 ) if ( MyFlags & BufferReadyMask ) /* ECHO the buffer back to the terminal */ /* After the enter key was pressed */ while( RxFifo[ BufferIndex ]!= 0 ) SendChar( RxFifo[ BufferIndex++ ] ); BufferIndex = 0; clear_bit( MyFlags, BufferReady ); /* Clear the buffer ready flag */ // end while 1 // end of Main() void interrupt(void) if ( ( PIR1 & RCIF_MASK )!= 0 ) // If USART RX Interrupt RxChars(); // Process the received character clear_bit( PIR1, RCIF ); // Clear flag // Return from Interrupt 4

5 /* Send a const string */ /* ( Null terminated ) */ void SendString(const char *ptr) char i; i = 0; // Check for end of string while( ptr[i]!= 0 ) SendChar( ptr[i++] ); /* setup PIC16F877 options,ports,interrupts */ void Setup(void) INTCON = 0x00; set_bit( INTCON, GIE ); set_bit( INTCON, PEIE ); // Enable Global Interrupts // Enable all Peripheral Interrupts set_bit( STATUS, RP0 ); // Register page 1 // Compiler doesn't detect ram bank switch here! // with OPTION_REG OPTION_REG = 0x0C; // Set Option register // Prescaler = WDT // WDT rate := 1:16 TRISD = PortDConfig; ADCON1 = 0x7f; // Disable ADC TRISA = PortAConfig; TRISB = PortBConfig; TRISC = PortCConfig; TRISE = PortEConfig; clear_bit( STATUS, RP0 ); // Register page 0 PIR1 = 0; ConfigureComms(); /* Configure USART for Asyncronous Comms */ 5

6 /*******************************************************/ /* Configure USART for communications */ /* Asynchronous mode */ /* 19,200 Baud ( With Mhz Clock ) */ /* 8 data bits ( For other rates see PIC16F8XX Data ) */ /* 2 stop bits */ /* No Parity */ /*******************************************************/ void ConfigureComms(void) set_bit( RCSTA, SPEN ); // Enable Serial port clear_bit( RCSTA, RX9 ); // 8 bit receive mode set_bit( STATUS, RP0 ); // *** Register page 1 *** clear_bit( TXSTA, TX9 ); // 8 bit transmit mode // SPBRG = 0; // SPBRG = 1 ( Set Baud rate 115,200 ) // SPBRG = 5; // SPBRG = 5 ( Set Baud rate 38,400 ) // SPBRG = 22; // SPBRG = 22 ( Set Baud rate 9,600 ) // SPBRG = 11; // SPBRG = 11 ( Set Baud rate 19,200 ) SPBRG = 22; // SPBRG = 22 ( Set Baud rate 9,600 ) // // For this value at a given clock rate // see the microchip document // set_bit( TXSTA, BRGH ); // RRGH = 1 ( High speed mode ) clear_bit( TXSTA, SYNC ); // Asyncronous mode; set_bit( TXSTA, TXEN ); set_bit( PIE1, RCIE ); // Enable Transmitter // Enable Receive Interrupt clear_bit( STATUS, RP0 ); // *** Register page 0 *** set_bit( RCSTA, CREN ); clear_bit( PIR1, RCIF ); set_bit( INTCON, PEIE ); set_bit( INTCON, GIE ); // Enable continuous receive // Clear Receive Interrupt flag // Enable all Peripheral Interrupts // Enable Global Interrupts 6

7 /* Send a character over the RS232 Port */ void SendChar(char ch) char TxEmpty; asm bsf STATUS, RP0; // *** Register page 1 *** asm movf TXSTA, W; // Save TXSTA value asm bcf STATUS, RP0; // *** Register page 0 *** asm movwf _TxEmpty_SendChar; // Restore TXSTA value while ( ( TxEmpty & TRMT_MASK ) == 0 ) // Wait for TX Empty asm bsf STATUS, RP0; // *** Register page 1 *** asm movf TXSTA, W; // Save TXSTA value asm bcf STATUS, RP0; // *** Register page 0 *** asm movwf _TxEmpty_SendChar; // Restore TXSTA value asm bcf STATUS, RP0; // *** Register page 0 *** TXREG = ch; // Load the TXREG /* Receive a character over the RS232 Port */ /* Called from Interrupt service routine */ /* Returns the char received */ /* and saves it in the buffer */ char RxChars(void) if ( ( RCSTA & 6 ) == 0 ) // Then if no errors // Process received character // If terminated by a carrage return // or Buffer end reached received */ if ( ( RCREG == 13 ) ( BufferIndex == RX_BUFFER_SIZE ) ) set_bit( MyFlags, BufferReady ); /* Set a flag to indicate line else RxFifo[ BufferIndex ] = 0; /* NULL Terminate the buffer */ RxFifo[ BufferIndex++] = RCREG; // Save the data set_bit( RCSTA, CREN ); // Enable receiver. else // process any errors here // Beware, we are in the Interrupt routine. //... clear_bit( RCSTA, CREN ); // Clear any errors set_bit( RCSTA, CREN ); // Enable receiver. return RCREG; 7

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar

Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Starting with Serial Chapter 10 Sections 1,2,9,10 Dr. Iyad Jafar Outline Introduction Synchronous Serial Communication Asynchronous Serial Communication Physical Limitations Overview of PIC 16 Series The

More information

Embedded Systems Programming and Architectures

Embedded Systems Programming and Architectures Embedded Systems Programming and Architectures Lecture No 10 : Data acquisition and data transfer Dr John Kalomiros Assis. Professor Department of Post Graduate studies in Communications and Informatics

More information

Serial Communication with PIC16F877A

Serial Communication with PIC16F877A Serial Communication with PIC16F877A In this tutorial we are going to discuss the serial/uart communication using PIC16F877A. PIC16F877A comes with inbuilt USART which can be used for Synchronous/Asynchronous

More information

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing

EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing EET203 MICROCONTROLLER SYSTEMS DESIGN Serial Port Interfacing Objectives Explain serial communication protocol Describe data transfer rate and bps rate Describe the main registers used by serial communication

More information

Section 21. Addressable USART

Section 21. Addressable USART 21 Section 21. Addressable USART Addressable USART HIGHLIGHTS This section of the manual contains the following major topics: 21.1 Introduction... 21-2 21.2 Control Registers... 21-3 21.3 USART Baud Rate

More information

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan

Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan PIC18 Serial Port Hi Hsiao-Lung Chan Dept Electrical Engineering Chang Gung University, Taiwan chanhl@mail.cgu.edu.twcgu Serial vs. parallel data transfer 2 Simplex, half-, and full-duplex transfers 3

More information

PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE SSP Module Overview. Applicable Devices

PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE SSP Module Overview. Applicable Devices Applicable Devices PIC16C7X 11.0 SYNCHRONOUS SERIAL PORT (SSP) MODULE 11.1 SSP Module Overview The Synchronous Serial Port (SSP) module is a serial interface useful for communicating with other peripheral

More information

Experiment 7:The USART

Experiment 7:The USART University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 7 Experiment 7:The USART Objectives Introduce the USART module of the PIC

More information

ELE492 Embedded System Design

ELE492 Embedded System Design Overview ELE9 Embedded System Design Examples of Human I/O Interfaces Types of System Interfaces Use of standards RS Serial Communication Overview of SPI, I C, L, and CAN Class //0 Eugene Chabot Examples

More information

ELCT 912: Advanced Embedded Systems

ELCT 912: Advanced Embedded Systems ELCT 912: Advanced Embedded Systems Lecture 10: Applications for Programming PIC18 in C Dr. Mohamed Abd El Ghany, Department of Electronics and Electrical Engineering Programming the PIC18 to transfer

More information

Serial Communication

Serial Communication Serial Communication What is serial communication? Basic Serial port operation. Classification of serial communication. (UART,SPI,I2C) Serial port module in PIC16F887 IR Remote Controller Prepared By-

More information

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous

More information

Section 16. Basic Sychronous Serial Port (BSSP)

Section 16. Basic Sychronous Serial Port (BSSP) M 16 Section 16. Basic Sychronous Serial Port (BSSP) BSSP HIGHLIGHTS This section of the manual contains the following major topics: 16.1 Introduction...16-2 16.2 Control Registers...16-3 16.3 SPI Mode...16-6

More information

Kit Contents. Getting Started Kits. Board. Board

Kit Contents. Getting Started Kits. Board. Board Kit Contents Getting Started Kits Each kit has the following items: Board with microcontroller (18(L)F4620) Power brick for the board. Programmer, and power brick for programmer. USB logic analyzer Digital

More information

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC

ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC ELCT706 MicroLab Session #4 UART Usage for Bluetooth connection PC - PIC USART in PIC16F877A Universal Synchronous/Asynchronous Receiver Transmitter - Can receive and transmit - Can be synchronous or Asynchronous

More information

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller

APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with a PIC Microcontroller Maxim/Dallas > App Notes > REAL-TIME CLOCKS Keywords: DS1305, SPI, PIC, real time clock, RTC, spi interface, pic microcontroller Aug 20, 2003 APPLICATION NOTE 2361 Interfacing an SPI-Interface RTC with

More information

RS232.C An Interrupt driven Asyncronous Serial Port

RS232.C An Interrupt driven Asyncronous Serial Port /***************************************************************************/ /* RS232.C An Interrupt driven Asyncronous Serial Port */ /* Date : 06/03/2002 */ /* Purpose : Asyncronous Transmitter & Receiver

More information

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex.

Parallel IO. Serial IO. Parallel vs. Serial IO. simplex vs half-duplex vs full-duplex. Wires: Full Duplex. Wires: Simplex, Half-duplex. Parallel IO Parallel IO data sent over a group of parallel wires. Typically, a clock is used for synchronization. D[15:0] clk Serial IO Serial IO data sent one bit at a time, over a single wire. A clock

More information

Chapter 13. PIC Family Microcontroller

Chapter 13. PIC Family Microcontroller Chapter 13 PIC Family Microcontroller Lesson 06 Special Function Registers for Control and status registers for the peripherals, input/output and Interrupt SFRs SFRs at the addresses of internal RAM/register

More information

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University

Outlines. PIC Programming in C and Assembly. Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University PIC ming in C and Assembly Outlines Microprocessor vs. MicroController PIC in depth PIC ming Assembly ming Krerk Piromsopa, Ph.D. Department of Computer Engineering Chulalongkorn University Embedded C

More information

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table

Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Super Awesome Multitasking Microcontroller Interface for Electromechanical Systems (S.A.M.M.I.E.S.) Pinball Table Group 13 April 29 th, 2008 Faculty Advisor: Professor Haibo He Group Members: William McGuire

More information

Interactive Modules for the Intelligent Teddy Bear

Interactive Modules for the Intelligent Teddy Bear Interactive Modules for the Intelligent Teddy Bear Submitted by: Siddharth Goyal Department of Electrical Engineering Under the Guidance of Dr. Shuzhi Sam Ge Prof. of the Electrical and Computer Engineering

More information

IE1206 Embedded Electronics

IE1206 Embedded Electronics IE1206 Embedded Electronics Le1 Le3 Le4 Le2 Ex1 Ex2 PIC-block Documentation, Seriecom Pulse sensors I, U, R, P, serial and parallell KC1 LAB1 Pulsesensors, Menuprogram Start of programing task Kirchoffs

More information

PIC18FXX2 Registers. Hyperlinked Index

PIC18FXX2 Registers. Hyperlinked Index PIC18FXX2 Registers This document provides a concise summary of the names and bit definitions for the PIC18FXX2 Special Function Registers, Configuration Registers and Device ID Registers. Hyperlinked

More information

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background:

Timer2 Interrupts. NDSU Timer2 Interrupts September 20, Background: Background: Timer2 Interrupts The execution time for routines sometimes needs to be set. This chapter loops at several ways to set the sampling rate. Example: Write a routine which increments an 8-bit

More information

PIC16F /40-Pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC16F /40-Pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features: 28/40-Pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F870 PIC16F871 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions to learn All

More information

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features:

PIC16F87X. 28/40-pin 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram PDIP. Microcontroller Core Features: 28/40-pin 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: PIC16F873 PIC16F874 PIC16F876 PIC16F877 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions

More information

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7

The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7 The MICROPROCESSOR PRINCIPLES AND APPLICATIONS Lab 7 Timer, USART Cheng-Chien Su 蘇正建 Home Automation, Networking, and Entertainment Lab Dept. of Computer Science and Information Engineering National Cheng

More information

TB033. Using the PIC16F877 To Develop Code For PIC16CXXX Devices INTRODUCTION. Stan D Souza, Rodger Richey Microchip Technology Inc.

TB033. Using the PIC16F877 To Develop Code For PIC16CXXX Devices INTRODUCTION. Stan D Souza, Rodger Richey Microchip Technology Inc. Using the PIC16F877 To Develop Code For PIC16CXXX Devices TB033 Authors: INTRODUCTION Stan D Souza, Rodger Richey Microchip Technology Inc. With the release of the FLASH-based PIC16F87X family, Microchip

More information

Design, Development & Implementation of a Temperature Sensor using Zigbee Concepts

Design, Development & Implementation of a Temperature Sensor using Zigbee Concepts Design, Development & Implementation of a Temperature Sensor using Zigbee Concepts T.C.Manjunath, Ph.D. ( IIT Bombay ) & Fellow IETE, Ashok Kusagur, Shruthi Sanjay, Saritha Sindushree, C. Ardil Abstract

More information

PIC16F87XA Data Sheet

PIC16F87XA Data Sheet M Data Sheet 28/40-pin Enhanced FLASH Microcontrollers 2001 Microchip Technology Inc. Advance Information DS39582A 2001 Microchip Technology Inc. Advance Information DS39582A-page 3 Pin Diagram RB7/PGD

More information

The University of Texas at Arlington Lecture 21_Review

The University of Texas at Arlington Lecture 21_Review The University of Texas at Arlington Lecture 21_Review CSE 5442/3442 Agenda Tuesday December 1st Hand back Homework 7,8 and 9. Go over questions and answers Exam 3 Review Note: There will be a take home

More information

11.4 THE SERIAL PERIPHERAL INTERFACE (SPI)

11.4 THE SERIAL PERIPHERAL INTERFACE (SPI) Synchronous Serial IO 331 TRISC6 TRISC[6] Must be 0 so that RC6/TX/CK pin is an output. TRISC7 TRISC[7] Must be 1 so that RC7/RX/DT pin is an input. 11.4 THE SERIAL PERIPHERAL INTERFACE (SPI) The Serial

More information

PIC16F7X Data Sheet. 28/40-pin, 8-bit CMOS FLASH Microcontrollers Microchip Technology Inc. DS30325B

PIC16F7X Data Sheet. 28/40-pin, 8-bit CMOS FLASH Microcontrollers Microchip Technology Inc. DS30325B M PIC16F7X Data Sheet 28/40-pin, 8-bit CMOS FLASH Microcontrollers 2002 Microchip Technology Inc. DS30325B Note the following details of the code protection feature on PICmicro MCUs. The PICmicro family

More information

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features:

PIC16F870/ /40-Pin, 8-Bit CMOS FLASH Microcontrollers. Devices Included in this Data Sheet: Pin Diagram. Microcontroller Core Features: 28/40-Pin, 8-Bit CMOS FLASH Microcontrollers Devices Included in this Data Sheet: Pin Diagram PIC16F870 PIC16F871 PDIP Microcontroller Core Features: High performance RISC CPU Only 35 single word instructions

More information

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh

Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Work Completed: Weekly Report: Interactive Wheel of Fortune Week 4 02/014/07-02/22/07 Written by: Yadverinder Singh Last week started with the goal to complete writing the overall program for the game.

More information

PIC18F6310/6410/8310/8410

PIC18F6310/6410/8310/8410 PIC18F6310/6410/8310/8410 Rev. B3 Silicon Errata The PIC18F6310/6410/8310/8410 Rev. B3 parts you have received conform functionally to the Device Data Sheet (DS39635B), except for the anomalies described

More information

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design

DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING. EE Microcontroller Based System Design DHANALAKSHMI COLLEGE OF ENGINEERING, CHENNAI DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EE6008 - Microcontroller Based System Design UNIT III PERIPHERALS AND INTERFACING PART A 1. What is an

More information

Interrupts and Serial Communication on the PIC18F8520

Interrupts and Serial Communication on the PIC18F8520 Interrupts and Serial Communication on the PIC18F8520 Kyle Persohn COEN 4720 Fall 2011 Marquette University 6 October 2011 Outline 1 Background Serial Communication PIC18 Interrupt System 2 Customizing

More information

ECE 354 Introduction to Lab 1. February 5 th, 2003

ECE 354 Introduction to Lab 1. February 5 th, 2003 ECE 354 Introduction to Lab 1 February 5 th, 2003 Lab 0 Most groups completed Lab 0 IDE Simulator Questions? ICD Questions? What s the difference? ECE 354 - Spring 2003 2 Addition to Honesty Policy It

More information

Contents. PIC Mini Data Sheets

Contents. PIC Mini Data Sheets Contents PIC16C5x... 5 PIC16C5x Pin-Outs... 5 PIC16C5x Microcontrollers... 6 Peripheral Features... 6 Internal Architecture... 9 PIC16C5x Registers... 9 PIC16C64... 18 PIC16C64 Pin-Out...18 New and Modified

More information

Acronyms and Abbreviations

Acronyms and Abbreviations Appendix A Acronyms and Abbreviations ADC (A/D) Analog-to-Digital Converter/Conversion ADCON0 A/D CONtrol 0 ADCON1 ADC CONtrol 1 ADCSn ADC Clock Select, bits; ADCON0[7:6] ADDEN ADDress ENable; RCSTA[3]

More information

Embedded System Design

Embedded System Design ĐẠI HỌC QUỐC GIA TP.HỒ CHÍ MINH TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA ĐIỆN-ĐIỆN TỬ BỘ MÔN KỸ THUẬT ĐIỆN TỬ Embedded System Design : Microcontroller 1. Introduction to PIC microcontroller 2. PIC16F84 3. PIC16F877

More information

SRF08 Ultra sonic range finder

SRF08 Ultra sonic range finder SRF08 Ultra sonic range finder Technical Specification Communication with the SRF08 ultrasonic rangefinder is via the I2C bus. This is available on popular controllers such as the OOPic and Stamp BS2p,

More information

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */

/*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*Algorithm: This code display a centrifuge with five variable speed RPM by increaseing */ /*the speed the cell which are less dense can float and the cell that are denser can sink*/ /*the user has five

More information

Using the 8-Bit Parallel Slave Port

Using the 8-Bit Parallel Slave Port M AN579 Using the 8-Bit Parallel Slave Port Author: INTRODUCTION PIC16C64/74 microcontrollers from Microchip Technology Inc. can be interfaced with ease into a multi-microprocessor environment using its

More information

UNIVERSITY OF NAIROBI FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING

UNIVERSITY OF NAIROBI FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING UNIVERSITY OF NAIROBI FACULTY OF ENGINEERING DEPARTMENT OF ELECTRICAL AND INFORMATION ENGINEERING PROJECT: A MICROCONTROLLER BASED WIRELESS E-NOTICE BOARD PROJECT INDEX: 06 NAME: LUBANGA DENNIS WASIOYA

More information

PIC18F2525/2620/4525/4620

PIC18F2525/2620/4525/4620 PIC18F2525/2620/4525/4620 Rev. A4 Silicon Errata The PIC18F2525/2620/4525/4620 Rev. A4 parts you have received conform functionally to the Device Data Sheet (DS39626D), except for the anomalies described

More information

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS

AN587. Interfacing to an LCD Module. Interfacing to an LCD Module INTRODUCTION OPERATION CONTROL SIGNAL FUNCTIONS TABLE 2: CONDITIONAL ASSEMBLY FLAGS Interfacing to an LCD Module AN587 INTRODUCTION TABLE 1: CONTROL SIGNAL FUNCTIONS This application note interfaces a PIC16CXX device to the Hitachi LM02L LCD character display module. This module is a

More information

FULL DUPLEX BIDIRECTIONAL UART COMMUNICATION BETWEEN PIC MICROCONTROLLERS

FULL DUPLEX BIDIRECTIONAL UART COMMUNICATION BETWEEN PIC MICROCONTROLLERS FULL DUPLEX BIDIRECTIONAL UART COMMUNICATION BETWEEN PIC MICROCONTROLLERS Dhineshkaarthi K., Sundar S., Vidhyapathi C. M. and Karthikeyan B. M. Tech, School of Electronics Engineering, VIT University,

More information

These 3 registers contain enable, priority,

These 3 registers contain enable, priority, 8.3.2) Registers Related to Interrupts These registers enable/disable the interrupts, set the priority of the interrupts, and record the status of each interrupt source. RCON INTCON, INTCON2, and INTCON3

More information

Timer1 Capture Mode:

Timer1 Capture Mode: Timer1 Capture Mode: Interrupt Description Input Conditions Enable Flag Timer 1 Trigger after N events N = 1.. 2 19 100ns to 0.52 sec RC0 TMR1CS = 1 TMR1IF Timer 1 Capture Mode 1 Timer 1 Capture Mode 2

More information

Interrupts on PIC18F252 Part 2

Interrupts on PIC18F252 Part 2 Interrupts on PIC18F252 Part 2 Following pages list Special Function Registers (SFRs) involved in interrupt configuration and operation on PIC18F252 microcontroller. (Copied from Microchip s PIC18Fxx2

More information

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed

Hardware Interfacing. EE25M Introduction to microprocessors. Part V. 15 Interfacing methods. original author: Feisal Mohammed EE25M Introduction to microprocessors original author: Feisal Mohammed updated: 18th February 2002 CLR Part V Hardware Interfacing There are several features of computers/microcontrollers which have not

More information

USER S MANUAL VERSION June, KB1 AT-PS/2 Keyboard Interface Chip

USER S MANUAL VERSION June, KB1 AT-PS/2 Keyboard Interface Chip USER S MANUAL VERSION 1.0 1 June, 2012 for KB1 AT-PS/2 Keyboard Interface Chip Lucid Technologies http://www.lucidtechnologies.info/ Email: info@lucidtechnologies.info Copyright 2012 by Lucid Technologies

More information

ACCESS SECURITY SYSTEM USING RFID TAG

ACCESS SECURITY SYSTEM USING RFID TAG ACCESS SECURITY SYSTEM USING RFID TAG OBJECTIVE The main objective of this project is to provide the technology which can be very beneficial is that RFID automated access for door controls to buildings,

More information

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag

Timer0..Timer3. Interrupt Description Input Conditions Enable Flag Timer0..Timer3 Timers are pretty useful: likewise, Microchip provides four different timers for you to use. Like all interrupts, you have to Enable the interrupt, Set the conditions of the interrupt, and

More information

SA818 Programming Manual

SA818 Programming Manual SA818 Programming Manual Standard Uart interface is used to configure the parameter of SA818 Walkie Talkie. The format of UART is 9600, 8, N, 1, which means: Baud = 9600, data bit = 8bit, Parity = None,

More information

TKT-3500 Microcontroller systems

TKT-3500 Microcontroller systems TKT-3500 Microcontroller systems Lec 5 IO part2: synchr. USART, SPI, I2C, GPIO Teemu Laukkarinen Department of Computer Systems Tampere University of Technology Fall 2011 Sources Original slides by Erno

More information

Asynchronous Transmission. Asynchronous Serial Communications & UARTS

Asynchronous Transmission. Asynchronous Serial Communications & UARTS Asynchronous Transmission Asynchronous Serial Communications & UARTS 55:036 Embedded Systems and Systems Software asynchronous: transmitter and receiver do not share a common clock or explicitly coordinate

More information

DIPLOMA THESIS DETECTION AND PREVENTION OF FAULTY PINS

DIPLOMA THESIS DETECTION AND PREVENTION OF FAULTY PINS UNIVERSITY POLITEHNICA OF BUCHAREST FACULTY OF ELECTRONICS, TELECOMMUNICATIONS AND INFORMATION TECHNOLOGY DETECTION AND PREVENTION OF FAULTY PINS DIPLOMA THESIS Submitted in partial fulfillment of the

More information

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller

Hong Kong Institute of Vocational Education Digital Electronics & Microcontroller. 8. Microcontroller 8. Microcontroller Textbook Programming Robot Controllers, Myke Predko, McGraw Hill. Reference PIC Robotics: A Beginner's Guide to Robotics Projects Using the PIC Micro, John Iovine, McGraw Hill. Embedded

More information

Lego Mindstorms NXT Camera

Lego Mindstorms NXT Camera Lego Mindstorms NXT Camera Semester thesis by Leo den Hartog 1. Advisor: Wolfgang Haid 2. Advisor: Matthias Woehrle Professor: Prof. Dr. Lothar Thiele 8/31/2008 2 Lego Mindstorms NXT Camera 3 Abstract

More information

PIC16C745/ Bit CMOS Microcontrollers with USB. Pin Diagrams. Devices included in this data sheet: Microcontroller Core Features:

PIC16C745/ Bit CMOS Microcontrollers with USB. Pin Diagrams. Devices included in this data sheet: Microcontroller Core Features: 8-Bit CMOS Microcontrollers with USB Devices included in this data sheet: PIC16C745 PIC16C765 Microcontroller Core Features: High-performance RISC CPU Only 35 single word instructions Device Memory Program

More information

PIC16F872 Data Sheet. 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D Microchip Technology Inc. DS30221C

PIC16F872 Data Sheet. 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D Microchip Technology Inc. DS30221C Data Sheet 28-Pin, 8-Bit CMOS Flash Microcontroller with 10-Bit A/D 2006 Microchip Technology Inc. DS30221C Note the following details of the code protection feature on Microchip devices: Microchip products

More information

Distributed by: www.jameco.com 1-800-831-4242 The content and copyrights of the attached material are the property of its owner. M PIC16F87XA Data Sheet 28/40-pin Enhanced FLASH Microcontrollers 2001 Microchip

More information

Micro-Controller: PIC16C74 < Part 5: Interrupt >

Micro-Controller: PIC16C74 < Part 5: Interrupt > Micro-Controller: PIC16C74 < Part 5: Interrupt > I. Overview Introduction PIC16c74 can have many sources of interrupt. These sources generally include one interrupt source for each peripheral module, though

More information

Speed Control of a DC Motor using Digital Control

Speed Control of a DC Motor using Digital Control Speed Control of a DC Motor using Digital Control The scope of this project is threefold. The first part of the project is to control an LCD display and use it as part of a digital tachometer. Secondly,

More information

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language

Interrupts on PIC18F252 Part 2. Interrupts Programming in C Language Interrupts on PIC18F252 Part 2 Interrupts Programming in C Language Programming interrupts in C language using XC8 compiler is significantly simplified compared to C18 compiler. This note explains the

More information

EE6008-Microcontroller Based System Design Department Of EEE/ DCE

EE6008-Microcontroller Based System Design Department Of EEE/ DCE UNIT- II INTERRUPTS AND TIMERS PART A 1. What are the interrupts available in PIC? (Jan 14) Interrupt Source Enabled by Completion Status External interrupt from INT INTE = 1 INTF = 1 TMR0 interrupt T0IE

More information

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model)

When JP1 is cut, baud rate is Otherwise, baud rate is Factory default is that JP1 is shorted. (JP1 is jumper type in some model) ELCD SERIES INTRODUCTION ALCD is Serial LCD module which is controlled through Serial communication. Most of existing LCD adopts Parallel communication which needs lots of control lines and complicated

More information

Sales: Technical: Fax:

Sales: Technical: Fax: DATA SHEET PIC Microcontrollers Order code Manufacturer code Description 73-3352 n/a PIC16F877A-I/P (RC) PIC Microcontrollers The enclosed information is believed to be correct, Information may change

More information

EEE394 Microprocessor and Microcontroller Laboratory Lab #6

EEE394 Microprocessor and Microcontroller Laboratory Lab #6 Exp. No #6 Date: INTERRUPTS AND ADC IN PIC MICROCONTROLLER OBJECTIVE The purpose of the experiment is to configure external interrupt and the ADC in PIC microcontrollers. (i) To flip the LED connected

More information

PIC16F87/88 Data Sheet

PIC16F87/88 Data Sheet Data Sheet 18/20/28-Pin Enhanced Flash Microcontrollers with nanowatt Technology 2005 Microchip Technology Inc. DS30487C Note the following details of the code protection feature on Microchip devices:

More information

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory

University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory University of Jordan Faculty of Engineering and Technology Department of Computer Engineering Embedded Systems Laboratory 0907334 6 Experiment 6:Timers Objectives To become familiar with hardware timing

More information

Source Codes for DRA818U/DRA818V

Source Codes for DRA818U/DRA818V Source Codes for DRA818U/DRA818V V1.01 This document contains source codes for high power wireless voice transceiver module DRA818U/DRA818V and is used only for reference. In order to understand the codes

More information

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors Input/Output 1 Introduction Embedded system functionality aspects Processing Transformation of data Implemented using processors Storage Retention of data Implemented using memory Communication Transfer

More information

Lego Mindstorms NXT & CMUcam3

Lego Mindstorms NXT & CMUcam3 Lego Mindstorms NXT & CMUcam3 This document describes the setup and some technical details for using the CMUcam3 [1] [2] [3] as a vision sensor for the Lego Mindstorms NXT. The essential module for coupling

More information

PIC18F2585/2680/4585/4680

PIC18F2585/2680/4585/4680 PIC18F2585/2680/4585/4680 Rev. A3 Silicon Errata The PIC18F2585/2680/4585/4680 Rev. A3 parts you have received conform functionally to the Device Data Sheet (DS39625B), except for the anomalies described

More information

ME 6405 Introduction to Mechatronics

ME 6405 Introduction to Mechatronics ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Microchip PIC Manufacturer Information: Company: Website: http://www.microchip.com Reasons for success: Became the hobbyist's

More information

19.1. Unit 19. Serial Communications

19.1. Unit 19. Serial Communications 9. Unit 9 Serial Communications 9.2 Serial Interfaces Embedded systems often use a serial interface to communicate with other devices. Serial implies that it sends or receives one bit at a time. µc Device

More information

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation

Embedded systems. Exercise session 3. Microcontroller Programming Lab Preparation Embedded systems Exercise session 3 Microcontroller Programming Lab Preparation Communications Contact Mail : michael.fonder@ulg.ac.be Office : 1.82a, Montefiore Website for the exercise sessions and the

More information

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics:

Section 11. Timer0. Timer0 HIGHLIGHTS. This section of the manual contains the following major topics: M 11 Section 11. HIGHLIGHTS This section of the manual contains the following major topics: 11.1 Introduction...11-2 11.2 Control Register...11-3 11.3 Operation...11-4 11.4 TMR0 Interrupt...11-5 11.5 Using

More information

Serial Communications

Serial Communications 1 Serial Interfaces 2 Embedded systems often use a serial interface to communicate with other devices. Serial Communications Serial implies that it sends or receives one bit at a time. Serial Interfaces

More information

PIC18F87J50 Family Silicon Errata and Data Sheet Clarification. Part Number Device ID (1) Revision ID for Silicon Revision (2) A2 A3 A4

PIC18F87J50 Family Silicon Errata and Data Sheet Clarification. Part Number Device ID (1) Revision ID for Silicon Revision (2) A2 A3 A4 PIC18F87J50 Family Silicon Errata and Data Sheet Clarification The PIC18F87J50 family devices that you have received conform functionally to the current Device Data Sheet (DS39775C), except for the anomalies

More information

Week1. EEE305 Microcontroller Key Points

Week1. EEE305 Microcontroller Key Points Week1 Harvard Architecture Fig. 3.2 Separate Program store and Data (File) stores with separate Data and Address buses. Program store Has a 14-bit Data bus and 13-bit Address bus. Thus up to 2 13 (8K)

More information

GPS Reader. Figure 1: RMC NEMA Tag Definition

GPS Reader. Figure 1: RMC NEMA Tag Definition Douglas Guardino GPS Reader In this project a PIC 18F452 will be used to get one sentence from a GPS and make that sentence available to another PIC. This is done because the GPS puts out a bunch of sentences

More information

Appendix A Acronyms and Abbreviations

Appendix A Acronyms and Abbreviations Appendix A Acronyms and Abbreviations ABDEN Automatic BauD rate ENable; BAUDCON[0] ABDOVF Automatic BauD rate OVerFlow; BAUDCON[7] ACK ACKnowledge state in the I 2 Cprotocol ACQT2:0 ACQuition Time delay

More information

CENG-336 Introduction to Embedded Systems Development. Timers

CENG-336 Introduction to Embedded Systems Development. Timers CENG-336 Introduction to Embedded Systems Development Timers Definitions A counter counts (possibly asynchronous) input pulses from an external signal A timer counts pulses of a fixed, known frequency

More information

Lab 6 RS-232 Communication The following routines are provided for devices with a single USART peripheral:

Lab 6 RS-232 Communication The following routines are provided for devices with a single USART peripheral: Still More Lab 6 Considerations; Embedded System Power Issues; Project Information Lab 6 RS-232 Communication The following routines are provided for devices with a single USART peripheral: BusyUSART CloseUSART

More information

Chapter 11: Interrupt On Change

Chapter 11: Interrupt On Change Chapter 11: Interrupt On Change The last two chapters included examples that used the external interrupt on Port C, pin 1 to determine when a button had been pressed. This approach works very well on most

More information

Embedded Systems and Software. Serial Communication

Embedded Systems and Software. Serial Communication Embedded Systems and Software Serial Communication Slide 1 Using RESET Pin on AVRs Normally RESET, but can be configured via fuse setting to be general-purpose I/O Slide 2 Disabling RESET Pin on AVRs Normally

More information

Embedded Systems and Software

Embedded Systems and Software Embedded Systems and Software Serial Communication Serial Communication, Slide 1 Lab 5 Administrative Students should start working on this LCD issues Caution on using Reset Line on AVR Project Posted

More information

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017

Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Philadelphia University Faculty of Engineering Course Title: Embedded Systems (630414) Instructor: Eng. Anis Nazer Dept. of Computer Engineering Final Exam, First Semester: 2016/2017 Student Name: Student

More information

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours

UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT. Year 2 MICROCONTROLLER SYSTEMS. Module Code: EEE305J1. Time allowed: 3 Hours UNIVERSITY OF ULSTER UNIVERSITY EXAMINATIONS : 2001/2002 RESIT Year 2 MICROCONTROLLER SYSTEMS Module Code: EEE305J1 Time allowed: 3 Hours Answer as many questions as you can. Not more than TWO questions

More information

TKT-3500 Microcontroller systems

TKT-3500 Microcontroller systems TKT-3500 Microcontroller systems Lec 3a Serial Input/output Ville Kaseva Department of Computer Systems Tampere University of Technology Fall 2010 Sources Original slides by Erno Salminen Robert Reese,

More information

PIC16F818/819 Data Sheet

PIC16F818/819 Data Sheet Data Sheet 18/20-Pin Enhanced FLASH Microcontrollers with nanowatt Technology 2002 Microchip Technology Inc. Preliminary DS39598C Note the following details of the code protection feature on Microchip

More information

PIC16C63A/65B/73B/74B

PIC16C63A/65B/73B/74B PI663A/65B/73B/74B 4.0 MEMORY ORGANIATION 4. Program Memory Organization The PI663A/65B/73B/74B has a 3bit program counter capable of addressing an 8K x 4 program memory space. All devices covered by this

More information

Tutorial by Example Issue 1C

Tutorial by Example Issue 1C Tutorial by Example Issue 1C Copyright, Peter H. Anderson, Baltimore, MD, April, 01 Introduction. This is Issue 1C of Tutorial by Example. The complete package now consists of Issues 1, 1A, 1B and 1C.

More information

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch.

which means that writing to a port implies that the port pins are first read, then this value is modified and then written to the port data latch. Introduction to microprocessors Feisal Mohammed 3rd January 2001 Additional features 1 Input/Output Ports One of the features that differentiates a microcontroller from a microprocessor is the presence

More information