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.

[PIC] connection problem with 16x2 lcd to 16f877a

Status
Not open for further replies.

upekshachathurani

Newbie level 1
Newbie level 1
Joined
Aug 5, 2014
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
17
hii, i want to connect 16x2 lcd (blue color screen) to the pic 16f877a. The code is running correctly with proteus. but when i made the circut it will not working.i tried many times, first it worked for some extend. it means not the correct code, part of the code. now it only appears black color boxes. i designed this circuit to measure the rainfall. i used 20mhz crystal.
https://obrazki.elektroda.pl/5516358800_1407255095.png
https://obrazki.elektroda.pl/2889756800_1407255695.png
this are the images which show it working in proteus.
my code is:
pin defined in flex_lcd;


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
#define LCD_DB4   PIN_D4
#define LCD_DB5   PIN_D5 
#define LCD_DB6   PIN_D6
#define LCD_DB7   PIN_D7 
 
#define LCD_E     PIN_D3 
#define LCD_RS    PIN_D1
#define LCD_RW    PIN_D2
 
the code:>
#include "D:\academic\code\check\main.h"
 
#include <flex_lcd.c>
int counter;
float rainfall;
void main()
 
{
lcd_init();
   setup_adc_ports(NO_ANALOGS);
   setup_adc(ADC_OFF);
   setup_psp(PSP_DISABLED);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1(T1_DISABLED);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);
   setup_vref(FALSE);
 
   while(true)
   {
   if(input(pin_B5))
   {
   counter=counter+1;
   rainfall=counter*2.54;
 printf(lcd_putc,"\frainfall %fmm",rainfall);
 delay_ms(500);
 
   }
   else if(input(pin_B7))
   {
   counter=0;
   printf(lcd_putc,"\frainfall %dmm",counter);
 delay_ms(500);
   }
   }
}

 
Last edited by a moderator:

Make the LCD pin definition after the line where you include the LCD header file,(flex_lcd.c).Do it and report what happens.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top