PIC16f877-DS18b20-Configuration&PINDefinitions

by Marwen Maghrebi
  1. #include <xc.h> // Include PIC microcontroller library
  2. #include <stdio.h> // For sprintf function
  3. #include <string.h> // For string operations
  4.  
  5. #define _XTAL_FREQ 20000000 // Define crystal frequency for delay calculations
  6.  
  7. // Configuration bits
  8. #pragma config FOSC = HS // High-speed oscillator
  9. #pragma config WDTE = OFF // Watchdog Timer disabled
  10. #pragma config PWRTE = OFF // Power-up Timer disabled
  11. #pragma config BOREN = OFF // Brown-out Reset disabled
  12. #pragma config LVP = ON // Low-Voltage Programming enabled
  13. #pragma config CPD = OFF // Data EEPROM Code Protection disabled
  14. #pragma config WRT = OFF // Flash Program Memory Write Protection disabled
  15. #pragma config CP = OFF // Flash Program Memory Code Protection disabled
  16.  
  17. // DS18B20 Pin definition
  18. #define DS18B20_PIN PORTBbits.RB1
  19. #define DS18B20_TRIS TRISBbits.TRISB1
  20.  
  21. // LCD control pins
  22. #define RS PORTCbits.RC0
  23. #define RW PORTCbits.RC1
  24. #define EN PORTCbits.RC2
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
    -
    00:00
    00:00