Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

lcd is showing black boxes on pic16f877a

Status
Not open for further replies.

Shubham Navale

Newbie level 1
Joined
Apr 6, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
19
Iam using pic16f877a and for programing mplabx and programmer Pickit2
When program lcd program it only shows black boxes on breadboard
Here is my code


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#include<pic16f877a.h>
 
// PIC16F877A Configuration Bit Settings
 
// 'C' source line config statements
 
#include <xc.h>
 
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
 
// CONFIG
#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 BOREN = ON       // Brown-out Reset Enable bit (BOR enabled)
#pragma config LVP = ON         // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF        // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF        // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF         // Flash Program Memory Code Protection bit (Code protection off)
 
 
 
#define datal PORTB
#define rs PORTDbits.RD5
#define rw PORTDbits.RD6
#define e PORTDbits.RD7
void Delay(unsigned int time);
void main(void)
{
    TRISB=0x00;
    PORTB=0x00;
    TRISD=0x00;
    PORTD=0x00;
    Delay(5000);
    e=0;
    Delay(5000);
    datal=0x38;
    rs=0;
    rw=0;
    e=1;
    Delay(5000);
    e=0;
    Delay(5000);
    datal=0x0F;
    rs=0;
    rw=0;
    e=1;
    Delay(5000);
    e=0;
    Delay(5000);
    datal=0x01;
    rs=0;
    rw=0;
    e=1;
    Delay(5000);
    e=0;
    Delay(5000);
    datal=0x06;
    rs=0;
    rw=0;
    e=1;
    Delay(5000);
    e=0;
    Delay(5000);
    datal='s';
    rs=1;
    rw=0;
    e=1;
    Delay(5000);
    e=0;
    Delay(5000);
    while(1)
    {
        PORTDbits.RD0=0;
        Delay(1000);
        PORTDbits.RD0=1;
        Delay(1000);
    }
}
 
 
void Delay(unsigned int time)
{
    int i,j;
    for(i=0;i<time;i++)
        for(j=0;j<165;j++);
}

 
Last edited by a moderator:

make sure all control and data pins connected firm not any loose connection.Set the lcd contrast using potentiometer.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top