PIC16F-11-LCD-with-a-PIC-LCD-Configuration

by Marwen Maghrebi
#include <xc.h>

#define _XTAL_FREQ  10000000UL      // 10MHz

// Configuration bits
#pragma config FOSC = HS            // Oscillator Selection bits (HS oscillator)
#pragma config WDTE = OFF           // Watchdog Timer Enable bit (WDT Disabled)
#pragma config PWRTE = OFF          // Power-up Timer Enable bit (PWRT disabled)
#pragma config CP = OFF             // FLASH Program Memory Code Protection bits (Code protection off)
#pragma config BOREN = ON           // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = OFF            // Low Voltage In-Circuit Serial Programming Disable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF            // Data EE Memory Code Protection (Code Protection off)
#pragma config WRT = OFF            // FLASH Program Memory Write Disable (Unprotected program memory may be written to by EECON control)

// LCD pin definitions
#define LCD_BUS             PORTB   // Data bus for LCD (8 bits)
#define ENABLE_LCD          PORTCbits.RC1 // Enable pin of LCD
#define RS_LCD              PORTCbits.RC0 // RS pin of LCD

// Direction configuration for pins
#define LCD_BUS_DIRECTION   TRISB   // Data bus tristate register
#define ENABLE_DIRECTION    TRISCbits.TRISC1    // Enable pin tristate register
#define RS_DIRECTION        TRISCbits.TRISC0    // RS pin tristate register

// LCD line addresses
#define Line0               0x80
#define Line1               0xC0
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00