Presentation is loading. Please wait.

Presentation is loading. Please wait.

PIC16F887.  1.Microcontroller introducton  2.MPLAB,Hi-tech compilers  3.LED  4.Switches/push buttons  5.7-Segment Display  6.Keypad  7.LCD  8.Timers.

Similar presentations


Presentation on theme: "PIC16F887.  1.Microcontroller introducton  2.MPLAB,Hi-tech compilers  3.LED  4.Switches/push buttons  5.7-Segment Display  6.Keypad  7.LCD  8.Timers."— Presentation transcript:

1 PIC16F887

2  1.Microcontroller introducton  2.MPLAB,Hi-tech compilers  3.LED  4.Switches/push buttons  5.7-Segment Display  6.Keypad  7.LCD  8.Timers  9.ADC/DAC  10.UART Protocal(RX,TX)  11.SPI Protocal  12.Real time clock(RTC)  13.Pulse width modulation(PWM)  14.Interrupts  15.EEPROM

3  Microcontroller is a compact integrated circuit designed to govern a specific operation in an embedded system.  Microcontrollers often operate at very low speed compare to microprocessors, but this is useful for typical applications. MICROCONTROLLER FEATURES: Software selectable frequency range of 8 MHz to 20 MHz Two-Speed Start-up mode Crystal fail detect for critical applications Clock mode switching during operation for power savings Power-Saving Sleep mode Wide Operating Voltage Range (2.0V-5.5V)

4

5  PORTA-RA0 TO RA7  PORTB-RB0 TO RB7  PORTC-RC0 TO RC7  PORTD-RD0 TO RD7  PORTE-RE0 TO RE2  VDD-2(11,32)  VSS-2(12,31)  RESET PIN-1

6  PORTA=0x00;  TRISA=0x00;  ANSEL=0x00;  ANSELH=0x00;  Output pin=RA0

7  PORTD=0x00;  TRISD=0x01; //for input  Input pin –RD0  Output pin –RD1

8  PORTA=0x00;  TRISA=0x01; //for input  PORTB=0x00;  TRISB=0x00;  ANSEL=0x00;  ANSELH=0x00 ;  0X3f=0  0x06=1  0x5b=2  0x4f=3  0x66=4  0x6d=5

9  PORTC=0x00; (FOR KEYPAD)  TRISC=0x70;  PORTB=0x00; (FOR 7-SEG)  TRISB=0x00;  ANSEL=0x00;  ANSELH=0x00;

10  void pulse()  {  en=1;  __delay_ms(10); ------delay function  en=0;  __delay_ms(10);  }  Lcd=0x38 //type of lcd 16x2  Lcd=0x0E // cursor on  Lcd=0x0C // cursor off  Lcd=0x80 //starting address

11  TOIF=Timer 0 Interrupt Flag  T1CON=0x31;  OPTION_REG=0x07;

12  TMR1IF=Timer 1 Interrupt Flag

13  TRANSMITTER  void tx(unsigned int Y)  {  TXREG=Y;  while(TXIF==0);---  Transmitter Interrupt Flag  TXIF=0;  }  void rx()---  Receiver Function  {  int k;  for(k=0;k<10;k++)  {  while(RCIF==0);---  Receiver Interrupt Flag  X=RCREG;  tx(X);  RCIF=0;  A[k]=X;  }  A[k]='\0';  }

14  TXSTA=0X26;  RCSTA=0x90;  SPBRG=25;  address(0x38);  address(0x0C);  address(0x80);

15  void wait()  {  while(SSPIF==0);  SSPIF=0; } void I2C_Start()  {  SEN=1;  wait();  } void I2C_Stop()  {  PEN=1;  wait();  }  unsigned char I2C_Read(unsigned char i)  {  unsigned char read;  if(i==2)  ACKDT=1;  else  ACKDT=0;  while(BF==0);  read=SSPBUF;  SSPOV=0;  SSPIF=0;  ACKEN=1;  return(read);  }

16 void pwm_duty(unsigned int duty)  {  CCPR1L=duty>>2;  CCP1CON=(((duty<<4)&0x30)|CCP1CON);  CCP1CON=0xCF&CCP1CON;  }  void pwm_init()  {  TRISC=0x00;  TRISD=0x00;  T2CON=0x05;  PR2=0xff;  CCP1CON=0x0D;  CCP2CON=0x0f;  }


Download ppt "PIC16F887.  1.Microcontroller introducton  2.MPLAB,Hi-tech compilers  3.LED  4.Switches/push buttons  5.7-Segment Display  6.Keypad  7.LCD  8.Timers."

Similar presentations


Ads by Google