The document discusses microcontrollers and the PIC16F877 microcontroller in particular. It provides the following key points:
- A microcontroller is a single-chip computer containing a processor, memory, and input/output peripherals. Microcontrollers can store and run user-written programs.
- The main parts of a microcontroller include a CPU, RAM, ROM, I/O lines, timers, and analog-to-digital and digital-to-analog converters.
- The PIC16F877 is chosen for its low cost, reliability, ease of use, and ability to perform a wide range of tasks using C language software.
Embedded system (Chapter 3) io_port_programmingIkhwan_Fakrudin
The document discusses input/output (I/O) ports programming for the PIC18F4550 microcontroller. It describes the 5 ports - PORTA, PORTB, PORTC, PORTD, and PORTE, identifying the number of pins in each port. It explains that many pins have dual roles, serving as both general I/O pins and alternate functions. The document outlines how to configure ports as inputs or outputs using TRIS, PORT, and LAT registers. It provides examples of initializing ports and accessing registers by bit or byte to control individual pins.
This document provides an overview of microcontroller architecture and assembly language programming. It discusses the following key points in 3 sentences:
The document introduces PIC microcontrollers and assembly language, noting that assembly language uses mnemonic instructions that must be translated to machine code by an assembler. It explains the assembling and linking process used to convert assembly code to machine code that can be burned into the PIC's program memory. Various PIC assembly language instructions are also described, including MOVLW, MOVWF, logic instructions, and bit manipulation instructions to set and clear bits on I/O ports.
The document discusses C programming for PIC microcontrollers. It covers the standard structure of a C program, including comments, header files, configuration bits, functions, and function bodies. It also discusses various C data types like unsigned char, signed char, unsigned int, and signed int. Examples are provided to illustrate how to use these data types and write C programs that toggle ports on a PIC microcontroller. The outcomes are for students to understand C programming languages for PIC18, the structure of C programs for PIC18, and common C data types used for PIC microcontrollers.
A starter guide how to use Microchip MPLAB IDE for PIC microcontrollers and related tools like MPLAB C18, C30 and C32 compilers, and how to MPLAB features to get connected and integrated with programmer/debugger devices and development kits from Microchip.
for more discussion and articles about different microcontroller platforms and tutorials please visit: http://elrayescampaign.blogspot.ca/
The document discusses the architecture and assembly language programming of PIC18 microcontrollers. It covers topics such as:
- PIC18 microcontrollers use a Harvard architecture with separate memory for instructions and data. They have a program memory, data memory, I/O ports, and support devices like timers.
- The PIC18 architecture is based on an advanced RISC design. Key components include registers like WREG for temporary data storage. Special function registers and general purpose registers are used to access I/O ports and timers.
- Assembly language instructions like MOVLW, ADDLW, and MOVWF are used to move data between program memory, registers and I/O ports. The
The document discusses the features and input/output basics of the AVR ATmega16 microcontroller. Key points include its Harvard architecture, 8-bit design, timers, ADC, and protocol support. It describes compiler tools, programming hardware, and pin configuration registers like DDR, PORT, and PIN. The DDR register sets the pin directions, PORT is used for output and pull-up configuration, and PIN reads pin states. Pull-up resistors prevent floating inputs. An exercise demonstrates configuring ports for different I/O functions.
This presentation discusses an embedded system project to control a fan based on temperature. It includes:
- An overview of Skyphi Technologies, an organization that provides training in embedded systems and other domains.
- A definition of embedded systems and examples like ATMs, aircraft systems, and more.
- An introduction to the AVR microcontroller and its features like the ATmega8, programming tools, and pin diagram.
- Explanations of embedded C programming structure, I/O ports, registers, and programming the AVR microcontroller.
- Details of the temperature controlled fan project including components, working principle, circuit diagram, and code overview.
- Applications of the temperature controlled fan
8051 programming skills using EMBEDDED CAman Sharma
It contains basic programming tips for embedded c for those who are just into it and don't know much about it....have a look in it and u will surely find it easy.
Embedded system (Chapter 3) io_port_programmingIkhwan_Fakrudin
The document discusses input/output (I/O) ports programming for the PIC18F4550 microcontroller. It describes the 5 ports - PORTA, PORTB, PORTC, PORTD, and PORTE, identifying the number of pins in each port. It explains that many pins have dual roles, serving as both general I/O pins and alternate functions. The document outlines how to configure ports as inputs or outputs using TRIS, PORT, and LAT registers. It provides examples of initializing ports and accessing registers by bit or byte to control individual pins.
This document provides an overview of microcontroller architecture and assembly language programming. It discusses the following key points in 3 sentences:
The document introduces PIC microcontrollers and assembly language, noting that assembly language uses mnemonic instructions that must be translated to machine code by an assembler. It explains the assembling and linking process used to convert assembly code to machine code that can be burned into the PIC's program memory. Various PIC assembly language instructions are also described, including MOVLW, MOVWF, logic instructions, and bit manipulation instructions to set and clear bits on I/O ports.
The document discusses C programming for PIC microcontrollers. It covers the standard structure of a C program, including comments, header files, configuration bits, functions, and function bodies. It also discusses various C data types like unsigned char, signed char, unsigned int, and signed int. Examples are provided to illustrate how to use these data types and write C programs that toggle ports on a PIC microcontroller. The outcomes are for students to understand C programming languages for PIC18, the structure of C programs for PIC18, and common C data types used for PIC microcontrollers.
A starter guide how to use Microchip MPLAB IDE for PIC microcontrollers and related tools like MPLAB C18, C30 and C32 compilers, and how to MPLAB features to get connected and integrated with programmer/debugger devices and development kits from Microchip.
for more discussion and articles about different microcontroller platforms and tutorials please visit: http://elrayescampaign.blogspot.ca/
The document discusses the architecture and assembly language programming of PIC18 microcontrollers. It covers topics such as:
- PIC18 microcontrollers use a Harvard architecture with separate memory for instructions and data. They have a program memory, data memory, I/O ports, and support devices like timers.
- The PIC18 architecture is based on an advanced RISC design. Key components include registers like WREG for temporary data storage. Special function registers and general purpose registers are used to access I/O ports and timers.
- Assembly language instructions like MOVLW, ADDLW, and MOVWF are used to move data between program memory, registers and I/O ports. The
The document discusses the features and input/output basics of the AVR ATmega16 microcontroller. Key points include its Harvard architecture, 8-bit design, timers, ADC, and protocol support. It describes compiler tools, programming hardware, and pin configuration registers like DDR, PORT, and PIN. The DDR register sets the pin directions, PORT is used for output and pull-up configuration, and PIN reads pin states. Pull-up resistors prevent floating inputs. An exercise demonstrates configuring ports for different I/O functions.
This presentation discusses an embedded system project to control a fan based on temperature. It includes:
- An overview of Skyphi Technologies, an organization that provides training in embedded systems and other domains.
- A definition of embedded systems and examples like ATMs, aircraft systems, and more.
- An introduction to the AVR microcontroller and its features like the ATmega8, programming tools, and pin diagram.
- Explanations of embedded C programming structure, I/O ports, registers, and programming the AVR microcontroller.
- Details of the temperature controlled fan project including components, working principle, circuit diagram, and code overview.
- Applications of the temperature controlled fan
8051 programming skills using EMBEDDED CAman Sharma
It contains basic programming tips for embedded c for those who are just into it and don't know much about it....have a look in it and u will surely find it easy.
This document contains code for initializing and controlling a LCD display module connected to a PIC16F887 microcontroller. It defines macros for the LCD pins and functions for initializing the LCD, writing data, clearing the display, moving the cursor, and printing strings. The main program initializes the LCD, prints two strings to different rows, and loops continuously displaying them.
This document discusses analog to digital conversion and pulse width modulation.
It explains that analog signals from peripherals must be converted to digital signals the microcontroller can understand using an analog to digital converter (ADC). It also describes how pulse width modulation varies the duty cycle of a signal to control motor speed or other analog systems. Common applications like temperature measurement and motor control are provided as examples.
This document provides information about a course on programming PIC microcontrollers in C using the CCS PIC-C compiler. It discusses the recommended textbook, the topics that will be covered including PIC architecture, limitations of C as applied to PICs, programming PIC hardware, and using software libraries. It also describes how the course will be assessed through a 30 minute multiple choice test held at the end of term.
The PIC Microcontroller is an electronic device that is easy-to-use in both hardware and software. Sensing the environment by receiving inputs from many sensors, PIC Microcontroller affects its surroundings by controlling lights, motors, and a number of other accessories. It's intended for anyone making interactive hardware projects by connecting it with a power source, few leds and resistors.
This course is designed to introduce the PIC Microcontroller hardware and programming environment to get you started on building projects as soon as possible.
Unleash Your Inner Hero With this Course
-PIC Microcontroller Inner structure and Programming Introduction
-Leds, Resistors and Pushbuttons
-LCD Screens and Seven Segment Displays
-Motor and Keypad.
-DIY Projects and Quick Tips
A Tool for Creating Any Device Imaginable become a favorite of electronic Students and anyone interested in Device manufacturing because of their ease of use and extremely low cost.
Example projects include Ardupilot, a UAV platform able to control aerial drones.
Contents and Overview This course is designed for anyone interested in learning electronic design. No experience is required, and all you need is PIC Microcontroller and several low cost components.
With hours of content in many lectures, this course will take you from zero experience in electronics or programming to PIC Microcontroller Master.
Limited time offer
50% off
Join Today:https://goo.gl/WQIFNY
This document provides an overview of embedded systems and input/output interfacing. It discusses ports and port types, peripheral devices like LEDs and seven-segment displays, and output devices such as LCD screens and printers. The document uses examples from microcontrollers like PIC18F458 to explain how ports are used for interfacing and I/O applications in embedded systems.
The document discusses interfacing I/O ports on the PIC16F84 microcontroller. It describes how to configure the ports as inputs or outputs using the TRIS registers and how to read from and write to the pins. It also covers interrupts, timers, serial communication, analog to digital conversion, and provides an example of a water temperature alarm system using these concepts.
The document discusses the 8155 Programmable Interface Adapter chip. It can be used to interface I/O devices to a microprocessor like the 8085. The 8155 has programmable I/O ports, a timer, and memory. It is programmed by writing control words to its control register. An example is given of using an 8155 to read temperature data from an ADC and display it on LEDs using handshaking between the 8155 and ADC ports. Pseudocode is provided to initialize the 8155 ports and timer, trigger ADC conversions, read the temperature values, and continuously display updated values.
The ATmega8 is an 8-bit microcontroller based on the AVR RISC architecture. It achieves high throughput of up to 16 MIPS at 16 MHz through single-cycle execution of powerful instructions. The microcontroller uses a Harvard architecture that separates memory and buses for program and data. It has 8K bytes of flash memory, 512 bytes of EEPROM, and 1K byte of internal RAM. The ATmega8 has three I/O ports (Ports B, C, and D) that can be configured as either inputs or outputs through their associated data direction, pin, and port registers.
The document contains Verilog code for a single cycle processor including modules for a program counter, accumulator, ALU, adder, multiplexers, controller, data memory, instruction memory, and a test bench. It describes the design and implementation of the datapath and controller for a simple CPU using Verilog that performs arithmetic and logical operations on data stored in memory locations.
This document provides information about the features and architecture of the 8051 microcontroller. It describes the 8-bit CPU, 64K program memory, 64K data memory, 4K on-chip program memory, 128 bytes of on-chip data RAM, 32 I/O lines, two timers, UART serial communication, interrupt structure, and on-chip oscillator. It also covers the pin descriptions, registers, memory mapping, stack, I/O port programming, timers, and interrupts of the 8051. Finally, it discusses the instruction set groups for arithmetic, logical, data transfer, boolean, and program branching operations.
Programming avr microcontroller digital iManas Mantri
This document provides information on programming digital I/O for AVR microcontrollers in C. It discusses how to configure the DDR, PORT, and PIN registers to set pins as inputs or outputs. It gives an example of a program that continuously reads the logic values on port B and writes them to port C. It also shows a schematic and code for blinking 8 LEDs connected to an ATMega8515 microcontroller.
The document discusses the ATmega16 microcontroller. It begins by explaining the differences between microprocessors and microcontrollers, and introduces the ATmega16 as a low-power 8-bit microcontroller based on AVR architecture. It then details the features of the ATmega16 including its pinout, registers, memory, and I/O ports. The document also provides examples of coding and interfacing the ATmega16, such as blinking an LED and using delay functions.
The document is about a book titled "PIC microcontrollers for beginners, too!" that introduces microcontrollers and programming for PIC microcontrollers. It provides an overview of the book's contents which include introductions to microcontrollers and assembly language programming, descriptions of the PIC16F84 microcontroller and its instruction set, examples of assembly language programs, and tutorials on using the MPLAB programming environment and code samples. The book is intended for beginners to help them learn microcontroller fundamentals and get started with PIC microcontroller programming.
Programming the ARM CORTEX M3 based STM32F100RBT6 Value Line Discovery BoardGaurav Verma
This programming manual is providing the complete details of programming the STM32 Value-line discovery (a low-cost) evaluation board for Value-line of STM32 microcontrollers from STMicroelectronics.
Chp5 pic microcontroller instruction set copymkazree
The document provides an outline and descriptions of the instruction set for PIC microcontrollers, including common instructions like MOVLW, ADDWF, ANDLW, CALL, RETURN, and SLEEP. It describes the functionality of each instruction, their operands, and how they affect status register bits. Examples are given to illustrate how each instruction works and the resulting register values.
The document provides an overview of an introduction to the MPLAB integrated development environment presented by Microchip Technology. The summary covers:
1) The presentation will explain what MPLAB IDE is used for and walk through a simple project to demonstrate how it eases the embedded design cycle.
2) It will select a device, create a project, select language tools, add files to the project, create code, build the project, and test the code with a simulator.
3) This allows users to get familiar with the basic components of MPLAB and demonstrates how to assemble a project framework, build an application, and test it in the simulator.
This book guides the beginner to start up with Embedded C programming using MP LAB . This Book covers all interfacing examples with pic micro controller and guides beginners to develop projects on PIC micro controller
The document provides an introduction to the PIC16F877 microcontroller. It discusses that PICs are Harvard architecture microcontrollers made by Microchip with a RISC design. The PIC16F877 has an 8KB program memory, 368 bytes of data memory, and 256 bytes of EEPROM. It features ports, timers, ADC, and communication peripherals. Programming involves writing code, compiling to a hex file, and burning the file onto the PIC's flash memory using a programmer.
This document provides information about Microchip Technology, a manufacturer of microcontrollers and analog semiconductors. It discusses Microchip's headquarters and wafer fabrication facilities. It also lists some of Microchip's main competitors in the semiconductor industry. Additionally, it gives an overview of Microchip's microcontroller architectures like PIC and some key variants. It then presents a problem about designing a circuit to turn on an LED based on voltage levels. It provides information about analog to digital converters and how they work. Finally, it discusses the PIC12F683 microcontroller and some of its analog to digital converter registers used to read voltage levels.
A microcontroller is a computer system on a single chip that contains a processor core, memory, and programmable input/output peripherals. Microcontrollers are commonly used to control objects, processes, or events. They are often embedded in devices to control their functions. A microcontroller contains a CPU, RAM, ROM, flash memory, I/O ports, an ADC, and timers. Common microcontrollers include the Intel 8051, Atmel ATmega 16, and PIC microcontrollers. The microcontroller reads programmed instructions from flash memory and executes them via the CPU to control its I/O pins based on inputs.
Developing an avr microcontroller systemnugnugmacmac
This document provides an introduction to microcontrollers and AVR microcontrollers. It discusses what microprocessors and microcontrollers are, how they are used in various electronic devices. It then focuses on the AVR architecture, its features like flash memory, SRAM, EEPROM. It demonstrates how to interface an AVR chip with an LCD display and program it to display "Hello World". It describes the tools and steps needed to program the AVR, including using AVR Studio, GCC compiler and PonyProg programmer.
1. The document discusses embedded systems and Microchip PIC microcontrollers. It describes what embedded systems are and provides examples of application areas.
2. It explains the differences between microprocessors and microcontrollers, and discusses the architecture and features of Microchip's PIC microcontrollers.
3. The document provides an overview of programming PIC microcontrollers, including the instruction set, device structure, and basic circuit requirements.
This document contains code for initializing and controlling a LCD display module connected to a PIC16F887 microcontroller. It defines macros for the LCD pins and functions for initializing the LCD, writing data, clearing the display, moving the cursor, and printing strings. The main program initializes the LCD, prints two strings to different rows, and loops continuously displaying them.
This document discusses analog to digital conversion and pulse width modulation.
It explains that analog signals from peripherals must be converted to digital signals the microcontroller can understand using an analog to digital converter (ADC). It also describes how pulse width modulation varies the duty cycle of a signal to control motor speed or other analog systems. Common applications like temperature measurement and motor control are provided as examples.
This document provides information about a course on programming PIC microcontrollers in C using the CCS PIC-C compiler. It discusses the recommended textbook, the topics that will be covered including PIC architecture, limitations of C as applied to PICs, programming PIC hardware, and using software libraries. It also describes how the course will be assessed through a 30 minute multiple choice test held at the end of term.
The PIC Microcontroller is an electronic device that is easy-to-use in both hardware and software. Sensing the environment by receiving inputs from many sensors, PIC Microcontroller affects its surroundings by controlling lights, motors, and a number of other accessories. It's intended for anyone making interactive hardware projects by connecting it with a power source, few leds and resistors.
This course is designed to introduce the PIC Microcontroller hardware and programming environment to get you started on building projects as soon as possible.
Unleash Your Inner Hero With this Course
-PIC Microcontroller Inner structure and Programming Introduction
-Leds, Resistors and Pushbuttons
-LCD Screens and Seven Segment Displays
-Motor and Keypad.
-DIY Projects and Quick Tips
A Tool for Creating Any Device Imaginable become a favorite of electronic Students and anyone interested in Device manufacturing because of their ease of use and extremely low cost.
Example projects include Ardupilot, a UAV platform able to control aerial drones.
Contents and Overview This course is designed for anyone interested in learning electronic design. No experience is required, and all you need is PIC Microcontroller and several low cost components.
With hours of content in many lectures, this course will take you from zero experience in electronics or programming to PIC Microcontroller Master.
Limited time offer
50% off
Join Today:https://goo.gl/WQIFNY
This document provides an overview of embedded systems and input/output interfacing. It discusses ports and port types, peripheral devices like LEDs and seven-segment displays, and output devices such as LCD screens and printers. The document uses examples from microcontrollers like PIC18F458 to explain how ports are used for interfacing and I/O applications in embedded systems.
The document discusses interfacing I/O ports on the PIC16F84 microcontroller. It describes how to configure the ports as inputs or outputs using the TRIS registers and how to read from and write to the pins. It also covers interrupts, timers, serial communication, analog to digital conversion, and provides an example of a water temperature alarm system using these concepts.
The document discusses the 8155 Programmable Interface Adapter chip. It can be used to interface I/O devices to a microprocessor like the 8085. The 8155 has programmable I/O ports, a timer, and memory. It is programmed by writing control words to its control register. An example is given of using an 8155 to read temperature data from an ADC and display it on LEDs using handshaking between the 8155 and ADC ports. Pseudocode is provided to initialize the 8155 ports and timer, trigger ADC conversions, read the temperature values, and continuously display updated values.
The ATmega8 is an 8-bit microcontroller based on the AVR RISC architecture. It achieves high throughput of up to 16 MIPS at 16 MHz through single-cycle execution of powerful instructions. The microcontroller uses a Harvard architecture that separates memory and buses for program and data. It has 8K bytes of flash memory, 512 bytes of EEPROM, and 1K byte of internal RAM. The ATmega8 has three I/O ports (Ports B, C, and D) that can be configured as either inputs or outputs through their associated data direction, pin, and port registers.
The document contains Verilog code for a single cycle processor including modules for a program counter, accumulator, ALU, adder, multiplexers, controller, data memory, instruction memory, and a test bench. It describes the design and implementation of the datapath and controller for a simple CPU using Verilog that performs arithmetic and logical operations on data stored in memory locations.
This document provides information about the features and architecture of the 8051 microcontroller. It describes the 8-bit CPU, 64K program memory, 64K data memory, 4K on-chip program memory, 128 bytes of on-chip data RAM, 32 I/O lines, two timers, UART serial communication, interrupt structure, and on-chip oscillator. It also covers the pin descriptions, registers, memory mapping, stack, I/O port programming, timers, and interrupts of the 8051. Finally, it discusses the instruction set groups for arithmetic, logical, data transfer, boolean, and program branching operations.
Programming avr microcontroller digital iManas Mantri
This document provides information on programming digital I/O for AVR microcontrollers in C. It discusses how to configure the DDR, PORT, and PIN registers to set pins as inputs or outputs. It gives an example of a program that continuously reads the logic values on port B and writes them to port C. It also shows a schematic and code for blinking 8 LEDs connected to an ATMega8515 microcontroller.
The document discusses the ATmega16 microcontroller. It begins by explaining the differences between microprocessors and microcontrollers, and introduces the ATmega16 as a low-power 8-bit microcontroller based on AVR architecture. It then details the features of the ATmega16 including its pinout, registers, memory, and I/O ports. The document also provides examples of coding and interfacing the ATmega16, such as blinking an LED and using delay functions.
The document is about a book titled "PIC microcontrollers for beginners, too!" that introduces microcontrollers and programming for PIC microcontrollers. It provides an overview of the book's contents which include introductions to microcontrollers and assembly language programming, descriptions of the PIC16F84 microcontroller and its instruction set, examples of assembly language programs, and tutorials on using the MPLAB programming environment and code samples. The book is intended for beginners to help them learn microcontroller fundamentals and get started with PIC microcontroller programming.
Programming the ARM CORTEX M3 based STM32F100RBT6 Value Line Discovery BoardGaurav Verma
This programming manual is providing the complete details of programming the STM32 Value-line discovery (a low-cost) evaluation board for Value-line of STM32 microcontrollers from STMicroelectronics.
Chp5 pic microcontroller instruction set copymkazree
The document provides an outline and descriptions of the instruction set for PIC microcontrollers, including common instructions like MOVLW, ADDWF, ANDLW, CALL, RETURN, and SLEEP. It describes the functionality of each instruction, their operands, and how they affect status register bits. Examples are given to illustrate how each instruction works and the resulting register values.
The document provides an overview of an introduction to the MPLAB integrated development environment presented by Microchip Technology. The summary covers:
1) The presentation will explain what MPLAB IDE is used for and walk through a simple project to demonstrate how it eases the embedded design cycle.
2) It will select a device, create a project, select language tools, add files to the project, create code, build the project, and test the code with a simulator.
3) This allows users to get familiar with the basic components of MPLAB and demonstrates how to assemble a project framework, build an application, and test it in the simulator.
This book guides the beginner to start up with Embedded C programming using MP LAB . This Book covers all interfacing examples with pic micro controller and guides beginners to develop projects on PIC micro controller
The document provides an introduction to the PIC16F877 microcontroller. It discusses that PICs are Harvard architecture microcontrollers made by Microchip with a RISC design. The PIC16F877 has an 8KB program memory, 368 bytes of data memory, and 256 bytes of EEPROM. It features ports, timers, ADC, and communication peripherals. Programming involves writing code, compiling to a hex file, and burning the file onto the PIC's flash memory using a programmer.
This document provides information about Microchip Technology, a manufacturer of microcontrollers and analog semiconductors. It discusses Microchip's headquarters and wafer fabrication facilities. It also lists some of Microchip's main competitors in the semiconductor industry. Additionally, it gives an overview of Microchip's microcontroller architectures like PIC and some key variants. It then presents a problem about designing a circuit to turn on an LED based on voltage levels. It provides information about analog to digital converters and how they work. Finally, it discusses the PIC12F683 microcontroller and some of its analog to digital converter registers used to read voltage levels.
A microcontroller is a computer system on a single chip that contains a processor core, memory, and programmable input/output peripherals. Microcontrollers are commonly used to control objects, processes, or events. They are often embedded in devices to control their functions. A microcontroller contains a CPU, RAM, ROM, flash memory, I/O ports, an ADC, and timers. Common microcontrollers include the Intel 8051, Atmel ATmega 16, and PIC microcontrollers. The microcontroller reads programmed instructions from flash memory and executes them via the CPU to control its I/O pins based on inputs.
Developing an avr microcontroller systemnugnugmacmac
This document provides an introduction to microcontrollers and AVR microcontrollers. It discusses what microprocessors and microcontrollers are, how they are used in various electronic devices. It then focuses on the AVR architecture, its features like flash memory, SRAM, EEPROM. It demonstrates how to interface an AVR chip with an LCD display and program it to display "Hello World". It describes the tools and steps needed to program the AVR, including using AVR Studio, GCC compiler and PonyProg programmer.
1. The document discusses embedded systems and Microchip PIC microcontrollers. It describes what embedded systems are and provides examples of application areas.
2. It explains the differences between microprocessors and microcontrollers, and discusses the architecture and features of Microchip's PIC microcontrollers.
3. The document provides an overview of programming PIC microcontrollers, including the instruction set, device structure, and basic circuit requirements.
The document discusses programming PIC microcontrollers and interfacing with various devices. It begins with an introduction to PIC16F877A microcontrollers and MPLAB IDE. It then describes several labs for interfacing with LEDs, LCDs, keypads, analog to digital converters, pulse width modulation, relays, GSM modules, I2C protocols, and real-time clocks. The labs provide code examples for blinking LEDs, displaying messages on LCDs, reading analog sensor values, controlling relays, sending and receiving GSM messages, using I2C communication, and working with real-time clocks.
This document describes an energy saving visitor counter project that uses a microcontroller and infrared sensors. The objective is to design a circuit that can count the number of people entering and exiting a room and control the room light accordingly. It uses an IR transmitter and receiver to detect movement and increments or decrements the counter value, which is displayed on seven-segment displays. The microcontroller controls the counting and display functionality while receiving input from the IR sensors. Proteus and Keil software are used to simulate and program the microcontroller respectively.
Overview of Microcontroller and ATMega32 microcontrollerRup Chowdhury
This presentation provides an overview of microcontrollers and the ATMega32 microcontroller. It defines a microcontroller as a small computer on a single chip that contains a CPU, memory, and programmable I/O. It describes the typical elements of a microcontroller including the processor, memory, I/O peripherals, ADC, DAC, and system bus. It then discusses features of the ATMega32 like its architecture, pins, applications, and special features. In closing, it thanks the audience for their time.
This document describes a microcontroller-based password protected home appliance system. It contains an introduction, block diagram, flowchart, component descriptions, circuit diagram, and descriptions of hardware and software implementations. The system uses an ATmega8 microcontroller to control access to home appliances via a keypad password entry system. It allows authorized users to access appliances when the entered password matches the one stored in memory. The document also discusses objectives, components, programming, and conclusions regarding lessons learned and potential future modifications.
This document provides an overview of embedded systems and the AVR microcontroller. It discusses how embedded systems combine hardware and software to perform tasks like processing and storing data. Examples of embedded systems include those used in biotechnology, telecom, military, automotive, and consumer electronics. It then describes the AVR microcontroller, its features, memory segments, pin descriptions, and how to interface it with hardware using Embedded C. Code examples are provided to blink LEDs and interface with 7-segment displays and LCDs.
The document discusses the architecture of PIC18 microcontrollers. It begins by introducing the PIC microcontroller family and noting their popularity. It then explains key aspects of the PIC18 architecture, including that it uses a Harvard architecture with separate memory spaces for instructions and data. The document outlines the main components of the PIC18 architecture, including the CPU, program ROM, data memory, I/O ports, and special function registers. It provides details on the registers used in the PIC18, including the working register WREG, general purpose registers, and special function registers.
The document describes a lab experiment on addition of two 8-bit numbers using an 8085 microprocessor. It includes:
1) An algorithm that initializes the carry to zero, loads the two 8-bit numbers into registers, adds the numbers and checks for carry, increments the carry if needed, and stores the result.
2) The assembly language program with labels, mnemonics, hex codes and comments to implement the algorithm.
3) Inputs, outputs and results with and without carry from adding sample 8-bit numbers.
Embedded Application : An Autonomous Robot or Line Follower BotEr. Raju Bhardwaj
This document discusses a line follower robot and embedded systems. It provides details about:
1. A line follower robot is a machine that follows a black or white line on a surface using infrared sensors to detect the line.
2. An embedded system combines hardware and software and is used in applications like personal computers, phones, home automation, and more. It requires inputs, processing, and outputs.
3. Microcontrollers like the ATmega8 are commonly used as the "brain" of embedded systems and robots to control inputs, outputs, and processing. The document discusses registers used to configure ports on the microcontroller.
The document introduces how to create a basic "Hello World" project in MPLAB IDE using a PIC32 microcontroller. It describes setting up a new project, creating a source code file, adding code for digital output pins on ports A and B, compiling and running the code in the simulator. The code turns on LEDs connected to the ports by setting the pins as outputs and writing a 1 to the ports.
An embedded system is a combination of hardware and software designed for a specific task. It contains a microcontroller or microprocessor that executes programmed instructions. A microcontroller contains a CPU, memory, and programmable input/output peripherals on a single chip. The Atmega8 is an 8-bit AVR microcontroller developed by Atmel with 8KB of flash memory. It has ports that can be configured as inputs or outputs using data direction registers to interface with external devices like LEDs for blinking. Programming the microcontroller involves writing code, compiling it, and flashing the hex file onto the chip.
1.Gives basic idea about what is arduino? and their funtionalites.
2. Applications of arduino
3. Adruino programming
4. what is Nodemcu ?
5. pindiagram of Nodemcu
This document describes an embedded systems project involving an Atmega16 microcontroller to create a stopwatch. It includes sections on the microcontroller, analog to digital conversion, timers, interfacing with an LCD display, and the stopwatch program code. The program uses buttons on ports A and D to start, stop, reset, and increment the stopwatch which displays hours, minutes, seconds, and tenths of seconds on the LCD. The document provides explanations of the microcontroller features and registers used in the project.
The document provides information about PIC microcontrollers including their history, architecture, features, and programming. It discusses that PIC was developed in 1975 to improve I/O performance. Key points include:
- PIC uses Harvard architecture with separate memory for program and data.
- Features include baseline, mid-range, enhanced mid-range, and PIC18 models with varying complexity and peripherals.
- Programming involves setting I/O ports and individual pins as input or output using SFR registers like PORT, TRIS, and LAT.
- Timers can generate delays or count external events using internal or external clocks. Serial communication transfers data one bit at a time through a single pin.
The document provides an introduction to PIC microcontrollers. It discusses that PIC stands for Programmable Intelligent Computer and is a microcontroller with built-in memory, RAM, and modules like EEPROM and timers. PICs are popular due to their low cost, availability of development tools, small instruction set, and small size. The document outlines the different PIC architectures, families, speeds, and memory sizes. It provides details on the registers, peripherals like flash memory, RAM, EEPROM, I/O ports, and USART serial communication.
This document provides a summary of a practical training seminar report on embedded systems conducted at CMC Academy in Jaipur. It discusses the company profile of CMC Academy, provides definitions and comparisons of microprocessors and microcontrollers. It also describes some common electronic components used in embedded systems like resistors, LEDs, transistors, integrated circuits. Programming concepts for 8051 microcontrollers like I/O ports, timers and interrupts are explained. The document concludes by noting the widespread use of embedded systems in appliances, vehicles, medical devices and more.
Walmart Business+ and Spark Good for Nonprofits.pdfTechSoup
"Learn about all the ways Walmart supports nonprofit organizations.
You will hear from Liz Willett, the Head of Nonprofits, and hear about what Walmart is doing to help nonprofits, including Walmart Business and Spark Good. Walmart Business+ is a new offer for nonprofits that offers discounts and also streamlines nonprofits order and expense tracking, saving time and money.
The webinar may also give some examples on how nonprofits can best leverage Walmart Business+.
The event will cover the following::
Walmart Business + (https://business.walmart.com/plus) is a new shopping experience for nonprofits, schools, and local business customers that connects an exclusive online shopping experience to stores. Benefits include free delivery and shipping, a 'Spend Analytics” feature, special discounts, deals and tax-exempt shopping.
Special TechSoup offer for a free 180 days membership, and up to $150 in discounts on eligible orders.
Spark Good (walmart.com/sparkgood) is a charitable platform that enables nonprofits to receive donations directly from customers and associates.
Answers about how you can do more with Walmart!"
How to Setup Warehouse & Location in Odoo 17 InventoryCeline George
In this slide, we'll explore how to set up warehouses and locations in Odoo 17 Inventory. This will help us manage our stock effectively, track inventory levels, and streamline warehouse operations.
A workshop hosted by the South African Journal of Science aimed at postgraduate students and early career researchers with little or no experience in writing and publishing journal articles.
বাংলাদেশের অর্থনৈতিক সমীক্ষা ২০২৪ [Bangladesh Economic Review 2024 Bangla.pdf] কম্পিউটার , ট্যাব ও স্মার্ট ফোন ভার্সন সহ সম্পূর্ণ বাংলা ই-বুক বা pdf বই " সুচিপত্র ...বুকমার্ক মেনু 🔖 ও হাইপার লিংক মেনু 📝👆 যুক্ত ..
আমাদের সবার জন্য খুব খুব গুরুত্বপূর্ণ একটি বই ..বিসিএস, ব্যাংক, ইউনিভার্সিটি ভর্তি ও যে কোন প্রতিযোগিতা মূলক পরীক্ষার জন্য এর খুব ইম্পরট্যান্ট একটি বিষয় ...তাছাড়া বাংলাদেশের সাম্প্রতিক যে কোন ডাটা বা তথ্য এই বইতে পাবেন ...
তাই একজন নাগরিক হিসাবে এই তথ্য গুলো আপনার জানা প্রয়োজন ...।
বিসিএস ও ব্যাংক এর লিখিত পরীক্ষা ...+এছাড়া মাধ্যমিক ও উচ্চমাধ্যমিকের স্টুডেন্টদের জন্য অনেক কাজে আসবে ...
Chapter wise All Notes of First year Basic Civil Engineering.pptxDenish Jangid
Chapter wise All Notes of First year Basic Civil Engineering
Syllabus
Chapter-1
Introduction to objective, scope and outcome the subject
Chapter 2
Introduction: Scope and Specialization of Civil Engineering, Role of civil Engineer in Society, Impact of infrastructural development on economy of country.
Chapter 3
Surveying: Object Principles & Types of Surveying; Site Plans, Plans & Maps; Scales & Unit of different Measurements.
Linear Measurements: Instruments used. Linear Measurement by Tape, Ranging out Survey Lines and overcoming Obstructions; Measurements on sloping ground; Tape corrections, conventional symbols. Angular Measurements: Instruments used; Introduction to Compass Surveying, Bearings and Longitude & Latitude of a Line, Introduction to total station.
Levelling: Instrument used Object of levelling, Methods of levelling in brief, and Contour maps.
Chapter 4
Buildings: Selection of site for Buildings, Layout of Building Plan, Types of buildings, Plinth area, carpet area, floor space index, Introduction to building byelaws, concept of sun light & ventilation. Components of Buildings & their functions, Basic concept of R.C.C., Introduction to types of foundation
Chapter 5
Transportation: Introduction to Transportation Engineering; Traffic and Road Safety: Types and Characteristics of Various Modes of Transportation; Various Road Traffic Signs, Causes of Accidents and Road Safety Measures.
Chapter 6
Environmental Engineering: Environmental Pollution, Environmental Acts and Regulations, Functional Concepts of Ecology, Basics of Species, Biodiversity, Ecosystem, Hydrological Cycle; Chemical Cycles: Carbon, Nitrogen & Phosphorus; Energy Flow in Ecosystems.
Water Pollution: Water Quality standards, Introduction to Treatment & Disposal of Waste Water. Reuse and Saving of Water, Rain Water Harvesting. Solid Waste Management: Classification of Solid Waste, Collection, Transportation and Disposal of Solid. Recycling of Solid Waste: Energy Recovery, Sanitary Landfill, On-Site Sanitation. Air & Noise Pollution: Primary and Secondary air pollutants, Harmful effects of Air Pollution, Control of Air Pollution. . Noise Pollution Harmful Effects of noise pollution, control of noise pollution, Global warming & Climate Change, Ozone depletion, Greenhouse effect
Text Books:
1. Palancharmy, Basic Civil Engineering, McGraw Hill publishers.
2. Satheesh Gopi, Basic Civil Engineering, Pearson Publishers.
3. Ketki Rangwala Dalal, Essentials of Civil Engineering, Charotar Publishing House.
4. BCP, Surveying volume 1
Reimagining Your Library Space: How to Increase the Vibes in Your Library No ...Diana Rendina
Librarians are leading the way in creating future-ready citizens – now we need to update our spaces to match. In this session, attendees will get inspiration for transforming their library spaces. You’ll learn how to survey students and patrons, create a focus group, and use design thinking to brainstorm ideas for your space. We’ll discuss budget friendly ways to change your space as well as how to find funding. No matter where you’re at, you’ll find ideas for reimagining your space in this session.
How to Manage Your Lost Opportunities in Odoo 17 CRMCeline George
Odoo 17 CRM allows us to track why we lose sales opportunities with "Lost Reasons." This helps analyze our sales process and identify areas for improvement. Here's how to configure lost reasons in Odoo 17 CRM
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
2. What is microcontroller? ..cont
•A microcontroller is a relatively low cost single chip microcomputer
•A single-chip microcomputer indicates that the complete
microcomputer system lies within the confines of the integrated
circuit chip.
•Microcontrollers are capable of storing and running the program
that was written, compiled and downloaded onto it.
3. What is microcontroller? ..cont
main parts of a microcontroller generally consist of
the:
Central Processing Unit (CPU), Random Access
Memory (RAM), Read Only Memory (ROM),
input/output lines (I/O lines), serial and parallel
ports, timers and other peripherals such as an
analog to digital (A/D) converter and a digital to
analog (D/A) converter.
3
4. ?Why use a Microcontroller
The microcontroller's ability to store and run unique programs
makes it fairly flexible. For example, one can program a
microcontroller to perform functions based on predetermined
situations (I/O-line logic) and selections.
The microcontroller's capability to carry out mathematical
and logic functions allows it to imitate complicated logic and
electronic circuits.
4
5. ? Why use a PIC Microcontroller
This type of microcontroller is chosen because it is low
cost, reliable, easy to use and capable of performing a
wide range of tasks.
The required tasks by the
proposed system are carried
out via software using
C language .
5
6. Electrical consideration
To deploy a PIC 16F877 microcontroller
within the framework of a project, it is
important to pay particular attention to the
following components:
1. Power supply.
2. reset button .
3. oscillator.
6
7. Power supply
The PIC microprocessor offers a wide operating voltage range
varying from 2V DC to 6V DC, depending, naturally, on the
particular device used .
A simple 5V DC power supply will be used .
A 5V DC supply is easy to construct due to the availability of
monolithic voltage regulators such as the 7805 positive 5V
regulator, which provides good regulation as well as automatic
thermal shutdown and short circuit overload protection.
7
8. Power supply
The hardware configuration of the
5V DC power supply is shown in
.Figure
The circuit consists of a 7805 IC
voltage regulator and some ripple. reducing smoothing capacitors
8
9. Circuit Layout and Construction
1) The oscillator crystal and capacitors should be located in close
proximity to the IC with short copper tracks or connecting leads.
2) A small decoupling capacitor (≈ 0.1µF) should be placed across the
power supply and as close as possible to the PIC MCU.
9
10. :Developing a Project Using PIC MCU
Developing a PIC-based project takes only six easy
steps:
1. Type in the program
2. Compile the program into a binary file
3. Simulate the program and debug it
4. Load the binary program into the PIC’s memory
5. Wire up the circuit
6. Switch on and test.
10
11. :Using C-Compiler for PIC MCU
We look at two programs
as shown in The figure
First is PIC C Compiler
Second is proutes.
We will talk about both
11
12. Why we choose C-programming language
• C-language is the best option to program microcontrollers.
This is because C-language is user friendly, efficient and
requires less code to perform the associated tasks
12
13. Pic component
The pin diagram of the PIC 16F877
chip, which is utilized in the present
work, is shown in Figure.
As shown there is 5 I/O ports
(A,B,C,D,E).
PORT A and PORT E may be used as
Analog to Digital input
Pin 13 &14 are crystal input
Pin RC6 & RC7 are serial interface
13
14. Port A
What is a port :is a set of pins
every pin construct a one bit.
RA0 RA1 RA2 RA3 RA4 RA5
PORT A may be used as Analog to Digital input and used
with LCD device
14
17. PORT C
RC0 RC1 RC2 RC3 RC4 RC5 RC6 RC7
PORT C contain of 8 bits usually use as digital i/o ports and
we use it as a parallel port’s
17
18. PORT D
RD0 RD0 RD0 RD0 RD0 RD0 RD0 RD0
PORT D contain of 8 bits usually use as digital i/o ports and
we use it as a parallel port’s
18
19. Include device
Include libraries
Set fuses
Set delay use
function
Define your
global registers
#include <16f877a.h>
#include "lcd_kbd1.c"
#fuses xt,NOWDT
#use delay(clock=4000000)
int value;
void main() {
while(1)
{
}
}//MAIN
main
Your code
19
End main
20. Program in c
1. #include <16f877a.h>
2. #include "lcd_kbd1.c"
3. #fuses xt,NOWDT
4. #use delay(clock=4000000)
5. int value;
6. void main() {
7.
8. while(true)
9.
{
10.
11. }
12.}//MAIN
20
21. Data types
Int1 or short
Defines a 1 bit number
Int8 or int
Defines an 8 bit number
Long or int16
Defines a 16 bit number
int32
Char
Defines a 32 bit number
Defines a 32 bit floating point
number
Defines a 8 bit character
void
Indicates no specific type
float
21
22. operators
arithmetic
Bitwise
Addition (+)
Logic and (&)
Subtraction (-)
Logic or (|)
Division (/)
multiplication (*)
Increment (++)
decrement (--)
not (~)
logic
Logic and (&&)
Logic or (||)
One’s
complement (!)
Other are known by default such as
equality and inequality,….etc.
Note: see example on slide number 32
22
23. Interface divided into two kinds:
1.parallel interface
2. serial interface
Parallel Interface
Port interface
Decide port as input or output
Output a value on the port
Pin interface
Decide pin as
input or output
Output high
Read a value from the port
Output low
23
25. ?How to compile code
If your code is well
done and no
errors this
message will
appear.
A list of files will be
created in the
same location of c
file, you need hex
file.
25
26. Protues simulation software
This product combines mixed mode circuit simulation,
micro-processor models and interactive component
models to allow the simulation of a complete microcontroller based design.
As shown before double click on the icon (see).
26
27. Protues simulation software
Press P to select
component from
list as shown in
Figure
27
Prepared by : Eng. Sa’ed M. Hayajneh & Eng. Hadeel Qasaimeh
30. Start programming
.Now we will review a general points in C language
Then we will talk about special commands in CCS C
.Compiler
30
31. parallel Ports commands and function’s
set_tris_b (value);
You can use that function with port B and A
and C and d for example:
1.
set_tris_c (0x00); //port c is output
2.
set_tris_b (0xff);//port b is input
3.set_tris_d (0x0f);//D0-D3 are input and D4-D7 are
output
31
32. How that command is work
output <- 0
That command will initialize your port to
prepare it to be input or output .
For example if we use set_tris_b (0x00);
RB7
output <- 0
RB6
output <- 0
RB5
output <- 0
RB4
that mean port B is prepared to be output and
(0x00) mean ox with hex 00 [0000,0000] output <- 0
and 0 is short cut to output
RB3
output <- 0
RB2
output <- 0
RB1
output <- 0
RB0
32
33. Another example
For example if we use set_tris_b (0xf0);
input <- 1
RB7
input <- 1
RB6
input <- 1
RB5
input <- 1
RB4
output <- 0
RB3
output <- 0
RB2
output <- 0
RB1
output <- 0
RB0
33
34. Parallel port commands ..cont
To output a value direct to a port:
output_a (value);
• value is a 8 bit int.
• To input a value direct from a port.
New= input_b();
• new is a 8 bit predefined int.
34
35. :Let consider the following example
#include <16f877A.h>
#fuses xt,NOWDT
#use delay(clock=4000000)
int8 value;
void main()
{
set_tris_d(0x00);
set_tris_b(0xff);
output_d(0x00);
while(TRUE)
{
value = input_b();
output_d(value);
delay_ms(1000);
}
}
35
38. Pin commands
A Pin is one bit of a port
For example, port D contain 8 pins.
D0
D1
D2
D3
D4
D5
D6
D7
Port D
• Note that not necessary that all ports contains
8 pin
Prepared by : Eng. Sa’ed M. Hayajneh & Eng. Hadeel Qasaimeh
38
39. Pin commands ..cont
You have the choice to output high or low value on a
pin (one bit).
To output high or low value direct to a port:
output_high (PIN_A0);
output_low (PIN_A0);
• To input a value direct from a port.
value = input (pin)
• Value is TRUE if pin is high ,and FALSE if pin low
39
41. .Delay commands
You may need to delay your code some seconds less or more.
Your code already know the clock that you will work on from the
PRE-PROCESSOR :
#use delay (clock=speed)
We talk about it before.
This line Tells the compiler the speed of the processor and enables
the use of the built-in functions: delay_ms(), delay_us() and
delay_cycles (count) .
41
42. Delay commands ..cont
#use delay (clock=speed)
speed is a constant 1-100000000 (1 Hz to 100 MHz).
•delay_ms (time) .
•time - a variable 0-255 or a constant 0-65535.
•This function will create code to perform a delay of the
specified length. Time is specified in milliseconds.
42
43. Delay commands ..cont
•delay_us (time) .
•time - a variable 0-255 or a constant 0-65535.
•Creates code to perform a delay of the specified length.
Time is specified in microseconds
•delay_cycles (count) ;
count - a constant 1-255
•Creates code to perform a delay of the specified number of
instruction clocks (1-255). An instruction clock is equal to four
oscillator clocks.
43
44. :Let consider the following example
We want to
output pins(D0D3)high and
pins(D4-D7)
Low for 1second
Then do the
inverse
44
45. Let consider the following example:
#include <16f877A.h>
#fuses xt,NOWDT
#use delay(clock=4000000)
void main()
{
set_tris_d(0x00);
output_d(0x00);
while(TRUE)
{
output_d(0x0f);
delay_ms(1000);
output_d(0xf0);
delay_ms(1000);
}
}
45
46. Deal with LCD library
Most of microcontroller devices are using 'smart LCD'
displays to output visual information.
The LCD requires 3 "control" lines from the
microcontroller: Enable (E), Read/Write (R/W) ,
Register select (RS) .in addition to data lines.
CCS C LCD library give them automatically.
46
47. Deal with LCD library
:LCD interface with PIC 16f877a is shown in the following
47
48. Deal with LCD library
There is a lot of LCD libraries ,,we will introduce one
of them called “lcd_kbd1.c”
This c file must be included in the following path to
get ready:
My computer/c/program file/picc/drivers/lcd_kbd1.c
48
49. Deal with LCD library
This library contain the following function:
1) LCD_Init ( );.
2) LCD_PutCmd ( CLEAR_DISP );
3) LCD_SetPosition ( LINE_16_1);
4) printf(LCD_PutChar,“AILA Company" );
First line this will power lcd on, this function defined
on the begging of the code once.
Second clear display.
Third set cursor on line one or two
Fourth display data or sentence you want
49
50. .Print "hello, world "on LCD
Traditionally the first code is to print the following sentence
“hello ,world”.
end
start
no
Power up LCD
Set curser
yes
Print character
Another
sentence?
Wait short time
50
51. .Print a sentence on LCD
Print “just “
On line one and
Print ”university”
On line two and
wait for 2
seconds
Redo always
51
53. .Print different values on LCD
As I mention before c deal with different types of data
(int ,char, string , float ,…etc).
If you want to print some value you must tell lcd what
kind of data this value, using the formats:
Character
Strings
Unsigned int
Signed int
Long unsigned int
(Hex int (lower case
(Hex int (upper case
(Hex long int (lower case
(Hex long int (upper case
Float
c
u
d
Lu
x
X
Lx
LX
F
53
54. .Print different values on LCD
Format Example:
Int value =0x02;
LCD_SetPosition ( LINE_16_1);
printf(LCD_PutChar,“value is:" );
LCD_SetPosition ( LINE_16_2);
printf(LCD_PutChar,“%u”,value );
Similarly :
%4X
0002
54
55. .Read a port and display the result
Read port B
Print the value
named by ”bvalue”
wait for 2sec
Always repeat this
operation
55
56. .Read a port and display the result
#include <16f877A.h>
#fuses xt,NOWDT
#use delay(clock=4000000)
#include "lcd_kbd1.c"
int bvalue;
void main()
while(TRUE)
{
bvalue = input_b();
LCD_SetPosition ( LINE_16_1);
printf(LCD_PutChar,“bvalue is:");
LCD_SetPosition (LINE_16_2);
printf(LCD_PutChar,"%u",bvalue);
{
}
LCD_Init ( );
LCD_PutCmd ( CLEAR_DISP );
set_tris_b(0xff);
}
56
57. !!Wait a minute
?How to print on a specific pixel
Each line in LCD (16X2) divided into 16
pixel each line, this found on
:datasheet. example
LCD_SetPosition ( 0x80);
printf(LCD_PutChar,"v1");
57
58. Deal with keypad
The keypad is actually a collection of push-buttons, organized into a
matrix. It looks like this:
58
59. Deal with keypad
If you have a different layout keypad, you can change
the definition of the buttons (key table) in the source
code.
You can use a 3x4 keypad or a 4x4 keypad. The
advantage of the bigger keypad is that you can use the
extra letters in codes. In case of using a 3x4 keypad,
simply leave the COL3 input unconnected, no other
modification is required. If you don't have a keypad,
you can even wire one from push-buttons.
59
60. Deal with keypad
In order for the microcontroller to scan the keypad, it outputs a nibble to
force one (only one) of the columns low and then reads the rows to see if any
buttons in that column have been pressed.
The columns are pulled up .
Consequently, as long as no buttons are pressed, the microcontroller sees a
logic high on each of the pins attached to the keypad rows.
The nibble driven onto the columns always contains only a single 0. The only
way the microcontroller can find a 0 on any row pin is for the keypad button
to be pressed that connects the column set to 0 to a row. The controller
knows which column is at a 0-level and which row reads 0, allowing it to
determine which key is pressed. For the keypad, the pins from left to right
are: R1, R2, R3, R4, C1, C2, C3, C4.
60
61. Deal with keypad
Use the previous
subroutine to
print the key
pressed on LCD.
Always repeat
this operation
61
63. Deal with keypad
.Try to output the value of key pressed parallel
Think how to output character on parallel port
.See how to convert character into integer
63
64. Analog to digital conversion
As we mention before (see) PIC have 8 pin as
analog/digital input ,every one called channel.
Follow the following steps:
1. Setup ADC mode.
2. Choose channel.
3. Wait short time.
4. read
64
65. Analog to digital conversion
1.
example.
Float value;
setup_adc_ports( ALL_ANALOG );
set_adc_channel( 0 );
Delay_ms(100);
value = read_adc();
65
66. Analog to digital conversion
Read both channel
periodically.
Let channel one is
light and second is
temperature.
Display the value
on LCD
66
68. Use internal eeprom of chip
The data EEPROM and Flash program memory is
readable and writable during normal operation
In PIC16f877a it 256 byte size.
To read a value use the following command:
value = read_eeprom (address) ;
• address is an (8 bit or 16 bit depending on the part)
int . value must predefined as 8 bit int.
• The
68
69. Use internal eeprom of chip
To write a value (int) use the following command:
write_eeprom (address,value) ;
• address is an (8 bit or 16 bit depending on the
part) int .
• The value must predefined as 8 bit int.
69
70. !!!Wait a minute
What if you want to write or read other type of
data on your chip internal eeprom?
What if you need to save a huge size of data?
Its depend upon your cleverness
70
71. Take the advantage of using
interrupts
When interrupt occur the compiler will generate code
to jump to the function when the interrupt is detected.
It will generate code to save and restore the machine
state, and will clear the interrupt flag.
Its useful to detect event in huge projects.
As an example :fire accidents .
71
72. Take the advantage of using
interrupts
PIC microcontroller deal with different kinds of
interrupts ,depending on the device you use.
As an example,16f877 deal with 15 kind of interrupt.
72
73. Take the advantage of using
interrupts
To deal with interrupts just follow the following
steps:
1. Enable global interrupts
enable_interrupts(GLOBAL);
2. Enable the specific interrupt.
enable_interrupts(INT_TIMER0); //timer0 intterupt
73
74. Take the advantage of using
interrupts
:Finally write interrupt subroutine ; for example.3
#int_rda
serial_isr()
{
//your own code
}
74
75. Take the advantage of using
interrupts
I will introduce three kinds of interrupts
1. RB change interrupt , which detect any change
on B4-B7 (Port B ).
2. External interrupt, which detect positive
/negative edge on RB0.
3. RDA interrupt ,which detect and sense
availability of data on RS232 port (this will
explained later).
75
78. External interrupt
In this type there is extra command:
ext_int_edge (source, edge) ;
• source is a constant 0,1 or 2 for the PIC18XXX and 0
otherwise source is optional and defaults to 0 edge is a
constant H_TO_L or L_TO_H representing "high to low"
and "low to high" .
•Determines when the external interrupt is acted upon. The
edge may be L_TO_H or H_TO_L to specify the rising or
falling edge.
78
81. RDA RS232 interrupt
This section will explained later ,we must introduce
RS232 library first.
81
82. RS232 library
To communicate through RS232 Port, we have to
define the port as follows:
#use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7)
•This called hardware rs232
•baud=is boud rate i.e.data transfer rate per second and we
choose to be=9600
•Xmit: is transmitter pin, its standard as pin C6
•rcv: is recevier pin, its standard as pin C7
82
83. RS232 library
To write data to RS232 Port:
printf (Aila );
Aila is data to write.
It's advised to set the type of data i.e.
printf ("%s",Aila);
where "%s" tell the pic that Aila is a string (array of
characters).
83
84. RS232 library
To read data to RS232 Port:
value = getc();
value=getch();
value=getchar();
You may use any one of them.
Value is one character.
84
85. RS232 library
To read data (string) from RS232 Port:
value = gets();
• Or do loop technique as the following:
char RX [100];
RX[i++]=getch();
•100 is the buffer ,every device have different size of buffer
•I is int
85
86. RS232 library
Other strongly related topic is to use RDA interrupt:
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
•And do read operation when interrupt occur instead of wait
data all time ,and check the flag periodically.
#int_rda
void serial_isr() {
RX[i++]=getch();
flag=1;
}
86
87. Built two codes first send the following “ya raaab” every 5 seconds
The second receive it and print on LCD
87
97. Use string library
If your code needs to process and analyze some
string, then you must know and deal with "string.h"
library .
Follow the following procedure:
1. Include the library:
#include <string.h>
97
98. Use string library
Now you can use function directly ,here is some of. 2
:them
Strcat(S1,S2), it will past string S1 and string S2 and
put the result on S1
strcmp (s1, s2), it compare string S1 with string S2
and return True or false, for ex:
if(!strcmp(S2, S5));
• this line check if S2 and S5 are equal.
98
99. Use string library
strcpy(S1,"*");,this copy * to S1.
strcspn (s1, s2),its Count of initial chars in s1not in s2
strcpy(S1,"*");
strcpy(S3,"#");
strcpy(RX,"12345*Aila#");
rank1=strcspn(RX, S1);
rank2=strcspn(RX, S3);
rank1 is integer and equal to 5
rank2 is integer and equal to10
99
100. Use string library
?. How to analyze strings
Try to get string analyze it and print on
.LCD
This will left for you
100