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.

[SOLVED] 16x2 display with 16f877a interfacing problem!

Status
Not open for further replies.

bilal aslam

Newbie level 5
Joined
Jun 7, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,361
hey i m trying to interface 16x2 lcd display with 16f877a ....i m using pcw compiler and the program is just to write my name on the display,and i m using genius 540 programmer....the thing is that the circuit is made perfectly and the program is burned properly on the chip..the problem is that when i switch on the display ..the leds turns on with black boxes and their contrast is varied by 2.2k pot....but when i push the 16f877a in the ic base...IT turns off ..so can you guys tell me what seems to be the problem in my case.....i have checked the program on proteus and simulated it...it works fine there...plz reply soon...


config iS

16F877A LCD

RD0------------E
RD1------------RS
RD2------------RW
RD3------------D3
RD4------------D4
RD5------------D5
RD6------------D6
RD7------------D7
VCC-----------5V
VDD-----------GND
VEE-----------2.2K POT
LED15---------5V
LES16---------GND
 

It may be initialization problem due to some timing issue or may be due to improper fuse bits...
Any way, I think you need to post your code here. Also what about the fuse bits?
 

I use the Genius 540 programmer and one of the first programming exercises I did was to drive a 16x2 LCD display. The problem with the Genius 540 programmer is that it does not set the configuration word from the HEX file and that you have to enter the configuration word yourself in the Encrypt box.
Another reason maybe that the circuit is working and that all you need to do is adjust the contrast control.
 
Last edited:

so how can i set the configuration word from HEX file.....and i didnt put 12mhz osc in the circuit....do i need to put it and why?

and the code is
# include <16f877a.h>
#fuses HS,NOWDT,NOLVP
#use delay (clock=12mhz)
#include <lcd.c>

main()
{
lcd_init();
delay_ms(50);
while(1)
{
lcd_gotoxy(1,1);
lcd_putc("my name");
}
}
 

so how can i set the configuration word from HEX file.....and i didnt put 12mhz osc in the circuit....do i need to put it and why?

You can't set the configuration word from the HEX file it is a problem with the programmer, you have to enter the configuration word yourself via the Encrypt button. If the configuration word is not set then the watchdog timer will be active and will reset the processor before it has a chance of putting anything on to the display.
In Proteus the default frequency of a PIC processor is 1Mhz, you can change this in the properties of the device.
 

QUOTE:pjmelect;You can't set the configuration word from the HEX file it is a problem with the programmer, you have to enter the configuration word yourself via the Encrypt button. If the configuration word is not set then the watchdog timer will be active and will reset the processor before it has a chance of putting anything on to the display.
In Proteus the default frequency of a PIC processor is 1Mhz, you can change this in the properties of the device.

OK ..now i have solded the 12mhz ocs to the original circuit...and changed the frequency of pic processor to 12mhz ...also i tried to disable the WDT but still the same error......what should i do now....should i buy another programmer which doesnt have this problem..which is the best programmer that i can use which doesnt have these problems...

- - - Updated - - -

how about the mach x programmer or icd-u40..which one of them is easy to use ..and i use laptop mostly with windows 7 so it doesnt have serial port...both of them are compatible with pcw..
 

OK ..now i have solded the 12mhz ocs to the original circuit...and changed the frequency of pic processor to 12mhz ...also i tried to disable the WDT but still the same error......what should i do now....should i buy another programmer which doesnt have this problem..which is the best programmer that i can use which doesnt have these problems...

The G540 is a very good programmer its only real flaw is its inability to change the configuration word from the HEX file and its Chinglish instructions. There is no problem entering the configuration word yourself from the config Set button on the menu bar, which is what I do and is only a minor inconvenience.

Another thing you don't need to do in Proteus is tie pin 1 MR high or connect the 5V to the two power supply rails and the ground to the two power ground rails. I assume that you have done this. Also the default configuration bits are for a RC oscillator this will have to be changed for a crystal oscillator.
 
yah..so what should i do after loading the hex file program ....should i change it to BIN or HEX(INTEL) ...if i change it to hex(intel) it gives me a formation error then the same error non config worde error...if i chose BIN it only gives non config worde error....and after it the program windows is opened in the middle...now what should i do..can you please guide me from the beginning to end..plz......what i do is program the same thing to the ic ..till encription check it ok...after i place the ic in the base...the lcd glowing turns off....
and i dont know which config setting to put with this 16f877a..i m new at this,.,this is my first interfacing project...

- - - Updated - - -

i have tried config settings ...but still same error...plz guide me

- - - Updated - - -

also the cof file is of 21.0 kb and hex file is of 1.51kb...i m choosing hex file and loading the program...then i dont know whether to chose hex intel or bin....both of them give me the same error no matter i disable the wdt...please guide through
 

yah..so what should i do after loading the hex file program ....should i change it to BIN or HEX(INTEL) ...if i change it to hex(intel) it gives me a formation error then the same error non config worde error...if i chose BIN it only gives non config worde error....and after it the program windows is opened in the middle...now what should i do..can you please guide me from the beginning to end..plz......what i do is program the same thing to the ic ..till encription check it ok...after i place the ic in the base...the lcd glowing turns off....
and i dont know which config setting to put with this 16f877a..i m new at this,.,this is my first interfacing project...

- - - Updated - - -

i have tried config settings ...but still same error...plz guide me

- - - Updated - - -

also the cof file is of 21.0 kb and hex file is of 1.51kb...i m choosing hex file and loading the program...then i dont know whether to chose hex intel or bin....both of them give me the same error no matter i disable the wdt...please guide through

The file format as generated by MPASM is a Intel HEX file and that is what should be selected when loading the program.

these are the encrypt Set settings that I would use for a 12Mhz crystal.

FOSC0 UNTICKED
FOSC1 TICKED
WDTE TICKED
PWRITE TICKED
BOREN TICKED
LVP UNTICKED
CPD UNTICKED
WRT0 UNTICKED
WRT1 UNTICKED
DEBUG UNTICKED
CP UNTICKED
 
still the same configuration error....first i set the config settings as done by you then in load the program in hex intel ..its shows configuration worde error...and displays the data window containing data in hex......
 

still the same configuration error....first i set the config settings as done by you then in load the program in hex intel ..its shows configuration worde error...and displays the data window containing data in hex......

The "non configuration worde in the HEX file Please set it after loading" warning message is only saying in Chinglish that the configuration data in the HEX file has not been loaded. You can disregard this message as you should know by now that you have to set the configuration word in the Config Set box.
 

ok but i have changed the config settings load the hex file and then i just disregard the message and load the program ...i just program the ic and still the lcd turns off......i m soon goin to upload a video on youtude so you can see whats happening....but thankx for your time and your replies...
 

How is the reset pin used. Check if it has to be made high. zip and post the isis .dsn file.
 

I watched the video, you seem to be doing everything correctly and as I do as regard programming the PIC. However the LCD light going out when you plug in the PIC (not a good idea with the power on) is because the 5V is collapsing. This could be due to a wiring error, plugging the PIC in the wrong way around or the power supply not being able to supply the required current. This should be simple to sort out.
 
huree! i sort it out thankx to you...the mistake i was doing was that after config setting told by you i didnt used to read config after the program loads...so once i did that also there was some wiring error..i did it...but i could not have done it without your help...*** bless you sir...here is my another video hope you like it...and thankx alot again sir..
https://www.youtube.com/watch?v=wdQGIGnWDRI&feature=youtu.be...
 

huree! i sort it out thankx to you...the mistake i was doing was that after config setting told by you i didnt used to read config after the program loads...so once i did that also there was some wiring error..i did it...but i could not have done it without your help...*** bless you sir...here is my another video hope you like it...and thankx alot again sir..
https://www.youtube.com/watch?v=wdQGIGnWDRI&feature=youtu.be...

I am glad that I was able to help. It was a bit ambitious to start with a LCD control program, I started with a simple LED flasher. The next step is to now try and scrolling some text. Note if you try this in Proteus the text scrolls in the wrong direction due to a bug in the Proteus model. After you have done this you can make a simple voltmeter, try using the PMW function, drive the LCD with four data wires etc. Anyway that is what I did when I was learning about programming PIC's.
 

ok ill try all of theses...and thankx again

- - - Updated - - -

ok ill try all of theses...and thankx again
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top