View previous topic :: View next topic |
Author |
Message |
e-learner
Joined: 20 May 2014 Posts: 21
|
still not working, i am blank to do anything.. |
Posted: Mon Jun 16, 2014 2:14 am |
|
|
Code: |
#include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=20000000)
#include <Flex_lcd.c>
void main()
{
While(1)
{
delay_ms(300);
lcd_init();
printf(lcd_putc,"/f welcome to ETPL");
delay_ms(50);
output_high(PIN_B1);
}
}
|
link for my circuit connection:
http://s27.postimg.org/at8fndlj7/LCD.jpg
What else i have to correct? No response in LCD. _________________ e-learner |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Mon Jun 16, 2014 5:12 am |
|
|
IF your code really has lcd_RW commented out in the driver AND you really have D2 connected to the lcd RW pin THEN remove that connection.
Also
can you confirm the PIC runs the '1HZ LED program' ?
Also
your LCD test program never clears( turns off) the LED. You should add 2 more lines of code to do so
Also
The delay_ms(300); only needs to be execute ONCE not every time in your 'forever loop'. Place it before that loop.
hth
jay |
|
|
e-learner
Joined: 20 May 2014 Posts: 21
|
RE: |
Posted: Mon Jun 16, 2014 7:18 am |
|
|
Ok i will do that too and will say the result. I removed the RW connection from D2 and given to ground and i have commented the respective pin define also. _________________ e-learner |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Mon Jun 16, 2014 9:40 am |
|
|
You do NOT ground the RW pin of the LCD module .... leave it unconnected.
hth
jay |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Jun 16, 2014 11:18 am |
|
|
Hi Jay,
Are you sure about that? Here is what the flex_lcd.c file says about that:
Quote: |
// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.
//#define USE_LCD_RW 1
|
That's the way I always do it, and it works just fine!
John |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Mon Jun 16, 2014 11:53 am |
|
|
hmm...ok it is ground !! I had a 50-50 chance from memory?
Had to go check a couple of boards...as I don't trust schematics..and at 61 I can't trust my memory either !!!
It's the low nibble of LCD data that's left floating, right ???
Only 90*F here, high humdidity AND silly cat needed 'rescuing' from 20' neighbour's tree.Fun wearing welding outfit to NOT get clawed to death.....
sigh....maybe indoor electronics is more fun ???
Jay |
|
|
e-learner
Joined: 20 May 2014 Posts: 21
|
RE: |
Posted: Tue Jun 17, 2014 1:37 am |
|
|
i tried out all the changes said by u people,but again simple black squares are only repeatedly seen.
Code: | #include <16F877a.h>
#fuses HS,NOWDT,NOPROTECT,NOBROWNOUT,NOLVP
#use delay(clock=20000000)
#include <Flex_lcd.c>
void main()
{
delay_ms(300);
While(1)
{
lcd_init();
lcd_putc,"\f welcome";
//delay_ms(500);
output_high(PIN_B1);
//delay_ms(1500);
output_low(PIN_B1);
}
} |
also my connections in flex_lcd driver is:
Code: |
#define LCD_DB4 PIN_D4
#define LCD_DB5 PIN_D5
#define LCD_DB6 PIN_D6
#define LCD_DB7 PIN_D7
#define LCD_E PIN_D0
#define LCD_RS PIN_D1
//#define LCD_RW PIN_D2
// If you only want a 6-pin interface to your LCD, then
// connect the R/W pin on the LCD to ground, and comment
// out the following line.
//#define USE_LCD_RW 1 |
and grounded the RW pin.no change.sorry ..... _________________ e-learner |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9246 Location: Greensville,Ontario
|
|
Posted: Tue Jun 17, 2014 5:13 am |
|
|
hmm....
Please confirm that if you uncomment the delay_ms(..) lines does the LED flash 1/2 second on, 1.5 seconds off?
Do you have only 1 row of black squares on the LCD?
Can you control the 'contrast'(darkness) by changing the pot on pin 3 of the LCD?
I know that the flex_lcd driver does work with an 877...
Please increase the delay_ms(300); to (500). I use 500 for all my displays,though 300 'should' be fine....
Please verify the wiring..
A picture of your PIC/LCD might be useful....
It's a process of 'elimination' style debugging as your code looks ok....
hth
jay |
|
|
e-learner
Joined: 20 May 2014 Posts: 21
|
re: |
Posted: Tue Jun 17, 2014 6:17 am |
|
|
I am able to vary the contrast of LCD, when i fully adjust 2 rows of black squares coming. I increased the delay also. I think problem arises due to some ground connection. I will post the picture of board with the neat connection tomorrow.
I will give my final try tonight....
Thanks for all for your replies. _________________ e-learner |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
Re: RE: |
Posted: Tue Jun 17, 2014 7:41 am |
|
|
Hi,
e-learner wrote: |
i tried out all the changes said by u people,but again simple black squares are only repeatedly seen.
|
Well, no, you really didn't! You have been asked multiple times to perform a 1 Hz LED test to see if your PIC is running at the right speed, but so far you've ignored this advice. Put this code in Main() above your While(1) loop, and tell us what happens! Time the flashes. Are they 1 second in duration???????
Code: |
int8 iIndex = 0;
// Here we blip the Power LED at power-up to show that the interface is working
for ( iIndex=0 ; iIndex<4 ; iIndex++ )
{
output_high(Pin_B1);
delay_ms(1000);
output_low(Pin_B1);
delay_ms(1000);
}
// Here we leave the Power LED ON
output_high(PWR_LED);
|
You have been told multiple times to perform the lcd_int() only once, but yet you leave this function call inside your While() loop where it is called again and again..... Move this call above the While(1) loop so that it executes only once.....
You've been asked multiple times to post a link to your LCD module, but you've ignored this request. Who knows, maybe it's a mongrel, and won't work with the flex_lcd driver?
If, and that is a HUGE if, you have any hope of getting this project to work, you need to step back, make sure your PIC is actually running correctly, and then you need to verify every connection you've made to your LCD display.
Help us to help you, otherwise, I recommend that you throw in the towel, and recognize that PICs aren't for you.
Special Kudo's to temtronic in this thread. That man has the patience of a saint!
John |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jun 17, 2014 10:29 am |
|
|
In addition to that, you have the line shown in bold below:
Quote: | While(1)
{
lcd_init();
lcd_putc,"\f welcome";
//delay_ms(500);
output_high(PIN_B1);
//delay_ms(1500);
output_low(PIN_B1);
}
} |
I compiled your program, and in the MPLAB output window it says:
Quote: |
Executing: "C:\Program files\Picc\CCSC.exe" +FM "pcm_test.c" +DF +LY -T -A +M -Z +Y=9 +EA #__16F886=TRUE
>>> Warning 203 "pcm_test.c" Line 12(1,1): Condition always TRUE
>>> Warning 207 "pcm_test.c" Line 15(1,1): Code has no effect
Memory usage: ROM=5% RAM=2% - 3%
0 Errors, 2 Warnings.
Build Successful.
|
The lcd_putc line does not follow the required C syntax, and the compiler
has decided to ignore it. Look at the .LST file below. It skips that line.
The compiler doesn't generate any code for the lcd_putc, because you
are not using the correct syntax for that function. The compiler goes off
to the lcd_init routine, which then has a GOTO at the end, going back to
address 0175.
Code: |
.................... While(1)
.................... {
.................... lcd_init();
0174: GOTO lcd_init
.................... lcd_putc,"\f welcome";
....................
.................... //delay_ms(500);
.................... output_high(PIN_B1);
0175: BSF STATUS.RP0
0176: BCF TRISB.TRISB1
0177: BCF STATUS.RP0
0178: BSF PORTB.RB1
|
Every single thing is important. You can't make mistakes like this and
expect your program or your lcd board to work. You have to watch the
details. |
|
|
|