Introduction to ATtiny85

Hey Guys! Hope you are doing well. I am back to give you a daily dose of valuable information. Today, I'll discuss the details on the Introduction to ATtiny85. It is an 8-bit AVR microcontroller, introduced by Microchip, and is based on RISC CPU. It comes with 8-pin interface (PDIP) and falls under the category of low power controllers. Programmable watchdog timer and 10-bit ADC converter are added in the device that makes it suitable for sensor interfacing and resetting the device in case it gets stuck in an infinite loop. Microchip never fails to satisfy the requirements of any individual by providing flawless microcontroller modules that are directly or remotely connected with automation and embedded systems. With the invention of these tiny onboard modules, development of electronic projects has become easy and hassle-free more than ever before. In this tutorial, I'll cover each and everything related to ATtiny85, its pinout, pin description, main features, block diagram, and applications. Let get down to the nitty-gritty of this module and nail down everything you need to know.

Introduction to ATtiny85

  • ATtiny85 is an 8-bit AVR microcontroller that comes with 8-pin interface and mainly used in automation and Arduino projects.
  • The CPU is based on RISC architecture and is mainly called low power controller that stands fit for the real-time applications that can operate on minimum power.
  • The program memory is 8KB while both EEPROM and RAM contain a memory space of around 512 bytes. These memory spaces are very useful for storing the number of instruction in the form of code.
  • This module comes with only one port called Port B that is a bi-directional port and contains 6 I/O pins with internal pull-up resistors. The output buffers on PORTB are designed with symmetrical drive characteristics that come with both high sink and source capability. It is important to note that, Port B pins are externally pulled low and tri-stated that will source current if the pull-up resistors are activated.
  • External and internal interrupts are available on the board, while 32 general purpose registers are included in the device that are mainly called data holding spaces.
  • Two 8-bit timers are added in the device where one timer comes with compare modes and can be used both ways i.e. timer as well as a counter while other is high-speed timer/counter.
  • This module comes with software select power saving modes that are very helpful for the applications that operate with minimum power.
  • Like other controllers introduced by the Microchip, this module comes with 10-bit ADC converter that houses 4 analog channels that help in sensor interfacing and converting analog signals to digital ones.
  • This tiny chip is available in four packages called PDIP, SOIC, TSSOP, and QFN where first three come with 8-pin interface while the last one contains 20 pins.
  • Digital communications like I2C and SPI can be easily employed using this module that helps in developing a communication with external devices.

1. ATtiny85 Features

You have got a brief overview of this module. Now we cover the main features that will help you anticipate the major characteristic associated with the module. The following figure shows the complete features of ATtiny85.
ATtiny85 Features
No. of Pins 8
CPU RISC 8-Bit AVR
Operating Voltage 1.8 to 5.5 V
Program Memory 8K
Program Memory Type Flash
RAM 512 Bytes
EEPROM 512 Bytes
ADC Number of ADC Channels 10-Bit 4
Comparator 1
Packages PDIP (8-Pin) SOIC (8-Pin) TSSOP (8-Pin) QFN/MLF (20-Pin)
Oscillator up to 20 MHz
Timer (2) 8-Bit Timers
Enhanced Power on Reset Yes
Power Up Timer Yes
I/O Pins 6
Manufacturer Microchip
SPI Yes
I2C Yes
Watchdog Timer Yes
Brown out detect (BOD) Yes
Reset Yes
USI (Universal Serial Interface) Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
  • You must check these features before making a final decision to install and use this module for your relevant project.

2. ATtin85 Pinout and Description

Until now, you have got a hold of basic information and complete features of ATtiny85. In this section, we will discuss the pinout and pin description of the module.
Pinout
Following figure shows the pinout of ATtiny85.
  • The bottom pad available on the board must be soldered to the ground.
  • The DNC marked on the pinout stands for don't connect.
Pin Description
Following table shows the pin description that will help you understand the major functions associated with each pin.
Pin# Pin Name Pin Description
1 PB5 PCINT5 RESET ADC0 dW I/O Bidirectional pin Interrupt Reset Analog Channel 0 Define Word
2 PB3 PCINT3 XTAL1 CLKI OC1B ADC3 I/O Bidirectional pin Interrupt Crystal Oscillator Pin 1 Clock Analog Channel 3
3 PB4 PCINT4 XTAL2 CLKO OC1B ADC2   I/O Bidirectional pin Interrupt Crystal Oscillator Pin 2 Clock Analog Channel 2  
5 PB0 MOSI DI SDA AIN0 OC0A OC1A AREF PCINT0 I/O Bidirectional pin SPI Serial Data (I2C) Analog Input Compare Register Voltage Reference Interrupt  
6 PB1 MISO DO AIN1 OC0B OC1A PCINT1 I/O Bidirectional pin SPI Serial Data (I2C) Analog Input Compare Register Interrupt
7 PB2 SCK USCK SCL ADC1 T0 PCINT2 I/O Bidirectional pin Serial Clock Line (I2C) Analog Channel 1 Timer 0 Interrupt
4 GND Ground Pin
8 Vcc Voltage Supply Pin

3. ATtiny85 Main Functions

ATtiny85 can perform a number of functions on a single chip. Some pins come with an ability to employ more than one functions. Following are the main functions of this module.
Timers
There are two timers included on the chip that help in generating a delay in the running process of certain function when they work in a timer mode. In the counter mode, these timers are used to count the number of the interval on a specific function inside in the controller. The timer mode increments the instruction cycle while the counter mode is used to increment the rising and falling edge of the pin.
SPI Communication
ATtiny85 comes with a serial peripheral interface (SPI) that is mainly used for communication between the microcontroller and other peripheral devices such as SD cards, sensors, and shift registers. It incorporates separate clock and data lines with the addition of a select line to pick the required device for communication. This communication allows both connected device to lay out the same path of communication under one communication protocol.
I2C Communication
I2C protocol is added in the device that is mainly two-wire protocol used to connect low-speed devices like ADC and DAC converters, I/O interfaces and microcontrollers. The two wires, known as Serial Clock (SCL) and Serial Data (SDA), are the main part of this communication protocol. The SCL line behaves like a clock signal that is generated by the master device and synchronizes the data transfer between the devices. While the SDA line is used to carry the required data.
Brown Out Reset (BOD)
The BOD is a very useful function that helps in resetting the controller once the Vdd (voltage supply) drops below a brownout threshold voltage. The multiple voltage ranges are provided to secure the module once the power drops at the voltage supply line.
 Interrupt
The interrupt plays a vital role in an emergency which puts the main function on hold and executes the required instructions that are necessary at that time. Once the interrupt is executed the running code puts the controller back to the main program.
ADC Converter
ADC module is a valuable addition in the device that makes it compatible with the sensors. It is a 10-bit module that contains 4 channels which are little less than the number of channels available on the modules introduced by Microchip that, more or less, come with 7 or 12 channels.

4. ATtiny85 Memory Interface

The memory of this little toy is designed and based on Atmel's high-density technology that is basically non-volatile in nature. The Program Memory can be reprogrammed through SPI serial interface using two ways i.e. On-chip boot code or non-volatile memory programmer. The main program execution is mainly done inside CPU that plays a vital role to access memories and perform calculations on the basis of the number of instructions incorporated into the controller. This module falls under the category of AVR controllers that are based on Harvard architecture and come with separate locations reserved for both program and data memory.
Program Memory (ROM)
Program memory, that is basically reprogrammable flash memory, works in a simple manner where next instruction stands in the queue once first is called and executed. This helps in executing the instructions with regular intervals in every clock cycle. The Flash memory comes with 8k memory space and contains memory endurance around 10,000 write/erase cycle (means you can erase and write the instructions 10,000 times on this board). The program counter available on the flash memory is 12bits wide that can address 4096 program memory locations.
Data Memory (RAM)
The data memory comes with 512bytes memory space and reserves the memory locations three ways i.e. first 32 locations access the file register, next 64 locations are reserved for standard I/O memory and remaining are used for internal data SRAM. The data memory is categorized into five addressing modes named as
  • Direct,
  • Indirect
  • Indirect with Displacement
  • Indirect with Pre-decrement
  • Indirect with Post-increment
In the Register File, the registers ranging from R26 to R31 refer to the pointer registers with indirect addressing. While the direct addressing covers the entire data space. Similarly, the Indirect with Displacement mode covers 63 address locations using base address accessed by the Y- or Z register. The address registers X, Y, and Z increment and decrement with regular intervals when indirect addressing modes are layered with both post-increment and pre-decrement.
EEPROM Data Memory
This memory comes with 512 bytes of memory space which is designed and laid out as a separate data space where single bytes can be accessed. It comes with a memory endurance around 100,000 write/erase cycles which is ten times more than program memory.

5. ATtiny85 Compilers

There are many compilers available for compiling the code in the AVR microcontroller. Some are better than others. Before you pick some compiler for your controller, make sure it is easy to use and stand fit for your needs and requirements.
  • If you are in the learning phase, then IAR is the best compiler for AVR. It is highly professional, though expensive, what it lacks in economical price, it covers up by providing both flawless quality and ease of use where it can support most, if not all, of the MCU families.
Another compiler for AVR is the GCC Port for AVR that is available FREE for both Windows and Linux. It can compile the instructions with a decent pace, however, if you are a newbie and getting your hands on very first time with the controller, it might be hard to learn.
  • ImageCraft is good option to start with that has made a decent place in the market but lack of GUI features make this compiler difficult to handle where editor and project management are quite daunting and can put you in a total stall in the start.
CodeVision is another easiest compiler that comes with CodeWizard and helps in starting a new project sooner than later. Also, it is highly economical.

6. ATtiny85 Block Diagram

Block diagram is very helpful to visualize the main function available inside the controllers and how each feature and component are connected with each other. Following figure shows the block diagram of ATtiny85.
  • The AVR core is used to combine 32 general purpose register with the rich instruction set.
  • Also, these 32 registers are directly connected with the ALU (Arithmetic Logic Unit) which helps in accessing the two independent registers using single instruction.

7. Interfacing ATtiny85 with Arduino

Tiny things can work wonders if used a proper way. Both ATtiny85 and Arduino, when connected, can easily drive automation in your project and help in executing the number of instructions. You can connect ATtiny85 with the Arduino following way.
  • Arduino Pin 10 ...................... ATtiny85 Pin 1
  • Arduino Pin 11 ...................... ATtiny85 Pin 5
  • Arduino Pin 12 ...................... ATtiny85 Pin 6
  • Arduino Pin 13 ...................... ATtiny85 Pin 7
  • Arduino +5V...................... ATtiny85 Pin 8
  • Arduino Ground ...................... ATtiny85 Pin 4

8. Applications

  • It is mainly used in real time applications related to industrial automation.
  • Embedded Systems Projects make use of this module to drive automation.
  • It can be employed and incorporated in robotics.
  • Aeronautical technology houses a wide range of AVR controllers covering Quad-copter and space Aeroplanes.
  • Power monitoring and management systems use this module.
That's all for today. I hope you have found this piece of nugget useful and valuable as per your technical needs and demands. If you are unsure or have any question, you can ask me in the comment section below. I'd love to help you according to the best of my knowledge and skills. Feel free to keep us updated with your valuable feedback and suggestions, so we keep providing quality work and you keep coming back for what we have to offer. Thanks for reading the article.

Introduction to PIC12F683

Hey Fellas! Hope you are doing well. Today, I'll uncover the details on the Introduction to PIC12F683. It is an 8-bit PIC microcontroller that contains eight pins and is mainly used for real-time applications related to automation and embedded system. If you are a newbie or an expert, you need PIC controllers every now and then for the development of electronic projects. These controllers help you drive automation in your projects with the ability to perform a number of functions on a single chip. In this tutorial, I'll discuss each and everything related to PIC12F683 so you don't have to grapple your mind surfing the whole internet and find all information in one place. Let's dive in and break down everything you need to know.

Introduction to PIC12F683

  • PIC12F683 is an 8-bit PIC microcontroller that comes with 8-pin interface. It falls under the category of CMOS controllers and comes with nanoWatt technology.
  • The architecture is based on Flash but controller lacks some functions like USART, SPI, and I2C module, however, features like In-Circuit Serial Programming, Watchdog timer, and Oscillator start-up timer make this device an ideal choice for some real-time applications.
  • Memory space is less than other 40-pin controllers in the PIC community but is enough to configure automatic functions in the electronic projects.
  • Program memory comes with 3.5KB memory space, and RAM and EEPROM memories are 128bytes and 256 bytes respectively.
  • Though this module lacks some major functions, we can't wipe off its value in terms of converting analog signals to digitals ones. This device comes with 10-bit ADC converter that is a remarkable addition in a tiny device like this and is very helpful for sensor interfacing.
  • Power-up timer, Master Clear Reset, and Sleep Mode are some useful features that work both ways i.e. taking the device out of the infinite loop by restarting it and saving power where power management is a major concern.
  • With that being said, if your project requires more functions to be carried out on a single chip with more pins and memory interface, it is preferred to use PIC18F4520.

PIC12F683 Features

Features of any device are very important to get the main idea about the device before installing it in the relevant project. Following table shows the complete features of PIC12F683.
PIC12F683 Features
No. of Pins 8
CPU RISC 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 3.5K
Program Memory Type Flash
RAM 128 Bytes
EEPROM 256 Bytes
ADC Number of ADC Channels 10-Bit 4
Comparator 1
In-circuit serial programming Yes
Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
Oscillator Start-up Timer Yes
Power Up Timer Yes
I/O Pins 6
Manufacturer Microchip
SPI No
I2C No
Watchdog Timer Yes
Brown out Reset (BOR) Yes
Master Clear Reset Yes
Interrupt-on-Pin Change Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
 

PIC12F683 Pinout and Description

You have got a complete overview of the features of this module. In this section, we cover pinout and pin description of the chip.
Pinout
The following figure shows the pinout of PIC12F683.
  • This PIC module comes in three packages named PDIP, DFN and DFN-S and all three packages contain 8-pin on each module.
Pin Description
Following table shows the pin description of each pin that highlights the major functions associated with each pin.
Pin# Pin Name Pin Description
7 GP0 AN0 CIN+ ICSPDAT I/O Bidirectional pin Analog pin channel 0 Comparator In-Circuit Serial Programming
6 GP1 AN1 CIN- VREF ICSPCLK I/O Bidirectional pin Analog pin channel 1 Comparator External Voltage Reference In-Circuit Serial Programming Clock
5 GP2 AN2 T0CKI INT COUT I/O Bidirectional pin Analog pin channel 2 Timer Interrupt Comparator
4 GP3 MCLR VPP I/O Bidirectional pin Master Clear Reset Programming Voltage Input
3 GP4 AN3 T1G OSC2 CLKOUT I/O Bidirectional pin Analog pin channel 3 Timer Oscillator Output Comparator
2 GP5 T1CKI OSC1 CLKIN I/O Bidirectional pin Timer Oscillator Input RC oscillator connection
1 VDD Voltage Supply Pin
8 VSS Ground Pin

3. PIC12F683 Main Functions

As I already mentioned, this PIC module is not like some other fancy modules in the market, but some common functions make this device suitable for electronic projects. Let's discuss some major functions of this device.
Timers
There are three timers incorporated in the device where two are 8-bit and one is 16-bit timer. All these timers work both ways i.e. timer as well as the counter. Timer mode is used to create a delay in the execution of relevant functions and increments the instruction cycle. While the counter mode is used to count the number of intervals in the specific functions and increments the rising and falling edge of the pin. There are some other timers that are separated from mentioned timers and work in the same way to create a delay in the running function of the controller. These timers include
  • Oscillator Start-up Timer
  • Power-up Timer
The former is used to create the delay in the oscillator mode until the crystal oscillator becomes stable, while later is used to create the delay of 72ms once the device is powered on. This will give enough time and stabilize the power supply to provide power signals at regular intervals.
Watchdog Timer
The watchdog timer is a remarkable addition in the device that resets the device and puts it in a stable condition if running program hangs up or gets stuck in an infinite loop. When you are playing with the electronic device, it is very difficult to handle and reset the device manually, this is where watchdog timer comes handy and prevents the device from any malfunctioning.
Sleep Mode
Power saving sleep mode is very helpful for saving power that generates a low current power down mode. The sleep mode can be removed using an interrupt, external reset or watchdog timer.
In-Circuit Serial Programming
In-Circuit Serial Programming is another valuable feature added to the device that gives the option to program the controller after its installation in the relevant project, setting you free from separately testing the compiled program every time.
ADC Converter
What this module lacks in terms of USART, SPI, and I2C communications, it covers up for incorporating remarkable ADC converter into the device which makes it an ideal choice for sensor interfacing and for the applications that require analog to digital conversion. The ADC module is 10-bit and comes with 4-analog channels which are quite less than channels available in other controllers that normally contain 7 or 12 analog channels.
Master Clear Reset (MCLR)
The MCLR pin calls the external reset for the chip that is triggered by keeping this pin LOW. The noise filter is incorporated in the MCLR running process that detects and removes the small pulses. The MCLRE configuration bit is normally used to disable MCLR input.

4. PIC Compiler and Burner

  • Both, PIC compiler and burner are different things. Former is used to write the required program for the controller while later is used to transfer and burn the written program to the controller.
  • MPLAB C18 Compiler is a standard compiler for PIC controllers that is introduced by Microchip. This compiler is readily available on the Microchip site.
  • Third-party software can also be used for compiling the program and you must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your technical requirements, however, MikroC Pro For PIC is a major replacement for standard PIC compiler.
  • It is important to note that the code we write on the compiler generates the hex which is then moved to the controller for carrying out required operation.
  • PICKit3 is a standard burner used for PIC controllers. There are other burners available in the market but PICKit3 is mostly used and preferred over other burners in terms of performance and efficiency.

PIC12F683 Memory Layout and Working

Memory, as the word defines, is used to store a number of instructions in the form of code. Memory is mainly divided into two major types Program Memory  Data Memory The former is used to store the instructions permanently and, more often than not, is known as ROM or Non-Volatile memory. This memory is not dependent on the power supply and comes with an ability to store the information in the absence of power supply.
  • Program memory comes with a memory space around 3.5K and contains 13-bit program counter that can address 8k x 14 memory space where reset vector lies at 0000h and interrupt vector stays at 0004h.
EEPROM also falls under Program memory and comes with 256 bytes of memory space and is similar to ROM in one way or the other where it stores information permanently but comes with one exception i.e. the EEPROM instructions can be controlled and modified during the controller operation. The data memory is known as RAM or volatile memory and stores information temporarily i.e. it depends on the power supply and all stored information is gone with the removal of a power supply.
  • Registers are the data holding places in the controller and can hold storage address, instruction and any kind of data ranging bit sequence or individual characters.
The data memory, implemented as static RAM, is divided into two banks which further contain two types of registers called General Purpose Registers Special Function Registers General purpose registers store any modified or random value in the processor, and are accessed by File Select Register. While Special function registers mainly control the peripheral functions and cover first 32 locations of each bank.
  • General Purpose Registers reserve 20h-7Fh in Bank 0 and A0h-BFh in Bank 1 and are implemented as static RAM while remaining RAM remains unimplemented and returns zero when read.
W Register. The W register falls under GPRs and is accessible by a program. It is important to note that, this register doesn’t take part in any register bank where required values must be written on it and moved to the target register before defining them for available pins.

6. PIC12F683 Block Diagram

Until now, you have got a clear idea about main features, pinout, pin description, and compiler used for this PIC module. In this section, we will discuss the block diagram of this tiny chip. Following figure shows the block diagram of PIC12F683. There is no PORT marked on this module, instead, pins are labeled as GP0 to GP5 where VDD and VSS are voltage supply and ground pins respectively. This PIC version falls under the category of Microchip's Low Pin Count Patent.

7. PIC12F683 Projects and Applications

  • Used in Industrial automation
  • Embedded and control systems
  • Sensor interfacing and motor control
  • Widely used in student projects for driving automation

8. Why Choose PIC Microcontrollers

PIC modules take the whole automation industry by storm with the ability to perform a number of functions on a single tiny chip. These modules stay ahead of other processors in terms of efficiency and the pace with which they can perform and execute a number of instructions. Everything is added in the small onboard chip including timers, counters, in-circuit serial programming, ADC converter and the main features required to embed automation in the electronic projects. You name it, they have it. If you intend to develop any project, the economic price is a major concern. These chips are highly economical and are readily available in the market. Compact and concise circuitry added on the boards make these devices lightweight which cover less space and prevent you from spending loads of money for buying external components. That’s all for today. I hope I have given you everything you needed to know about PIC12F683. If you are unsure or have any question, you can approach me in the comment section below. I’ll try my best to help you according to the best of my expertise. Keep us updated with your valuable feedback and suggestions, as they help us provide quality content as per your needs and demands. Thanks for reading the article.

Introduction to PIC12F675

Hey Guys! Hope you are doing well. I am back with one more piece of nugget with valuable information. Today, I'll unlock the details on the Introduction to PIC12F675.  It is an 8-bit CMOS PIC microcontroller, developed by Microchip and is based on FLASH. It comes with an 8-pin interface which is quite less than regular PIC controllers used in electronic projects that mostly come in a 20-pin or 40-pin interface and encompass more memory space with the ability to perform a number of functions on a single tiny chip.

In this post, I'll cover each and everything related to this controller including its main features, pinout, pin description, block diagram, and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC12F675

  • PIC12F675 is an 8-pin and 8-bit PIC microcontroller, developed by Microchip with the intention of developing automation and embedded projects.
  • Though it comes with a high-performance RISC CPU with interrupt capability, it is not like some other fancy controllers in the PIC community as it lacks a USART module and memory space is quite less as compared to other controllers.
  • SPI and I2C communications are not available on the board, but some features like watchdog timer, power-on reset, power on sleep mode and brownout detect (BOD) make this device an ideal choice for some electronic applications.
  • Program memory is 1.7KB, enough to store a number of instructions for driving automation, while RAM and EEPROM are 64 and 128 bytes respectively.
  • Additionally, the ADC module is added to the device which converts analog signals to digital ones and is mainly used for sensor interfacing and comes with only 4 operating channels.
  • Two timers are available onboard where one is an 8-bit timer while the other is a 16-bit timer.
  • Only one comparator is incorporated in the module that is mainly used to compare between the two signals where comparator output is externally accessible.
  • The 8-bit interface makes it fall under the category of Microchip's Low Pin Count Patent.
  • Other valuable functions include ICSP (in-circuit serial programming), programmable code protection, interrupt-on-pin change, power-up timer, Master clear reset and wide industrial and extended temperature range.

PIC12F675 Features

  • There are many valuable features added to the device that make it unique in terms of ease of use and innovation.
  • The following table shows the full features of PIC12F675:
PIC12F675 Features
No. of Pins 8
CPU RISC 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 1.7K
Program Memory Type Flash
RAM 64 Bytes
EEPROM 128 Bytes
ADC Number of ADC Channels 10-Bit 4
Comparator 1
In-circuit serial programming Yes
Oscillator up to 20 MHz
Timer (2) 16-Bit Timer (1) 8-Bit Timer (1)
Oscillator Start-up Timer Yes
Power Up Timer Yes
I/O Pins 6
Manufacturer Microchip
SPI No
I2C No
Watchdog Timer Yes
Brown out detect (BOD) Yes
Master Clear Reset Yes
Interrupt-on-pin Change Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C

PIC12F675 Pinout and Description

You have got a hold of the main features of PIC12F675. In this section, we cover the pinout and description of each pin.

PIC12F675 Pinout

  • The following figure shows the pinout of PIC12F675:
  • The VDD and VSS are voltage supply and ground pins respectively. Pin 4 is a master clear reset pin used to reset the controller.
  • While pin 2 & 3 are connected to a crystal oscillator that creates clock pulses in the controller.

Pin Description

  • The following table shows the table of pin description of each pin of PIC12F675, so you can get a hold of the main functions associated with each pin.
Pin# Pin Name Pin Description
7 GP0 AN0 CIN+ ICSPDAT I/O Bidirectional pin Analog pin channel 0 Comparator In-Circuit Serial Programming
6 GP1 AN1 CIN- VREF ICSPCLK I/O Bidirectional pin Analog pin channel 1 Comparator External Voltage Reference In-Circuit Serial Programming Clock
5 GP2 AN2 T0CKI INT COUT I/O Bidirectional pin Analog pin channel 2 Timer Interrupt Comparator
4 GP3 MCLR VPP I/O Bidirectional pin Master Clear Reset Programming Voltage Input
3 GP4 AN3 T1G OSC2 CLKOUT I/O Bidirectional pin Analog pin channel 3 Timer Oscillator Output Comparator
2 GP5 T1CKI OSC1 CLKIN I/O Bidirectional pin Timer Oscillator Input RC oscillator connection
1 VDD Voltage Supply Pin
8 VSS Ground Pin

PIC12F675 Functions

  • This PIC model can perform many functions, if not all, similar to other controllers in the PIC community.
  • Following are the main functions of PIC12F675.

Timer

  • PIC12F675 comes with two timers where one is 16-bit and the other is an 8-bit timer.
  • Both can be used as a timer as well as a counter.
  • The timer mode is used to create the delay in any running function that increments the instruction cycle while the counter mode counts the number of intervals in any function and is used to increment the rising and falling edge of the pin.
    • Oscillator Start-up Timers
    • Power Up Timer

The oscillator start-up timer is a very valuable feature that keeps the module in the reset mode until the crystal oscillator becomes stable. Similarly, a power-up timer is added that generates a delay of 72ms when you power on the device, which gives a proper time to the power supply to stabilize and provide power signals in a continuous manner.

Brown Out Detect (BOD)

  • The BOD, also known as BOR (Brown Out Reset), is a very useful function that resets the module once the Vdd (voltage supply) drops below a brownout threshold voltage.
  • Sometimes it is very difficult to manually reset the controller if there comes a malfunctioning in the controller, this is where BOD comes into play.
  • In this mode, multiple voltage ranges are provided to protect the module once the power drops at the voltage supply line.

It is important to note, the Power Up Timer should be enabled, in order to generate the delay in returning the device from a BOD function. BOD comes with four operating modes that can be programmed by setting or clearing BOREN bits.

  • BOD always on
  • BOD is controlled by software
  • BOD is off when in Sleep mode
  • BOD is always off

In-Circuit Serial Programming

Some devices can only be programmed before their installation in the project. This PIC model is an exception that comes with In-circuit serial programming (ICSP), also known as In-system programming (ISP), that helps in programming the module after its installation in the particular project. If you program the module before installation, you need to check and test the program every time its installation in the project.

In-Circuit Serial Programming gives you the flexibility to check the compiled program in the project so you can easily make the required changes and makes it compatible with the running application. 

Master Clear Reset (MCLR)

  • The MCLR, which is pin 4 in this module, calls the external reset for the chip.
  • The reset is configured by keeping this pin LOW that is not dependent on the internal resets.
  • The noise filters are present in the MCLR executing process and are very useful to remove and detect small pulses.

Watchdog Timer

  • PIC12F675 comes with a built-in watchdog timer that takes the controller in a reset position if the program hangs up during compilation or gets stuck in the infinite loop.
  • The watchdog timer is nothing but a countdown timer.

PIC Compiler

  • Microchip has created its own standard compiler that is mainly used for the PIC controller called MPLAB C18 Compiler. This compiler is available on the microchip site.
  • These Top 3 PIC C Compilers give the flexibility to choose from and pick any compiler as per your requirements, however, MikroC Pro For PIC is a third-party software mainly used as a replacement of Microchip standard compiler.
  • The code we write in the compiler generates a hex file which is then uploaded to the microcontroller to execute the number of instructions.
  • Burner and Compiler are two different things where Burner is used to burning the required program in the controller and compiler is used to write the program for the controller. The PICKit3 is a standard burner used for the PIC controller.
  • There are other burners available in the market but PICKit3 is mostly used and stays ahead of other burners in terms of efficiency and performance.

PIC12F675 Memory Layout

A memory of the controller is very helpful to store the number of instructions in the form of code. The memory is mainly divided into two types

  • 1. Program Memory 
  • 2. Data Memory

Program Memory

  • The program memory is also known as the ROM of the controller that stores the information permanently and contains memory space around 1.7K.
  • This memory doesn't depend on the power supply source and comes with the ability to retain information in the absence of a power supply.
  • It contains a 13-bit program counter that can address 8k x 14 program space where the interrupt vector lies at 0004h while the reset vector stays at 000h and is loaded by the controller.
  • The first memory space 1k x 14 rangings (0000h – 03FFh) is physically implemented.

Data Memory

  • The data memory, also known as RAM, stores the information temporarily and more often than not is called volatile memory.
  • It is widely dependent on the power supply and can not store information in the absence of the power supply.
  • The data memory is categorized into two banks that further contain two types of registers called:
  1. Special Function Registers
  2. General Purpose Registers

The first 32 locations of each bank are allocated for special function registers that can handle and control the peripheral functions and are classified as “Core and Peripheral”. While general-purpose registers are implemented as static RAM and lie at 20h-5Fh and are mapped across both banks.

PIC12F675 Block Diagram

  • Block diagram gives you an overview of different functions and components of the device i.e. how they are used and connected with each other.
  • The following figure shows the block diagram of PIC12F675.
  • PIC12F675 is an 8-bit controller that comes in PDIP, SOIC and MLF-S packages, however, PDIP is mainly preferred and used for the development of individual projects.
  • The addition of a 10-bit ADC converter makes this device compatible with a number of sensors.

Why Use PIC Microcontroller

Availability of special functions on a single chip is what sets apart PIC controller from other processors. Some real-time applications related to embedded and control systems can only be performed using PIC controllers as they come with high efficiency and decent speed to execute a number of instructions.

These controllers are cheap and remove the need for external components as they can perform a number of operations on a single chip. Power saving modes are added to the device that makes them an ideal choice for applications where power limitation is a major concern.

Maximum code protection is incorporated into the device that saves the device from influencing the code with external parameters, giving full code protection without a minor change in the compiled code.

The watchdog timer is a remarkable feature added in most of the devices that save the module from going into the infinite loop that may hang up the device and puts the device in a total stall.

Needless to say, PIC controllers play a vital role in driving automation in real-time applications using minimum circuitry that covers less space and turns out to be lightweight.

PIC12F675 Projects and Applications

  • Mainly used in student projects
  • Automation and Embedded Systems
  • Motor Controlling and Interfacing with Sensors
  • Security Systems
  • Industrial Automation
  • Medical Equipment

That's all for today. I have tried my best to give you everything related to PIC12F65. However, if you are feeling skeptical or have any questions, you can ask me in the comment section below, I'd love to help you according to the best of my expertise. You are most welcome to keep us updated with your feedback and suggestions so we always come with the relevant content as per your needs and demands. Thanks for reading the article.

Introduction to PIC16F690

Hi Guys! Hope you are doing well. We are here to keep you updated with valuable information related to engineering and technology. Today, I will unlock the details on the Introduction to PIC16F690. It is a 20-pin Flash-based PIC microcontroller that comes with high-performance RISC CPU and mainly used in automation and embedded systems. If high processing speed and memory space is anything to go by, this PIC module has already made a renowned place in the market where it can handle electronic projects pretty well. If you are a newbie or an expert, you can start working on the PIC module with little or no prior knowledge. In this post, I'll cover everything related to PIC16F690, its pinout, pin description, main features, block diagram, memory layout, and applications. Let's dive in and explore everything you need to know.

Introduction to PIC16F690

  • PIC16F690 is an 8-bit PIC microcontroller, developed by Microchip, that comes with 20-pin interface.
  • High-performance RISC CPU is incorporated on the board that helps in executing the instructions with a decent pace.
  • Crystal oscillator up to 20 MHz can be interfaced with the board that creates the clock pulses.
  • Operating voltage is identical to other controllers in the PIC community and ranges from 2 to 5.5 V. Program memory and RAM memory is 7K and 256 bytes respectively. EEPROM also comes with memory space around 256 bytes.
  • Other features that make this device compatible with a wide number of external components include I2C, SPI, and USART communications.
  • ADC module is very useful to convert analog values to digital ones and play a vital role for sensor interfacing.
  • PIC16F690 comes with two different packages called PDIP and QFP where both contain 20-pins onboard.

PIC16F690 Pinout and Description

You have got a brief overview of this controller. In this section, we uncover the pinout and pin details, so you get a clear idea about the function of each pin.
Pinout
Following figure shows the pinout of PIC16F690.
  • Both PIC packages are very helpful for project development where PDIP is mainly used for individual projects and QFN is incorporated in the industrial electronic devices.
Pin Description
Following figure shows the complete pin description of each pin that will highlight the main functions each pin capable of doing.
Pin# Pin Name Pin Description
19 RA0 AN0/ULPWU C1IN+ IOC ICSPDAT Digital I/O Pin Analog Channel 0 Comparator Interrupt Basic
RA1 AN1/VREF+ C12IN0- IOC ICSPCLK Digital I/O Pin Analog Channel 1 Comparator Interrupt Basic
RA2 AN2 C1OUT T0CKI IOC Digital I/O Pin Analog Channel 2 Comparator Timer Interrupt
4 RA3 IOC MCLR VPP Digital I/O Pin Interrupt Master Clear Reset Programming Voltage Input
3 RA4 AN3 T1G IOC OSC2/CLKOUT Digital I/O Pin Analog Channel 3 Timer Interrupt Oscillator Output
2 RA5 T1CKI IOC OSC1/CLKIN Digital I/O Pin Timer Interrupt Oscillator Input
13 RB4 AN10 SDI/SDA IOC Digital I/O Pin Analog Channel 10 SSP Interrupt
12 RB5 AN11 RX/DT IOC Digital I/O Pin Analog Channel 11 Serial Receive Pin Interrupt
11 RB6 SCL/SCK IOC Digital I/O Pin SSP Interrupt
10 RB7 TX/CK IOC Digital I/O Pin Serial Transmit Pin Interrupt
16 RC0 AN4 C2IN+ Digital I/O Pin Analog Channel 4 Comparator
15 RC1 AN5 C12IN1- Digital I/O Pin Analog Channel 5 Comparator
14 RC2 AN6 C12IN2- P1D Digital I/O Pin Analog Channel 6 Comparator ECCP
7 RC3 AN7 C12IN3- P1C Digital I/O Pin Analog Channel 7 Comparator ECCP
6 RC4 C2OUT P1B Digital I/O Pin Comparator ECCP
5 RC5 CCP1 P1A Digital I/O Pin ECCP
8 RC6 AN8 Digital I/O Pin Analog Channel 8
9   RC7 AN9 Digital I/O Pin Analog Channel 9
1 VDD Voltage Supply Pin
20 VSS Ground Pin

2. PIC16F690 Features

In this section, we discuss the main features of PIC16F690 so you get a hold of this chip before you make a final decision to install it in the relevant project. Following table shows the complete features of PIC16F690.
PIC16F690 Features
No. of Pins 20
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
No. of I/O Pins 18
Program Memory 7K
RAM 256 Bytes
EEPROM 256 Bytes
10-Bit ADC 12 Channels
Oscillator up to 20 MHz
Timer (3) 8-Bit Timer (2) 16-Bit Timer (1)
USART Protocol 1
I2C Protocol Yes
SPI Protocol  Yes
Comparators 2
Watchdog Timer Yes
Power-on Reset Yes
Brown Out Reset Yes
Master Clear Reset Yes
Power up Timer Yes
Selectable Oscillator Option Yes
Maximum Current Drawn Each Pin 25mA
Data Retention Capability 40 Years
Power Saving Sleep Mode Yes

3. PIC16F690 Functions

This PIC comes with an ability to perform a number of valuable functions like other controllers in the PIC community. Following are the main functions of PIC16F690.
Timer
Timers are very useful for creating a delay in the running function. PIC16F690 comes with three timers where two are 8-bit and one is 16-bit timer that can be configured both ways i.e. timer and counter. The former is used to create delay and increments the instruction cycle while later is used to count the number of intervals in specific running function and increments the rising and falling edge of the pin.
USART Module
PIC16F690 contains USART module that consists of two pins called TX and RX where former is a transmission pin used for transmitting serial data to other devices and later is a receive pin used for receiving serial data.
In-Circuit Serial Programming
In-Circuit Serial Programming is another valuable feature incorporated into the device that gives the flexibility to program the controller after its installation in the relevant project.
Watchdog Timer
PIC16F690 comes with built-in timer called watchdog timer that can be configured with programming. It is mainly used to reset the controller when the running program gets stuck in an infinite loop. This timer prevents the device from any malfunctioning and provides a preventive measure by resetting the device before it goes to any invalid software glitch. More often than not, watchdog timer acts like a countdown timer that starts from 1000 and gradually goes down to zero.
Sleep Mode
Power saving sleep mode is another valuable function added in the chip that generates a low current power down mode. The sleep mode can be abandoned using an interrupt, watchdog timer or external reset.

4. PIC Compilers

  • MPLAB C18 Compiler is a standard compiler, introduced by Microchip, that is mainly used for PIC controllers. You can download this compiler online from the Microchip Official Site.
  • Third-party software can also be used for compiling the program and MikroC Pro For PIC is available for this purpose.
  • You must check this list of Top 3 PIC C Compilers where you can pick any compiler based on your technical requirements.
  • The code we write in the compiler generates a hex file that is transferred to the PIC Microcontroller.
  • You need a burner to transfer the compiled program to the controller. PICKit3 is widely used for this purpose. There are other unofficial burners used for burning the code, however, PICKit3 is mostly preferred and used for PIC controllers.

5. PIC16F690 Memory Organization

Memory plays a vital role to store the number of instruction on the controller. It is mainly divided into three types called Program Memory EEPROM Memory RAM Memory Program memory comes with 13-bit program counter that can address 8k x 14 memory space where reset vector stays at 0000h and interrupt vector stays at 0004h. It has a total memory space around 7k and is known as ROM or non-volatile memory that stores the program permanently and doesn't depend on the voltage source.
  • EEPROM also stores information permanently but comes with one exception i.e. i.e. the instructions in EEPROM can be controlled and modified during the controller operation.
RAM memory stores the information temporarily and is known as a volatile memory or data memory that is mainly dependent on the power supply as it removes the stored information as the power supply is removed.
  • Registers play a vital role in the controller that are the data holding places and can hold storage address, instruction and any kind of data containing bit sequence or individual characters.
The data memory, implemented as static RAM, is divided into four banks and contain two types of registers called General Purpose Registers Special Function Registers General purpose registers store any modified or random value in the processor, and are organized as 8 x 256 in RAM and accessed by File Select Register. While Special function registers mainly control the peripheral functions and occupy the first 32 locations of each bank. W Register. This register belongs to GPRs and is accessible by a program. It doesn't take part in any register bank where desired values must be written on it and moved to the target register before defining them for available ports. STATUS. This register helps in switching between the banks.

6. PIC16F690 Block Diagram

Block diagram is very helpful to have a deeper look at how different pins and components operate and attach to each other. The following figure shows the block diagram of PIC16F690. This PIC module comes with three ports A, B and C and each one contains 6, 4 and 8 pins respectively.

7. PIC16F690 Projects and Applications

  • Students project for interfacing sensor and motor controlling
  • Central heating projects
  • For serial communication
  • Production of temperature data logger
  • Main part of the embedded system
  • Used in industrial automation
  • Used in security systems
  • Gas sensor projects
  • Starter Kits

8. Why Select PIC Microcontrollers

PIC controllers play a vital role in the development of many electronic projects that are directly or remotely related to automation. These controllers house a number of peripheral functions that prevent you from spending extra money to buy and connect external components for driving relevant operation. PIC controllers and burners are readily available and you can get support from Microchip site that not only helps you pick a right microcontroller but also helps in the development of your desired project. PIC controllers are highly economical, cover less space and turn out to be very lightweight that make your project a true manifestation of innovative ideas. That's all for today. I hope I have given you everything you needed to know about PIC16F690. If you are unsure or have any question, you can ask me in the comment section below. I'll try my best to resolve your queries. Keep us updated with your valuable feedback so we keep providing quality content as per your needs and demands. Thanks for reading the article.

Introduction to PIC16F676

Hi Friends! Hope you are doing well. Today, I'll cover the details on the Introduction to PIC16F676. It is an 8-bit CMOS PIC microcontroller, based on Flash and developed by Microchip. It comes in 14-pin interface with high-performance RISC CPU that makes it an ideal choice for most of the electronic applications that are widely related to embedded systems or industrial automation. This tiny chip incorporates everything you need to develop individual student projects. Memory space and a number of pins are little less as compared to other controllers in the PIC community, however, flash-based technology makes this device compatible with external devices. In this post, we'll discuss each and everything related to PIC16F676, its pinout and description, main features, block diagram, memory layout and applications. Let's dive right in and explore everything you need to know.

Introduction to PIC16F676

  • PIC16F676 is an 8-bit PIC microcontroller that comes with a 14-pin layout design. It is based on flash where high-performance CPU adds up the processing speed.
  • It comes in three packages called PDIP, SOIC, and TSSOP. All three versions are available in 14-pin configuration.
  • PIC16F676 contains program memory with memory space around 1.7 KB, while RAM and EEPROM memories are 64 bytes and 128 bytes respectively.
  • One ADC module is added in the device that is 10-bit and comes with 8 analog channels. This module plays a vital role for sensor interfacing and converting analog values to digital ones.
 
  • Power on Reset, Comparator, in-circuit serial programming, and master clear reset are some other features incorporated in the device that help it stay ahead of the other onboard chips and remove the need of buying external components for carrying out different operations.

1. PIC16F676 Pinout and Description

You have got a brief overview of this controller. In this section, we will cover both pinout and pin description of each pin. Let's start.
Pinout
The following figure shows the pinout of PIC16F676
Pin Description
Pin description will help you understand the main function associated with each pin. Following table shows the complete description of each pin.
Pin# Pin Name Pin Description
13 RA0 AN0 CIN+ ICSPDAT Digital I/O Pin Analog Channel 0 Comparator Input Programming Data
12 RA1 AN1 CIN- VREF ICSPCLK Digital I/O Pin Analog Channel 1 Comparator Input Voltage Reference Programmin Clock  
11 RA2 AN2 COUT T0CKI INT Digital I/O Pin Analog Channel 2 Comparator Output Clock Input for Timer0 Interrupt
4 RA3 MCLR VPP Digital I/O Pin Master Clear Reset Programming Voltage Input
3 RA4 T1G AN3 OSC2 CLKOUT   Digital I/O Pin Gate Timer1 Analog Channel 3 Crystal Oscillator Output. In RC mode, this pin has a 1/4 frequency of OSC1  
2 RA5 T1CKI OSC1 CLKIN Digital I/O Pin Clock Timer1 Crystal Oscillator Input External Clock Input
10 RC0 AN4 Digital I/O Pin Analog Channel 4
9 RC1 AN5 Digital I/O Pin Analog Channel 5
8 RC2 AN6 Digital I/O Pin Analog Channel 6
7 RC3 AN7 Digital I/O Pin Analog Channel 7
6 RC4 Digital I/O Pin
5 RC5 Digital I/O Pin
14 VSS Ground Pin
1 VDD Voltage Supply Pin

2. PIC16F676 Features

You have got a hold of pinout and description of each pin till now. In this section, we highlight and discuss the features of this controller that make it unique from its counterparts. The following figure shows the complete features of PIC16F676.
PIC16F676 Features
No. of Pins 14
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 1.7 K
Program Memory Type Flash
RAM 64 Bytes
EEPROM 128 Bytes
ADC Number of ADC Channels 10-Bit 8
I/O Ports (2) I/O Pins A, C 12
Power Saving Mode Yes
External Oscillator up to 20 MHz
Timer (2) 16-Bit Timer (1) 8-Bit Timer (1)
Manufacturer Microchip
Comparators 1
Individual Programmable Weak Pull-ups Yes
EEPROM Data Retention 40 Years
Watchdog Timer Yes
Power on Reset Yes
Master Clear Reset Yes
In-Circuit Serial Programming Yes
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
  These features will help you pick the desired controller and assist you in making a final decision based on your project requirement.

3. PIC16F676 Functions

There are a number of functions associated with this PIC module. Following are the main functions of PIC16F676.
Master Clear Reset (MCLR)
The MCLR is an external reset for the chip that is executed by keeping this pin LOW. This pin is not dependent on the internal resets which also house the noise filter to detect and remove the small pulses in the path.
Timer
PIC16F676 comes with two timers where one is an 8-bit timer and other is 16-bit timers. They can be employed both ways i.e. as a timer as well as a counter. Both timers come with a clock select capability. The timer mode is used to create a delay in any function while a counter is used to count the number of the internals of any function.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is added in the device that helps in programming the device after installation in a certain project. 
Watchdog Timer
The watchdog timer is a very useful function that resets the controller if the running program gets stuck in an infinite loop or software shows an invalid status. It is very difficult to reboot the entire system in case there comes glitch, these timers save you a bunch of time and bring the system back to its initial position without human interference.

4. PIC Compiler

  • A compiler is a software used where we write a program to execute desired functions on the microcontroller. Microchip comes with its own standard compiler called MPLAB C18 Compiler. You can get this compiler online from the Official Microchip Site.
  • These Top 3 PIC C Compilers give you many options to choose from based on your requirements, however, MikroC Pro For PIC is mainly used for this purpose.
  • The code we write in the compiler creates a hex file which is then moved to the microcontroller to call and execute the desired instructions.
  • Burners are used to burn and incorporate the certain program on the controller. There are many unofficial burners available in the market but PICKit3 stay ahead in terms of ease of use and quality performance.

5. PIC16F676 Memory Layout

The memory of this controller is mainly divided into two types called Program Memory Organization (ROM) Data Memory Organization (RAM) The program memory stores the program permanently and is also known as ROM or non-volatile memory. It comes with 13-bit program counter that can address 8k x 14 program memory space. The first memory space 1k x 14 covering (0000h - 03FFh) can be physically implemented. The address stored in the reset vector is loaded by the controller and stays at 000h while the interrupt vector stays at 0004h. The RAM memory, also known as Data or volatile memory, stores the program temporarily and depends on the source of power supply. It removes the stored program as the power supply turns off. The data memory is mainly divided into two banks that further house two types of registers called Special Function Registers General Purpose Registers The first 32 locations of each bank are reserved for special function registers which are mainly used for handling and controlling the peripheral functions and are classified as "Core and Peripheral". While general purpose registers stay at 20h-5Fh,  mapped across both banks and are implemented as static RAM. STATUS Register. This register is mainly used to switch between the banks and it contains
  • Reset status
  • Arithmetic status of the ALU
  • Bank select bits for data memory (SRAM)
W Register. The W register doesn't relate to any register bank and is addressed by the program only. It is a GPR while STATUS register falls under the category of SFR. TRISA. This register configures PORTA as an input or output. The value 0 indicates it as an input and value 0 shows output. TRISC. This register is similar to TRISA and configures the pins as an input or output for PORTC.

6. PIC16F676 Block Diagram

Block diagram is very helpful to uncover the main functions associated with each component on the controller and how these functions are related to each other. The following figure shows the block diagram of PIC16F676.
  • This PIC module comes with two ports called PORTA and PORTC and each port contains 6 pins. It lacks some features like USART and comes with less memory space.

7. PIC16F676 Projects and Applications

PIC microcontrollers are widely used in many electronic systems for driving automation. Following are the main application of this controller version.
  • Prototyping custom circuits
  • GPS and security systems
  • Central heating projects
  • Student projects for sensor interfacing and motor controlling
  • Used in home and industrial automation
  • Embedded system

8. Why Use PIC MicroControllers

  • PIC controllers are very helpful for carrying out automation in many electronic devices and provide easy to configure and user-friendly interface.
  • A number of functions can be done on a single chip without buying external components, that make your project highly economical, and lightweight that covers less space.
  • Some chips have a builtin ADC module that makes them an ideal choice for the projects requiring digital output as a final result.
  • All the burners and PIC compilers are easily available that help you ease the learning process.
That's all for today. I hope you have found this article useful. If you have any question, you can approach me in the comment section below, I'd to help you in any way I can. Keep us updated with your valuable feedback and suggestion that help us provide you quality content as per your needs and requirements. Thanks for reading the article.

Introduction to PIC16F88

Hi, Hope you are doing well. I am back to give you a daily dose of useful information. Today, I'll uncover the details on the Introduction to PIC16F88. It is an 8-bit PIC microcontroller, introduced by Microchip, mainly used in automation and embedded applications. It comes with an enhanced flash processor and nanoWatt technology, helping it to consume minimum power with the ability to perform a number of functions on a single tiny chip. An ADC 10-bit module is added in the device that makes it compatible with other devices and accepts analog signal and converts it to a digital one. This microcontroller module houses little less memory space as compared to other controllers in the PIC community and comes with an 18-pin layout (PDIP). Though other modules with more number of pins are also available, PDIP is mostly used for developing individual student projects. In this tutorial, I'll cover each and everything related to PIC16F88, its pinout, features, block diagram, and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC16F88

  • PIC16F88 is an 8-bit PIC microcontroller that comes with the enhanced flash processor and nanoWatt technology. It is available in three different packages named PDIP, SSOP, and QFN. First one comes with an 18-pin layout  (mostly used) while other two comes in 20 and 28 pin packages respectively.
  • The program memory size is 7KB that is used to store the number of instruction on a single chip. While the RAM is 368 bytes and EEPROM comes with memory space around 256 bytes.
  • The 10-bit ADC is incorporated on the board that is mainly used to convert the analog signal into a digital one. It plays a vital role to interface sensors, where it gets their signal values in the analog form and convert them to digital ones.
  • The crystal oscillator up to maximum value of 20MHz can be interfaced with the chip that is mainly used to generate the clock pulses for the synchronization of the internal operations.
  • In terms of carrying out and driving functions that are directly or remotely related to automation, we can not brush off the importance of this module.

1. PIC16F88 Pinout and Description

The pinout of any module is very useful to implicate the layout of the module while pin description gives you an overview of what each pin is capable of doing. Let's discuss pinout and pin description one by one.
Pinout
The following figure shows the pinout of PIC16F88.
  • The PDIP module comes with 18-pin interface while other two SSOP and QFN consist of 20 and 28 pins respectively.
  • The former is used for developing individual projects while the other two are used and added in industrial electronic devices.
Pin Description
Following table shows the pin description of each pin and the main function associated with each pin.
Pin# Pin Name Pin Description
17 RA0 AN0 I/O Bidirectional pin Analog pin channel 0
18 RA1 AN1 I/O Bidirectional pin Analog pin channel 1
1 RA2 AN2 CVREF VREF- I/O Bidirectional pin Analog pin channel 2 Comparator Output (VREF) A/D reference voltage input (Low)
2 RA3 AN3 VREF+ C1OUT I/O Bidirectional pin Analog pin channel 3 A/D reference voltage input (High) Comparator 1 Output
3 RA4 AN4 T0CKI C2OUT   I/O Bidirectional pin Analog pin channel 4 Used for clock input to the timer0 Comparator 2 Output
4 RA5 MCLR VPP I/O Bidirectional pin This is a master clear low reset pin Programming voltage input
15 RA6 OSC2 CLKOUT I/O Bidirectional pin This pin is connected to a crystal oscillator and acts as a crystal oscillator output pin. In RC mode, this pin has a 1/4 frequency of OSC1
16 RA7 OSC1 CLKIIN I/O Bidirectional pin This pin is connected to a crystal oscillator and acts as a crystal oscillator input pin External Clock Source Input
6 RB0 INT CCP1 I/O Bidirectional pin External interrupt pin Output for PWM and Compare and Input for Capture
7 RB1 SDI SDA All PORTB Pins are software programmed I/O Bidirectional pin SPI data in I2C data
8 RB2 SDO RX DT I/O Bidirectional pin SPI data out Receiver Pin Synchronous detect
9 RB3 PGM CCP1 I/O Bidirectional pin Programming enable pin for Low-Voltage ICSP™ PWM Output for Compare and PWM, while Input Capture
10 RB4 SCK SCL I/O Bidirectional (Interrupt-on-change) pin SPI Synchronous serial clock input/output I2C Synchronous serial clock Input
11 RB5 SS TX CK I/O Bidirectional (Interrupt-on-change) pin SPI Slave select Serial transmit pin Synchronous clock
12 RB6 AN5 PGC T1OSO T1CKI I/O Bidirectional (Interrupt-on-change) pin Analog pin channel 5 In-Circuit Debugger and programming clock pin. Oscillator output for Timer1 External clock input for Timer1
13 RB7 AN6 PGD T1OSI I/O Bidirectional (Interrupt-on-change) pin Analog pin channel 6 ICSP programming data and In-Circuit Debugger pin Oscillator input for Timer1
5 Vss Ground Pin
14 Vdd Voltage Supply Pin

2. PIC16F88 Features

Features of any device play an important role in order for you to decide and pick the most relevant PIC module for your project. These features differ for different modules available in the market. Before you start working on the project, make sure the features of the device are compatible and resonate with your project requirements and the nature of the final output. Following table shows the complete feature of PIC16F88.
PIC16F88 Features
No. of Pins 18 (PDIP)
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 7K
Program Memory Type Flash
RAM 368 Bytes
EEPROM 256 Bytes
ADC Number of ADC Channels 10-Bit 7
I/O Ports (2) I/O Pins A, B 16
Packages 18-pin PDIP 20-pin SSOP 28-pin QFN
External Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
Manufacturer Microchip
Comparators 2
SSP Yes
PWM 1 (10-Bit)
Watchdog Timer Yes
Comparators 2
Master Clear Reset Yes
In-Circuit Serial Programming Yes
Low Voltage Programming Yes
EEPROM Data Retention 40 Years
Minimum Operating Temperature -40 C
Maximum Operating Temperature 125 C
Technology Used NanoWatt

3. PIC16F88 Functions

There are a number of functions associated with this PIC module. Following are the main functions of PIC16F88.
Timer
PIC16F88 comes with one 16-bit and two 8-bit timers that can be employed both ways i.e. as a timer as well as a counter. These timers come with internal and external clock select capability. It is important to note that, the timer mode play a role to increment the instruction cycle while the counter mode increments the falling and rising edge of the pin.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is a useful function incorporated in the controller that helps it to program in the installation device, getting it rid to program before making it compatible to the required project.
Master Clear Reset (MCLR)
The MCLR, pin 4 in PDIP, calls the external reset for the chip. The reset is executed by keeping this pin LOW. The noise filter is included in the MCLR path that allows to remove and detect the small pulses while the MCLRE configuration bit disables MCLR input. It is worth mentioning here, this MCLR pin is not dependent on the internal resets.
USART
The USART module, that stands for Universal Synchronous and Asynchronous Receiver and Transmitter, is added in the device that is mainly used for laying out the serial communication with other devices. Two pins called TX and RX take part for serial communication where former is known as transmitting component that allows transmitting serial data while later is known as receiving a pin, used to receive the serial data.
Watchdog Timer
PIC16F88 comes with a built-in watchdog timer that helps in bringing the module in reset position if the program gets stuck in the infinite loop. This timer should be reset to the initial value after every 3 instructions in order to prevent it going to zero value. The watchdog timer is mainly a countdown timer that starts from 1000 and eventually goes down to zero.

4. PIC Compiler

  •  MPLAB C18 Compiler. is a standard compiler used for compiling the code in the controller. You can get this compiler online from the Official Microchip Site.
  • These Top 3 PIC C Compilers give you many options to choose from, but MikroC Pro For PIC is mainly used for this purpose, still, it depends on your needs and requirements.
  • The code we write in the compiler will generate a hex file which is then transferred to the microcontroller to call and execute the desired instructions.
  • There are many unofficial burners available in the market but PICKit3 is mostly preferred and used for the PIC controllers.

5. PIC16F88 Memory Layout and Working

So far you got a hold of pinout, description, features, and compiler used for the controller. In this section, we cover the memory layout that plays a vital role in the execution of the code. The memory of the module stores a number of instruction which can be divided into three major types named: Program Memory (ROM) RAM Memory (Data Memory) EEPROM Memory (Data Memory) Now we discuss each memory one by one and uncover the main features associated with them.
Program Memory
The Program memory is used for storing a running program permanently. It is also known as ROM memory or Non-Volatile memory and doesn’t depend on the power supply. The ROM memory is about 7K and is designed using FLASH Technology.
Data EEPROM
The EEPROM is a part of data memory and stores running program permanently with one exception i.e. this memory is indirectly mapped out, unlike Program memory that is directly mapped out. The EEPROM contains memory space around 256 bytes and can be accessed and addressed by multiple control registers.
Data RAM
RAM memory stores the program temporarily and removes the program once the power supply turns off. It is also known as volatile memory and is classified into two main parts called General-purpose registers (GPR) Special-function registers (SFR) The RAM memory registers are known as data holding places that can hold instruction, storage address, and any kind of data containing the individual character or bit sequence. The data memory can be employed as static RAM and is partitioned into multiple banks. The SRFs registers are mainly used to handle and control the peripherals modules. Following are the main registers available in the RAM memory. STATUS Register. This register is mainly used to switch between the mentioned banks. Setting the fifth bit of this register indicates the performance of bank1 while resetting it will address bank 0. TRISA. This register is used to configure PORTA as an input or output. The value 0 describes it as an input and value 0 shows output. TRISB. This register is similar to TRISA and used for configuring the pins as an input or output for PORTB. W Register. This register is not associated with any register bank and is addressed by the program only. It is a GPR while all other registers described above are SFR. It is important to note that, the required values are written on W register and transferred to the target register before writing them down on the PORTA or PORTB.

6. PIC16F88 Block Diagram

Block diagram helps you understand the main functions of the controller and how they work, associate and connect inside the controller body. The following figure shows the block diagram of PIC16F88.
  • This PIC module comes with two ports A and B and each port contains 8 pins where higher order bits belong to the STATUS register.
  • While CCP1 is dependent on CCPMX bit available in the Configuration Word 1 register.

7. PIC16F88 Projects and Applications

  • Student projects for sensor interfacing and motor controlling
  • GPS and security systems
  • Used in home and industrial automation
  • Prototyping custom circuits
  • Serial Communication
  • Central heating projects
  • Embedded system
  • Used in starter kits

8. Why Use PIC MicroControllers

  • PIC controllers were introduced with the intention to provide easy to use a module and easy to configure interface.
  • Gone are days when you have to buy a number of external components for carrying out different operations.
  • These controllers have built-in peripherals with a number of functions associated with each pin, getting you rid of buying extra components and make the whole project cheap in cost that covers less space and appears to be lightweight.
  • No need to add extra ADC module for converting analog values to digital values, as builtin ADC module incorporated in the tiny chip works best for interfacing different sensors on the board.
  • The compiler and burner for the controllers are readily available in the market. Live support is available on the Microchip site where you will get your queries answered sooner than late.
That’s all for today. I hope I have given you everything you needed to know about PIC16F88. If you are unsure or have any question you can ask me in the comment section below. I’d love to assist you in any way I can. You are most welcome to give us your suggestions that help us provide you quality work so you keep coming back for what we have to offer. Thanks for reading the article.

Introduction to PIC18F4520

Hi Friends! Hope you are doing well. In this platform we mainly cover information related to engineering and technology, no matter if you are a newbie or experts, you'll find something handy that may resonate with your field of interest. Today, I'll unlock the details on the Introduction to PIC18F4520. It is an 8-bit enhanced flash PIC microcontroller that comes with nanoWatt technology and is based on RISC architecture. Many electronic applications house this controller and cover wide areas ranging from home appliances, industrial automation, security system and end-user products. This microcontroller has made a renowned place in the market and becomes a major concern for university students for designing their projects, setting them free from the use of a plethora of components for a specific purpose, as this controller comes with inbuilt peripheral with the ability to perform multiple functions on a single chip. In this tutorial, I'll cover each and everything related to PIC18F4520, its pinout, main features, block diagram, and applications. Let's dive right in and nail down everything you need to know.

Introduction to PIC18F4520

  • PIC18F4520 is a PIC microcontroller, introduced Microchip, and mainly used in automation and embedded systems. It comes in three packages known as PDIP, QFN, and TQFP where the first one is 40-pin (mostly used) while other two come with a 44-pin interface.
  • This microcontroller version comes with CPU, timers, 10-Bit ADC and other peripherals that are mainly used to develop a connection with external devices.
  • This PIC version, like other models in the PIC community, contains everything that is required to make an embedded system and drive automation.
  • The PIC18F4520 contains 256 bytes of EEPROM data memory, 1536 bytes of RAM, and program memory of 32K.
  • It also incorporates 2 Comparators,10-bit Analog-to-Digital (A/D) converter with 13 channels, and houses decent memory endurance around 1,000,000 for EEPROM and 100,000 for program memory.
  • The Enhanced Universal Asynchronous Receiver Transmitter (EUSART) feature is useful for developing the serial communication with other devices.
  • The asynchronous serial port is added on the chip that can be interfaced both ways i.e. 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) Bus.
The functions that make this device unique in terms of functionality and ease of use include
  • Wide operating voltage range (2.0V-5.5V)
  • Multiplexed Master Clear with pull-up/input pin
  • In-Circuit Serial Programming™ (ICSP™) via two pins
  • Power-Saving Sleep mode
  • C compiler optimized architecture
  • Industrial and Extended Temperature range
  • Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
  • Power-on Reset (POR)
  • In-Circuit Debug (ICD) via two pins
  • Brown-out Reset (BOR) with software control option
  • Watchdog Timer (WDT)

1. PIC18F4520 Pinout and Description

You have got a clear idea about this PIC18F4520 model. In this section, we jot down the pinout of the controller and cover a detailed description of each pin.
PIC18F4520 Pinout
Following figure shows the pinout of PIC18F4520.
  • The PDIP module comes with 40-pin interface while other two QFN and TQFP contain 44-pin on each module.
  • The former module is mainly used for developing individual projects while the other two are incorporated in industrial electronic devices.
Pin Description
Every pin on the module comes with a unique function, used as per the requirement of the project. And some pins incorporate multiple functions. The following figure shows the complete pinout description of this tiny PIC module.
Pin# Pin Name Pin Description
2 RA0/AN0 RA0 AN0 Digital I/O Pin Analog Input 0 Pin
3 RA1/AN1 RA1 AN1 Digital I/O Pin Analog Input 1 Pin
4 RA2/AN/VREF- RA2 AN2 VREF- Digital I/O Pin Analog Input 2 Pin ADC Reference Input Voltage (low)
5 RA3/AN/VREF+ RA3 AN3 VREF+ Digital I/O Pin Analog Input 3 Pin ADC Reference Input Voltage (high)
6 RA4/T0CKI/C1OUT RA4 T0CKI C1OUT Digital I/O Pin External clock input for Timer0 Output Comparator 1
7 RA5/AN4/SS/HLVDIN/C2OUT RA5 AN4 SS HLVDIN C2OUT Digital I/O Pin Analog Input 4 Pin Slave Select input for SPI (High, Low) Detect Input for Low Voltage Output Comparator 2
33 RB0/INT0/FLT0/AN12 RB0 INT0 FLT0 AN12 PORTB can be programmed with software Digital I/O Pin External Interrupt 0 Fault Input for Enhanced CCP1 Analog Input
34 RB1/INT1/AN10 RB1 INT1 AN10 Digital I/O Pin External Interrupt 1 Analog input 10
35 RB2/INT2/AN8 RB2 INT2 AN8 Digital I/O Pin External Interrupt 2 Analog input 8
36 RB3/CCP2 RB3 AN9 CCP2 Digital I/O Pin Analog input 9 Output for Compare2 and PWM2, and Input for Capture2
37 RB4/KBI0/AN11 RB4 KBI0 AN11 Digital I/O Pin Interrupt-on-change pin Analog input 11
38 RB5/KBI1/PGM RB5 KBI1 PGM Digital I/O Pin Interrupt-on-change pin ICSP programming enable pin for low voltage  
39 RB6/KBI2/PGC RB6 KBI2 PGC Digital I/O Pin Interrupt-on-change pin ICSP programming clock and In-Circuit Debugger pin
40 RB7/KBI3/PGD RB7 KBI3 PGD Digital I/O Pin Interrupt-on-change pin ICSP programming data and In-Circuit Debugger pin
15 RC0/T1OSO/T13CKI RC0 T1OSO T13CKI Digital I/O Pin Oscillator output for Timer1 External clock input for Timer1/Timer3
16 RC1/T1OSI/CCP2 RC1 T1OSI CCP2 Digital I/O Pin Oscillator input for Timer1 Output for Compare2 and PWM2, Input for Capture2
17 RC2/CCP1/P1A RC2 CCP1 P1A Digital I/O Pin Output for Compare1 and PWM1, Input for Capture1 Enhanced CCP1 Output
18 RC3/SCK/SCL RC3 SCK SCL Digital I/O Pin SPI Module Synchronous serial clock input/output I2C Module Synchronous serial clock input/output
23 RC4/SDI/SDA RC4 SDI SDA Digital I/O Pin SPI Data-In Pin I2C Data I/O Pin
24 RC5/SDO RC5 SDO Digital I/O Pin SPI Data-Out Pin
25 RC6/TX/CK RC6 TX CK Digital I/O Pin Asynchronous Transmit (USART) Synchronous Clock (USART)
26 RC7/RX/DT RC7 RX DT Digital I/O Pin Asynchronous Receive (USART) Synchronous Data (USART)
19 RD0/PSP0 Digital I/O Pin Parallel Slave Port (PSP) for D0 with TTL input buffers
20 RD1/PSP1 Digital I/O Pin Parallel Slave Port for D1 with TTL input buffers
21 RD2/PSP2 Digital I/O Pin Parallel Slave Port for D2 with TTL input buffers
22 RD3/PSP3 Digital I/O Pin Parallel Slave Port for D3 with TTL input buffers
27 RD4/PSP4 Digital I/O Pin Parallel Slave Port for D4 with TTL input buffers
28 RD5/PSP5 Digital I/O Pin Parallel Slave Port for D5 with TTL input buffers
29 RD6/PSP6 Digital I/O Pin Parallel Slave Port for D6 with TTL input buffers
30 RD7/PSP7 Digital I/O Pin Parallel Slave Port for D7 with TTL input buffers
8 RE0/RD/AN5 RE0 RD AN5 Digital I/O Pin PSP Read Control Analog input 5 Pin
9 RE1/WR/AN6 RE1 WR AN6 Digital I/O Pin PSP Write Control Analog input 6 Pin
10 RE2/CS/AN7 RE2 CS AN7 Digital I/O Pin PSP Chip Select Control Analog input 7 Pin
1 MCLR/VPP MCLR VPP ICSP Programming Enable Pin Master Clear Active Low Reset Pin
13 OSC1/CLKI OSC1 CLKI Crystal Oscillator Input Pin
14 OSC2/CLKO/RA6 OSC2 CLKO RA6 Crystal Oscillator Output Pin
12,31 VSS Ground pin
11,32 VDD Voltage pin
  • This table will help you understand the function associated with each pin.

2. PIC18F4520 Features

Features are very important for any device that makes it unique from its counterparts. The following figure shows the complete features of PIC18F4520.
PIC18F4520 Features
No. of Pins 40
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 32K
Program Memory (Instructions) 16384
RAM 1536 Bytes
EEPROM 256 Bytes
ADC Number of Channels 10-Bit 13
I/O Ports (5) I/O Pins A,B,C,D,E 36
Packages 40-pin PDIP 44-pin QFN 44-pin TQFP
External Oscillator up to 40 MHz
Timer (4) 16-Bit Timer (3) 8-Bit Timer (1)
USART Protocol 1
I2C Protocol Yes
SPI Protocol Yes
Brown-out Reset Yes
Watchdog Timer Yes
Comparators 2
Master Synchronous Serial Port (MSSP) module 1
Capture/Compare/PWM 16bit/16bit/10bit
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Operating High-current sink/source Each pin 25mA
Programmable High/Low-Voltage Detect -Yes
Oscillator Start-up Timer Yes
  • These features help you identify the main characteristics of the controller that are appropriate for designing and developing for the certain project.

3. PIC18F4520 Functions

This PIC model is capable of performing many functions similar to other controllers in the PIC community. Following are the main functions of PIC18F4520.
Timer
PIC18F4520 comes with three 16-bit and one 8-bit timer that can be used as a timer as well as a counter. All three timers contain internal and external clock select capability. The timer mode mainly increments the instruction cycle while the counter mode is used to increment the rising and falling edge of the pin.
Brown Out Reset (BOR)
The BOR is a very useful function that allows this controller to reset once the Vdd (voltage supply) drops below a brownout threshold voltage. The multiple voltage ranges are used and provided to protect the chip once the power drops at the voltage supply line. The Power Up Timer must be kept enabled, in order to put the delay in returning the device from a BOR function, t The BOR mode can be configured both ways i.e. through BOREN settings in a register as well through programming.
In-Circuit Serial Programming
In-circuit serial programming (ICSP), also called In-system programming (ISP), is a feature added to this device that makes it enable to be programmed in the required system after installation, setting it free from programming the device before making it compatible with the certain project.
USART
This controller version comes with USART module, that stands for Universal Synchronous and Asynchronous Receiver and Transmitter, and is mainly used for setting up the serial communication with external devices. There are two parts of this module called TX and RX where former is known as transmitting component that is used for transmitting serial data while later is known as receiving component, used for receiving the serial data across the attached devices.
Watchdog Timer
PIC18F4520 contains a built-in watchdog timer that brings the controller in reset position if the program hangs up during compilation or gets stuck in the infinite loop. It is worth mentioning here, this timer must be reset to the initial value after every 3 instructions in order to avoid it going to zero value in normal conditions. The watchdog timer is more or less a countdown timer that starts from 1000 and ultimately goes down to zero.
Power On Reset
Power On Reset function is very helpful and resets the controller and starts it from scratch when Vdd raises above a certain threshold value. This function is very useful to prevent the device from malfunctioning.
Power Managed Modes
PIC18F4520 provides total 7 operating modes that help in more efficient power management. These modes offer multiple options for selective power conservation in a variety of applications. The power managed modes are mainly divided into three main categories called:
  • Run modes
  • Sleep mode
  • Idle modes
These categories help in identifying the areas of the device that are clocked at a specific speed. The Idle and Run modes can operate in any of three clock sources named primary, secondary, and internal oscillator block while Sleep mode is not involved in any clock source. The switching feature is added in the power managed modes that use the Timer1 oscillator as a replacement of a primary oscillator. All clocks will be cleared and stopped working in the Sleep mode.
Master Clear Reset (MCLR)
The MCLR pin is used for calling the external reset for the chip. The reset is triggered by keeping this pin at a LOW value and is not dependent on the internal resets. The noise filter is added in the MCLR executing process that helps in detecting and removing the small pulses. The MCLRE configuration bit can also be used to disable MCLR input.

4. PIC Compiler

  • Microchip comes with its own standard compiler for the PIC controller called MPLAB C18 Compiler. You can get this compiler online from the Official Microchip Site.
  •  MikroC Pro For PIC is a third party software mainly used as a replacement of Microchip standard compiler.
  • These Top 3 PIC C Compilers give you many options to choose from to pick any compiler as per your needs and demands.
  • The code written in the compiler generates a hex file which is then uploaded to the microcontroller to execute the number of instructions.
  • The PICKit3 is a standard PIC burner, mainly used for burning the code in the controller. There are other burners also available in the market but PICKit3 is mostly used and preferred for the PIC controllers.

5. PIC18F4520 Memory Layout and Working

The memory of the module is very useful for storing a number of instruction which can be divided into three major types: Program Memory Data EEPROM Data RAM Let's discuss each memory one by one and highlight the main functions associated with them.
Program Memory
The Program memory, also known as ROM memory or Non-Volatile memory, stores the running program permanently. It doesn't depend on the power supply i.e. stores the program in the absence of the main power supply.  The ROM memory is about 32K and is made with FLASH Technology.
Data EEPROM
This memory is similar to ROM memory in one way or the other and stores running program permanently with one limitation i.e. the instructions in EEPROM can be controlled and modified during the controller operation. The EEPROM comes with memory space around 256 bytes and can be accessed and addressed by multiple control registers.
Data RAM
RAM memory, also known as volatile memory, stores the program temporarily and removes the stored program once the power supply is removed. It is classified into two main parts called General-purpose registers (GPR) Special-function registers (SFR) This memory is volatile in nature as it stores the program temporarily and is power dependent i.e. once the power supply is turned off the instructions stored in the RAM will be removed. The RAM memory registers are the data holding places that can hold instruction, storage address, and any kind of data ranging from an individual character to bit sequence. The data memory can be employed as static RAM where each register comes with a 12-bit address. This memory is comprised of a total 16 banks and each bank contains a memory space of around 256 bytes. Let’s discuss few registers in details. STATUS Register. This register is mainly used to switch between the mentioned banks. Setting the fifth bit of this register indicates the performance of bank1 while resetting it will address bank 0. TRISA. This register plays a vital role to configure PORTA as an input or output. The value 1 describes it as an output and value 0 shows input. TRISB. This register is similar to TRISA and used for deciding the pins as an input or output of PORTB. W Register. This register is a GPR while all other described above belong to SFR. It is not associated with any register bank and is addressed by the program only. The required values are written on W register and moved to the target register before writing them down on the available ports.

6. PIC18F4520 Block Diagram

You have got a brief overview of pinout, its description and main features of the controller. In this section, we discuss the main block diagram of the microcontroller so you can get an idea how each function in the controller is related and connected to each other.
  • PIC18F4520 comes with five ports where each port contains 8 pins except the E port that comes with 4 pins which also include MCLR (master clear pin).
  • This device can be configured using 10 different oscillator modes where different capacitor values are required to generate acceptable oscillator operation. The user must test oscillator performance with the suitable VDD and temperature range for the required project.

7. PIC18F4520 Projects and Applications

  • PIC18F4520 is widely used in home and industrial automation
  • Student projects for motor controlling and sensor interfacing
  • GPS and security systems
  • Gas sensor projects
  • Production of temperature data logger
  • Serial Communication
  • Central heating projects
  • Embedded system

8. Why Use PIC MicroControllers

  • PIC microcontrollers are widely used in multiple applications as they come with user-friendly interface and easy onboard architecture that requires little or no prior skills before getting familiar with the chip.
  • They can perform a number of functions using minimum circuitry and are cheap in price as compared to other modules available in the market.
  • Minimum power consumption is another ability that makes this controller an ideal choice for the projects where power limitation is a major concern.
  • PIC controllers stay ahead of other Atmel controller like 8051 in terms of their higher processing speed and efficiency.
That's all for today. I hope this article has helped you got a complete overview of PIC18F4520 and the main functions associated with it. If you are unsure or feeling skeptical, you can ask me in the comment section below. I'd love to assist you in any way I can. Feel free to give your feedback and suggestions that help us provide you quality work based on your needs and requirements. Thanks for reading the article.

Sheer Influence of Robotics on Employment Reduction

Hi Friends! Hope you are doing fine. I am back to give you have a daily dose of useful information. Today, I'll cover the Sheer Influence of Robotics on Employment Reduction.  Technology has been working for the betterment of the human race quite a while now, but we cannot brush off its negative impact in real time. Technology covers almost everything from medical, engineering, economic, automotive industry to transportation. Bank cashiers are widely replaced by smart machines. Glass bottler industries use sensors for checking half-filled bottles - a job previously reserved for a common operator. Nevertheless, writers also feel the heat and face a severe threat produced by the automatic content creators over the web. Apart from getting exorbitant benefits from the valuable use of technology, no one is spared from the wrath it is imposing and penetrating our lives. In this tutorial, I'll cover how robotics and technology influence our surrounding and reduce job opportunities. Let's jump right in and explore everything you need to know.

Sheer Influence of Robotics on Employment Reduction

The idea of robotics influencing the job reduction is quite daunting and scares the hell out of most of the middle-class employees as robots are better in terms of efficiency and precision. International Federation of Robotics has concluded in their research  "overall paid employment has risen in most countries including Brazil, China, Republic of Korea, Germany, and the USA, but not Japan, which has seen a decline." The reason is quite clear. Japan stays ahead of other countries in terms of producing robots that create ease (if not for employees) and make human life convenient.
How Robots Work
Artificial Intelligence (AI) experts had done research back in 1980 that robots find easy things difficult and difficult things easy. Suppose, we take an example of Google crawlers who are quite efficient and strive to bring more relevant information when someone looks for a specific query over the internet. They work best to read pages and written text, but they fail to visualize and analyze the image like a naked eye. The Alt Text that we put in the image as we upload the image in our blog post, help crawlers anticipate what the image is about and how it is relevant to the particular solution a visitor is looking for.
Benefits and Limitations of Robotics
National Bureau of Economic Research uncovers that every new robot introduced in the industry almost reduces 3 to 5 jobs in the local area. Researchers and Economist have also concluded that Robots only replace the middle-class jobs that require logic and algebra. On the other hand, they fail to replace the jobs that require human interference like mobility and perception. The benefits that make robots preferrable over human beings include their ability to store current information for a maximum period of time, minimum maintenance requirement and they don't get bored by repeating a single task multiple times. With that being said, robots cannot beat the human mind in terms of the ability to think and incorporate ideas based on the previous knowledge. Also, robots don't evolve with the passage of time like a human being. They just work on the instructions and commands given by the experts.
More Room for Skilled People
There is a huge gap between the people who are doing average jobs manually and the skills required to operate, manage and study the whole robotic system. It is true, robotics have reduced the jobs significantly but, on the other hand, it has also created more jobs for the people who are interested in technology and come with appropriate skills pertaining to robotics and automation.
Things Required to Design Robot
You can design the robot and allows it to perform tasks as per your instructions. Robots contain both mechanical structure and electronic components on a single body. If you intend to make a robot by yourself, you need a number of Printed Circuit Boards (PCB) which handle and control the robotic function on a single chip. We have tried a number of companies to get PCBs and incorporate our ideas in real time. PCBWay is the best manufacturer when it comes to producing quality PCB without losing the bit of accuracy. They not only assist their customers in selecting required PCB, but they also come out of their way to help in the development of your project and pick the best PCB layout. Every PCB they produce comes with a thick copper layer that removes the chance of any broken layers that may cause a problem during the execution of your project. They also keep you quite in line with their production process and do a proper follow so you don't feel you are left out in the process. In case, the product you get doesn't resonate with your requirement, they feel no hesitation to replace the board at first place. In order to avoid any hassle, be sure to select the right PCB and give clear instruction so the right board is dispatched to your place. That’s all for today. I hope you have enjoyed the article. However, if you are feeling skeptical or have any question, you can approach me in the comment section below. I’d love to help you in any way I can. Feel free to keep us updated with your valuable feedback and suggestions; they help us provide you relevant content as per your demands. Thanks for reading the article.

Introduction to PIC16F887

Hey Guys! Hope you are doing well. This is a platform where we keep you updated with valuable information so you keep coming back for what we have to offer. Today, I'll uncover the details on the Introduction to PIC16F887. It is a 40-pin PIC microcontroller, introduced by Microchip, and is a successor of PIC16F877A. Microcontrollers have revitalized the technology by providing a flawless interface and an ability to perform numbers of functions on a single chip. Gone are days, when you had to rely on external components to develop your projects which might be time-consuming, covered more space, and required a number of prior skills before making your project in real time. Microcontrollers have made things easy by covering each and every aspect of the projects that are directly or remotely related to automation. In this tutorial, I'll discuss each and everything related to PIC16F887 including its main features, working, pinout and applications. Let's jump right in and nail down everything you need to know.

Introduction to PIC16F887

  • PIC16F887 is a 40-pin (for PDIP package) and 8-bit CMOS PIC Microcontroller that comes with nanoWatt technology. Economical price and user-friendly architecture make this device easy to use and easy to configure.
  • It is available in three packages known as PDIP, QFN, and TQFP. The first one comes with a 40-pin layout design while remaining two contains 44 pins on each layout.
  • This PIC version, like other models in the PIC community, contains everything that is required to make an embedded system and drive automation.
  • The PIC16F887 incorporates 256 bytes of EEPROM data memory, 368 bytes of RAM, and program memory of 8K.
  • Apart from self-programming capability, it also contains 2 Comparators,10-bit Analog-to-Digital (A/D) converter with 14 channels, and capture, compare and PWM functions.
  • The asynchronous serial port is added on the chip that can be configured both ways i.e. the 2-wire Inter-Integrated Circuit (I²C™) Bus or 3-wire Serial Peripheral Interface (SPI™)
  • The Enhanced Universal Asynchronous Receiver Transmitter (EUSART) feature makes this chip compatible with the devices where serial communication is an integral part of the project.
  • The functions that make this device unique in terms of ease of use include
  1. Power-Saving Sleep mode
  2. Industrial and Extended Temperature range
  3. Wide operating voltage range (2.0V-5.5V)
  4. SR Latch mode
  5. Power-up Timer (PWRT) and Oscillator Start-up Timer (OST)
  6. Power-on Reset (POR)
  7. Ultra-Low-Power Wake-up (ULPWU)
  8. Multiplexed Master Clear with pull-up/input pin
  9. Individually programmable weak pull-ups
  10. Brown-out Reset (BOR) with software control option
  11. Enhanced low-current Watchdog Timer (WDT)
  • Needless to say, this PIC version is an ideal choice to drive A/D conversion in automotive, consumer, and industrial applications.

1. PIC16F887 Pinout & Description

Getting a hold of Pinout and Pin descriptions is mandatory to check the working of each pin on this tiny chip. If you are a newbie or an expert, you need to know the function associated with each pin for a better understanding of the chip.
Pinout
The following figure shows the complete pinout of all three packages called PDIP, QFN, and TQFP.

  • As described earlier, the PDIP package contains 40-pin while other two come with 44 pins.
Pin Description
PIC16F887 is widely used in many electronic applications. Some pins in the controller are capable of doing more than one functions that allow us to use the pin according to the needs and demands of the project. I have listed the function of each pin in the following table.
Pin# Pin Name Pin Description
2 RA0 AN0/ULPWU C12IN0- Digital I/O Pin Analog Input 0 Pin Comparator
3 RA1 AN1/ULPWU C12IN1- Digital I/O Pin Analog Input 1 Pin Comparator
4 RA2 AN2 C2IN+ VREF-/CVREF Digital I/O Pin Analog Input 2 Pin Comparator ADC Reference Input Voltage (low)
5 RA3 AN3 C1IN+ VREF+ Digital I/O Pin Analog Input 3 Pin Comparator ADC Reference Input Voltage (high)
6 RA4 C1OUT T0CKI Digital I/O Pin Comparator External clock input for Timer0
7 RA5 AN4 C2OUT SS Digital I/O Pin Analog Input 4 Pin Comparator Slave Select input for SPI
33 RB0 AN12 IOC/INT Digital I/O Pin Analog Pin Interrupt-on-change
34 RB1 AN10 C12IN3- IOC Digital I/O Pin Analog Pin Comparator Interrupt-on-change
35 RB2 AN8 IOC Digital I/O Pin Analog Pin Interrupt-on-change
36 RB3 AN9 C12IN2- IOC PGM Digital I/O Pin Analog Pin Comparator Interrupt-on-change Basic
37 RB4 AN11 IOC Digital I/O Pin Analog Pin Interrupt-on-change
38 RB5 AN13 T1G IOC Digital I/O Pin Analog Pin Timer Interrupt-on-change
39 RB6 IOC ICSPCLK Digital I/O Pin Interrupt-on-change pin Basic
40 RB7 IOC ICSPDAT Digital I/O Pin Interrupt-on-change pin Basic
15 RC0 T1OSO/T1CKI Digital I/O Pin Timer
16 RC1 T1OSI CCP2 Digital I/O Pin Timer ECCP
17 RC2 CCP1/P1A Digital I/O Pin ECCP
18 RC3 SCK/SCL Digital I/O Pin MSSP
23 RC5/SDO RC5 SDO Digital I/O Pin SPI Data-Out Pin
24 RC5 SD0 Digital I/O Pin MSSP
25 RC6 TX/CK Digital I/O Pin USART
26 RC7 RX/DT Digital I/O Pin USART
19 RD0 Digital I/O Pin
20 RD1 Digital I/O Pin
21 RD2 Digital I/O Pin
22 RD3 Digital I/O Pin
27 RD4 Digital I/O Pin
28 RD5 P1B Digital I/O Pin ECCP
29 RD6 P1C Digital I/O Pin ECCP
30 RD7 P1D Digital I/O Pin ECCP
8 RE0 AN5 Digital I/O Pin Analog Pin
9 RE1 AN6 Digital I/O Pin Analog Pin
10 RE2 AN7 Digital I/O Pin Analog Pin
13 RA7 OSC1 CLKIN Crystal Oscillator Input Pin
14 RA6 OSC2 CLKOUT Crystal Oscillator Output Pin
1 RE3 MCLR VPP ICSP Programming Enable Pin Master Clear Active Low Reset Pin
11,32 VDD Voltage Supply Pin
12,31 VSS Ground Pin

2. PIC16F887 Features

You can anticipate the nature of any device by looking at its main features. Following table shows the complete features of PIC16F887.
PIC16F887 Features
No. of Pins 40
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 8K
Program Memory (Instructions) 8192
RAM 368 Bytes
EEPROM 256 Bytes
ADC 10-Bit
I/O Ports (5) I/O Pins A,B,C,D,E 35
Packages 40-pin PDIP 44-pin QFN 44-pin TQFP
External Oscillator up to 20 MHz
Timer (3) 16-Bit Timer (1) 8-Bit Timer (2)
USART Protocol 1
I2C Protocol Yes
SPI Protocol Yes
Brown-out Reset Yes
Watchdog Timer Yes
Comparators 2
Master Synchronous Serial Port (MSSP) module 1
Capture/Compare/PWM 16bit/16bit/10bit
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Operating Current 11uA at 32 kHz, 2.0 V 220uA at 4 MHz, 2.0 V
Temperature Range -40 to 125
Oscillator Start-up Timer Yes
  • Checking main features before purchasing of the controller will help you analyze and develop your required project.
  • Power on reset and selectable oscillator options are some unique features included in the chip.

3. PIC16F887 Functions

This PIC model performs many functions that are quite similar to the function in other controllers of the PIC community. Following are the main functions of PIC16F887.
Timer
PIC16F887 contains one 16-bit timer and two 8-bit timers that can be used in both ways i.e. timer and counter and comes with internal and external clock select capability. The timer mode is used to increment the instruction cycle while counter mode increments the rising and falling edge of the pin. When the bit T0CS (OPTION_REG<5>) is set, the counter mode will be selected and when it is cleared, the timer mode will be selected.
Brown Out Reset (BOR)
The BOR is a function that brings the controller to reset once the Vdd (voltage supply) drops below a brownout threshold voltage. There is a fine line between a BOR and Power On Reset, where the whole range of voltages is provided to protect the chip once the power drops at the voltage supply line. In order to put the delay, mostly recommended, in returning from a BOR function, the Power Up Timer must be kept enabled. Apart from controlling through software, the BOR mode can also be handled and configured through BOREN settings in a register.
USART
PIC16F887 comes with enhanced USART module. This module consists of TX - A transmission pin used for transmitting serial data to other devices and RX - A receive pin used for receiving serial data.
Watchdog Timer
PIC16F887 comes with built-in watchdog timer that is mainly used to reset the controller when a program hangs up during compilation or gets stuck in the infinite loop of the program. It is important to note the timer must be reset to the initial value after every 3 instructions in order to avoid it going to zero value in normal conditions. The watchdog timer is nothing but a countdown timer and starts from 1000 and gradually goes down to zero.
Power On Reset
Power On Reset function resets the controller when it is powered on. If there comes unknown error in the chip, powering on the device will exclude it from the loop of running program and saves the device from malfunctioning.
Sleep Mode
Power saving sleep function generates a low current power down mode. This sleep mode can be terminated using an interrupt, watchdog timer or external reset.

4. PIC Compiler

  • Microchip has introduced its own standard compiler for the PIC controller called MPLAB C18 Compiler. You can download this compiler online from the Microchip Official Site.
  • The code written in the compiler creates a hex file that is transferred to the microcontroller to execute the certain function.
  • Third party softwares are also available for compiling the program and MikroC Pro For PIC is mainly used for this purpose.
  • These Top 3 PIC C Compilers give you the flexibility to pick any compiler based on your needs and requirements.
  • The PICKit3 is mainly used for burning the code in the controller which is a standard PIC burner. There are other unofficial burners also available but PICKit3 is mostly preferred for the PIC controllers.

5. PIC16F887 Memory Layout and Working

The whole memory in this controller is distributed into three main types known as EEPROM, RAM and ROM Memory. All of them plays a vital role in the controller in terms of executing and calling instructions with some exceptions. Let's discuss each of them one by one.
ROM Memory
ROM memory, also known as Non-Volatile memory, which stores the running program permanently and is not dependent on the power supply i.e. has an ability to retain the program if the power supply is removed. The ROM memory is about 8K made with FLASH Technology.
EEPROM Memory
This memory is quite similar to ROM memory in one way or the other in terms of storing running program permanently with the exception i.e. the instructions in EEPROM can be modified during the operation of the controller. It contains memory space around 256 bytes, quite less than ROM memory, but enough to store the program permanently.
RAM Memory
RAM memory, also known as volatile memory, is divided into two main parts known as general-purpose registers (GPR) and special-function registers (SFR). This memory is volatile in nature as it stores the program temporarily and is power dependent i.e. once the power supply is turned off the instructions stored in the RAM will be removed.
  • Registers in the RAM memory are the data holding places in the controller. A single register can hold instruction, storage address, and any kind of data including bit sequence or individual characters.
Registers are classified into two banks called Bank 1 and Bank 2 where registers from 00H to 0BH and 80H to 8BH fall under the category of SFRs and remaining are GPRs.
  • Each bank contains128 bytes of memory space where first 12 locations are reserved for SFR while remaining are reserved for GPR.
Let’s discuss few registers in details. STATUS. This register plays a role to switch between the banks. Setting fifth bit of this register shows we are discussing bank 1 while resetting it will indicate we are discussing bank 0. TRISA. This register is used to configure PORTA as an input or output. The value 1 shows output and value 0 shows input. TRISB. This register is identical to the TRISA in terms of deciding the pins as an input or output and used for PORTB. W Register. All registers mentioned above are SFRs while W register is a GPR. It is not a part of any register bank and is accessible by the program only. The desired values are written on W register and transferred to the target register before writing them on the PORTA or PORTB.

6. PIC16F887 Block Diagram

The following figure shows the block diagram of PIC16F887.
  • The program memory comes with 8K memory space which can configure 8192 words.
  • Some pins can be interfaced with other functions of multiple devices including external interrupt, Timer0 clock input and Change on PORTB interrupt.

7. PIC16F887 Projects and Applications

  • PIC16F887 is mainly used in students project i.e. controlling motors and sensor interfacing.
  • Used in Central heating projects
  • Production of temperature data logger
  • Serial Communication
  • Used in health and security systems
  • Gas sensor projects
  • Embedded system
  • Used in industrial automation

8. Why Use PIC MicroControllers

PIC microcontrollers are widely used in most of the electronic applications because they offer easy to use interface that requires no prior skills for getting a hands-on experience with the module. These controllers are cheap and come with an ability to perform a number of functions using minimum circuitry. PIC controllers have outperformed Atmel controller like 8051 in terms of their efficiency and higher processing speed. More often than not, automation industries prefer and use these controllers for carrying out different operations as they offer very little power consumption. That’s all for today. I hope I have given you everything related to PIC16F887. If you are unsure or have any query, you can ask me in the comment section below. I’d love to help you in any way I can. You are most welcome to give your feedback and suggestions, they help us provide you quality work as per your needs and demands. Thanks for reading the article.

ESP8266 Pinout, Datasheet, Features & Applications

Hello friends! Hope you are doing well. Today, we will have a look at the detailed Introduction to ESP8266 WiFi module. ESP8266 is a very low-cost & user-friendly WiFi module, which develops a simple TCP/IP connection and can easily be interfaced with microcontrollers via Serial Port. The first chip in this series was ESP-01 which gained sheer attention in the market. In this tutorial, we will discuss the ESP8266 WiFi module along with its pinout, features, specifications, applications and datasheet. Let's dive in and nail down everything related to this device.

ESP8266 WiFi Module

  • ESP8266 (also called ESP8266 Wireless Transceiver) is a cost-effective, easy-to-operate, compact-sized & low-powered WiFi module, designed by Espressif Systems, that supports both TCP/IP and Serial Protocol.
  • It's normally used in IOT cloud-based embedded projects and is considered the most widely used WiFi module because of its low cost and small size.
  • It runs at an operating voltage of 3V and can handle a maximum voltage of around 3.6 V, so an external logic level converter is required if you are using 5V supply.
  • ESP8266 WiFi module can easily be interfaced with microcontrollers board (i.e. Arduino UNO) via Serial Port.
  • There are numerous breakout boards available based on ESP8266 WiFi Module (i.e. ESP8266 NodeMCU V3).
  • Beause of its compact size, its mostly used in autonomous projects (i.e. Robotics).
  • Other than ESP8266, "Espressif Systems" has designed many other ESP WiFi modules, few of them are shown in below figure:
Now let's have a look at the ESP8266 Pinout, necessary for interfacing with microcontrollers.

ESP8266 Pinout

  • ESP8266 Pinout consists of 8 pins in total, which are given in below table along with their operation:
ESP8266 Pinout
No. Pin Name Working
1 RX Serial Receiver Pin
2 Vcc Power Pin (+3.3 V; can handle up to 3.6 V)
3 GPIO 0 General-purpose I/O No. 0
4 RST Reset
5 CH_PD Chip power-down
6 GPIO 2 General-purpose I/O No. 2
7 TX Serial Transmitter Pin
8 GND Ground
  • Each pin comes with a specific function associated with it where Vcc and GND are voltage source and ground respectively.
  • RX and TX are used for communication where TX is dedicated for data transmission and RX is used receiving data.

ESP8266 Datasheet

  • You can download ESP8266 Datasheet by clicking the below button:
Download ESP8266 Datasheet

ESP8266 Features

  • It is also known as a system-on-chip (SoC) and comes with a 32-bit Tensilica microcontroller, antenna switches, RF balun, power amplifier, standard digital peripheral interfaces, low noise receive amplifier, power management module and filter capability.
  • The processor is based on Tensilica Xtensa Diamond Standard 106Micro and runs at 80 MHz.
  • It incorporates 64 KiB boot ROM, 80 KiB user data RAM and 32 KiB instruction RAM.
  • It supports Wi-Fi 802.11 b/g/n around 2.4 GHz and other features including 16 GPIO, Inter-Integrated Circuit (I²C), Serial Peripheral Interface (SPI), 10-bit ADC, and I²S interfaces with DMA.
  • External QSPI flash memory is accessed through SPI and supports up to 16 MiB and 512 KiB to 4 MiB is initially included in the module.
  • It is a major development in terms of wireless communication with little circuitry. and contains onboard regulator that helps in providing 3.3V consistent power to the board.
  • It supports APSD which makes it an ideal choice for VoIP applications and Bluetooth interfaces.

How to Power Up the Module

  • You can power up the device with PC port using USB to Serial adaptor. The 2 AA  and LIPO batteries are equally handy for powering up the device.
  • It is advised to not power this device directly with 5V dev board. Doing so can severely affect the quality and overall performance of the device.

ESP8266 NodeMCU

  • There are numerous breakout boards designed by different companies, based on this ESP8266 WiFi module.
  • Among these breakout boards, ESP8266 NodeMCU is the most popular one.
  • Here's the Pinout Diagram of ESP8266 NodeMCU:

ESP8266 Projects & Applications

ESP8266 WiFi module is widely used in embedded projects and thus brings WiFi capability. Here's few ESP8266 Projects & Applications:
  • Wireless Web Server
  • Geolocation using ESP8266
  • Pressure Sensors on Railway Tracks
  • Air Pollution Meter
  • Temperature logging system
  • World’s smallest IoT project
  • Wi-Fi controlled robot
  • Humidity and temperature monitoring
  • M2M using ESP8266
That's all for today. I hope I have given you everything you needed to know regarding this WiFi module. If you are unsure or have any question, you can ask me in the comment section below. I'd love to help you in any way I can. You are most welcome to keep us updated with your suggestions so we keep providing quality work that resonates with your needs and demands. Thanks for reading the article.
Syed Zain Nasir

I am Syed Zain Nasir, the founder of <a href=https://www.TheEngineeringProjects.com/>The Engineering Projects</a> (TEP). I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. <a href=https://plus.google.com/+SyedZainNasir/>My Google Profile+</a>

Share
Published by
Syed Zain Nasir