Posts

Showing posts from May, 2015

SIM900A + PIC16F877A

Image
Displaying incoming call  number on 16*2 LCD using SIM900A +  PIC16f877A

DIGITAL TIMER USING PIC16F877A

Image
By using this project we can switch ON and switch OFF the load (Real time) by using pic16F877A and DS1307

PIC16F877A PIN as input

Image
This post provides an example code to use PIC16F877A pins as inputs. After going through this example, you will understand how to make PIC16F877A pins as inputs and how to read their value in the code. This code is written in C language using MPLAB X IDE with XC8 compiler. Code The code for reading the status of RB0 pin is shown below. Figure 1: PIC16F877A code for PORTB as input PIC16F877 pin as input demonstrating circuit: figure2: pic16f877A simulation output

PIC16F877A UART CODE

Image
When a microcontroller communicates with the outside world, it provides the data in byte-sized chunks. In some cases,such as printers, the information is simply grabbed from the 8-bit databus and presented to the 8 bit data bus of the printer. This can work only if the cable is not too long, because long cables diminish and even distort signals. Furthermore the 8 bit path is expensive.For these reasons,serial communication is used for transferring data between two systems located at the distances of hundreds of feet to millions of miles apart. For a serial communication data to work, the bytes of data must be converted to serial bits using a parallel-in-serial-out shift register, then it can be transmitted over a single data line.This also means that at the receiving end there must be a serial in parallel out shift register to receive the serial data and pack them into a byte. Serial communication uses two methods,asynchro...

PIC16F877A TIMERS

Image
Programming Timers in PIC16F: The PIC16 has 3 timers depends on the family members.They are arranged as Timers 0,1,2. They can be used either as timer to generate a time delay or counters to count events happening outside of the microcontroller.   TIMER0 : Timer0 is an 8-bit Timer/Counter module with the following features:  8-bit prescaler (shared with WDT).   Selectable internal or external clock source.  Interrupt on overflow (255→0).  Source edge selection (positive or negative going edge). To configure the Timer0 module the OPTION_REG Special Function Register (SFR) is used.  Simplified block diagram of timer 0 : Figure 1 : Simplified block diagram of Timer 0 OPERATION :            In this section we will step through the various blocks of the Timer0 module and configure each using the OPTION_REG.  Selecting the Timer0 Source: T0CS: Timer0 Clock ...

PIC16F877A 8 bit LCD Code

Image
PIC16F877A LCD Code This post provides the code to make an 16*2 LCD  Interfacing with  PIC16F877A microcontroller. This code is written in C language using MPLAB X IDE with XC8 compiler.  LCD pin descriptions: The LCD discussed in this section has 16 pins, The function of each is described below. VCC VSS and VEE :         While Vcc and Vss provide +5 volts and ground, respectively Vee is used for controlling the LCD contrast. RS, Register select : There are two Important register inside the LCD The RS pin is used for selection of the registers If RS=0, Instruction Command register is selected, allowing the user to send command to LCD IF RS=1, Data register is selected, allowing the user to send data to LCD R/W, read/write : R/W input allows the user to write information to the LCD or read the information from the LCD. R/W = 1 when reading  R/W =0 when writing E, Enable : The Enable pin is used by the LCD ...

PIC12F675 LED Blinking Code

Image
PIC12F675 LED Blinking Code This post provides the code to make an LED blink using PIC12F675 microcontroller. This code is written in C language using MPLAB X IDE with XC8 compiler. This code is intended to be the first step in learning how to use PIC12F675 microcontroller in your projects. Code: // PIC12F675 Configuration Bit Settings // 'C' source line config statements #include <xc.h> /*define clock freq*/ #ifndef _XTAL_FREQ   #define _XTAL_FREQ 4000000  // 4MHZ crystal #endif // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. // CONFIG #pragma config FOSC = INTRCIO   // Oscillator Selection bits (INTOSC oscillator: I/O function on GP4/OSC2/CLKOUT pin, I/O function on GP5/OSC1/CLKIN) #pragma config WDTE = OFF       // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = OFF      // Power-Up Timer Enable bit (PWRT disabl...