PDA

View Full Version : Stupid question about LCDOUT



Glenn
- 5th October 2008, 21:09
Well, since I got some help from you guys with my servoproblems I now have a more or less working routine for that, well, now I wanted to have a LCD to put some debug data to, reading the PBP manual it looks so easy, so I started with building the example in PBP manual:

http://www.melabs.com/resources/pbpmanual/5_32-5_35.htm#535

The only change I did was using a 16F628A instead of the 16F84A, therefore I removed the xtal and the two caps.

Then I wrote a very small program like this:



@ device INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTEC T_OFF
DEFINE OSC 4 ' Lets work at 4MHz
CMCON = 7 ' Disable comparators

pause 500 ' grace time for the LCD to initialize.

main:
LCDOUT $FE, 1, "Hello world" ' Clear display and show text
pause 1000 ' Wait 1s
goto main ' Go back


Well, nothing happens.. no sign of text on the LCD, no matter how I adjust the pot.. and I cant see why ?

The LCD is a Sharp LM16A211, which is Hitachi 44780 compatible, and I also have used several of these for other applications so they are ok.

b1arrk5
- 5th October 2008, 21:14
Hi Glenn,

I believe that you also need the Defines shown in the MELabs manual, before you use the LCDOUT command.

Good Luck,

Jerry

Glenn
- 5th October 2008, 21:34
Well, if I understand it correctky its not needed if you use the default stuff, but I tried to add the whole define-block mention in the manual, and there is no difference.

I also tried to put a LED on a pin and make it flash so I know that the pic is "running"..

skimask
- 5th October 2008, 21:56
The only change I did was using a 16F628A instead of the 16F84A, therefore I removed the xtal and the two caps.
Got a pullup on RA4?
Try putting the xtal and the caps back on there anyways? Just in case the config fuses didn't take.
Put an LED on an unused pin for grins and see if it blinks for ya... I ALWAYS use a heartbeat LED or two on all my projects. It takes sooo much guesswork out of the equation...



@ device INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTEC T_OFF
DEFINE OSC 4 ' Lets work at 4MHz
CMCON = 7 ' Disable comparators
pause 500 ' grace time for the LCD to initialize.
led var portb.0
main: led = 1
LCDOUT $FE, 1, "Hello world" ' Clear display and show text
pause 500 ' Wait 1/2 sec
led = 0
LCDOUT $FE, 1, LED Off"
pause 500
goto main ' Go back

Archangel
- 6th October 2008, 05:07
Well, since I got some help from you guys with my servoproblems I now have a more or less working routine for that, well, now I wanted to have a LCD to put some debug data to, reading the PBP manual it looks so easy, so I started with building the example in PBP manual:

http://www.melabs.com/resources/pbpmanual/5_32-5_35.htm#535

The only change I did was using a 16F628A instead of the 16F84A, therefore I removed the xtal and the two caps.

Then I wrote a very small program like this:



@ device INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTEC T_OFF
DEFINE OSC 4 ' Lets work at 4MHz
CMCON = 7 ' Disable comparators

pause 500 ' grace time for the LCD to initialize.

main:
LCDOUT $FE, 1, "Hello world" ' Clear display and show text
pause 1000 ' Wait 1s
goto main ' Go back


Well, nothing happens.. no sign of text on the LCD, no matter how I adjust the pot.. and I cant see why ?

The LCD is a Sharp LM16A211, which is Hitachi 44780 compatible, and I also have used several of these for other applications so they are ok.

try this


@ DEVICE INTRC_OSC_NOCLKOUT,MCLR_OFF,LVP_OFF,WDT_OFF,PROTEC T_OFF
DEFINE LCD_COMMANDUS 1000 'Defines how fast PIC sends Data and
' 'Commands to LCD change to suit LCD's
' 'needs.
DEFINE LCD_DATAUS 50 'Define delay time between sending LCD
'commands.
'Define delay time between data sent.
DEFINE OSC 4 ' Lets work at 4MHz
CMCON = 7 ' Disable comparators

pause 500 ' grace time for the LCD to initialize.

main:
LCDOUT $FE, 1 ' CLEAR LCD
PAUSE 10
LCDOUT $FE,2, "Hello world" ' LINE 1 and show text
pause 1000 ' Wait 1s
goto main ' Go back
END

I'm not sure about the config statement as I do not use PM assembler anymore

Glenn
- 6th October 2008, 19:06
Got a pullup on RA4?

Yes, I accidenticaly made it a pulldown first, but when it didnt work I checked all connections and fixed that.



Try putting the xtal and the caps back on there anyways? Just in case the config fuses didn't take.
Put an LED on an unused pin for grins and see if it blinks for ya... I ALWAYS use a heartbeat LED or two on all my projects. It takes sooo much guesswork out of the equation...


As I wrote I already did that :) ..I also like the idea with a heartbeat (Even if it doesnt look as nice at it does on my old HP PA-RISC machine :) if I have a spare pin.

It flashes so the oscillator doesnt seem to be the problem.

Glenn
- 6th October 2008, 19:11
try this

No, didnt work either :(

..I think I going to try to dig some 16F84A's up and try with that instead, since the example is made for 16F84.

Acetronics2
- 6th October 2008, 19:17
Hi,

Did you notice the reversed pinout numbering ??? ... from right to left.

Alain

Glenn
- 6th October 2008, 20:45
Hi,
Did you notice the reversed pinout numbering ??? ... from right to left.


Yes, I have the datasheet for the displays since I used them in aother project (connetced to the parport of a computer)

skimask
- 6th October 2008, 22:01
Yes, I have the datasheet for the displays since I used them in aother project (connetced to the parport of a computer)

Using one of those 'solderless breadboards' for the project?
Double check those connections!!! They might be hooked up right, but are they making contact...

Glenn
- 6th October 2008, 22:06
Ok, no I changed the pic to a 16F84A, and connetced a Xtal and two caps, still doesnt work :(

Very strange.

Now I test with:



@ device HS_OSC,WDT_OFF,PROTECT_OFF
DEFINE OSC 4 ' Lets work at 4MHz

DEFINE LCD_DREG PORTB
DEFINE LCD_DBIT 4
DEFINE LCD_RSREG PORTB
DEFINE LCD_RSBIT 1
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 0
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
DEFINE LCD_COMMANDUS 2000
DEFINE LCD_DATAUS 50


pause 500 ' grace time for the LCD to initialize.

main:
LCDOUT $FE, 1, "Hello world" ' Clear display and show text
high portb.0 ' Turn the LED on.
pause 1000 ' Wait 1s
low portb.0 ' Turn the LED off.
pause 1000 ' Wait 1s
goto main ' Go back

Glenn
- 6th October 2008, 22:08
Using one of those 'solderless breadboards' for the project?
Double check those connections!!! They might be hooked up right, but are they making contact...

Yes I do, actually a new one I never used before since the other one is used for my servotests :)

I measured the Vss and Vdd on the display to see that it get power, also that it get some power at Vo, but none of the other connections, but maybe I should..

skimask
- 6th October 2008, 22:15
Yes I do, actually a new one I never used before since the other one is used for my servotests :)
I measured the Vss and Vdd on the display to see that it get power, also that it get some power at Vo, but none of the other connections, but maybe I should..

Right up there with the heartbeat LED, I usually put a 'blink all pins at x frequency' subroutine in there to do nothing but pulse all the pins at a known rate. Hit 'em with the logic probe or the 'scope and those questions go out the window...
Solderless breadboards-These days, my older breadboards are usually the first suspect...

Glenn
- 6th October 2008, 22:32
Right up there with the heartbeat LED, I usually put a 'blink all pins at x frequency' subroutine in there to do nothing but pulse all the pins at a known rate. Hit 'em with the logic probe or the 'scope and those questions go out the window...
Solderless breadboards-These days, my older breadboards are usually the first suspect...

I guess I can try to move the whole project to another part of the breadboard or another breadboard to test.. or trying to find the probs for the scope :)

Anyway, this is waht it looks like now.. yea, I know its not a school example of how it should be done but it should work.

http://safir.amigaos.se/bildgalleri/users/5773_P1020750-halfsize.jpg

skimask
- 6th October 2008, 22:42
A few questions...
Why the double-pullup resistor on RA4? Same on MCLR?
Pin 9 on the PIC should go to pin 6 on the LCD...
Almost looks like the LCD needs to be jammed in there a bit farther...
Also, you really need more decoupling cap's... a couple across Vdd/Vss on both the PIC and the LCD (especially the LCD in this case) wouldn't hurt.
Ok, I missed the part where you said you swapped over to an 'F84A.
Those 1st 3 solder joints on the LCD don't look that good either, could be the lighting though...

mackrackit
- 6th October 2008, 22:57
I may be full of you know what...
But I think the LCD is wired backwards. I do not have the data sheet for that one, but isn't pin 14 over by the mounting hole?

skimask
- 6th October 2008, 23:01
I may be full of you know what...
But I think the LCD is wired backwards. I do not have the data sheet for that one, but isn't pin 14 over by the mounting hole?

Holy Crap!!! Actually, I checked my stash of LCDs. 3 of them have pin 14 by the hole, 1 has pin 1 by the hole...
So I don't think you're full of it...

mackrackit
- 6th October 2008, 23:07
So I don't think you're full of it...
Now if I could get my wife to agree with you ;)

Glenn
- 7th October 2008, 00:11
A few questions...
Why the double-pullup resistor on RA4? Same on MCLR?


Since I have alot of 10K resistors handy and didnt want to search for 4K7 in my big pile of resistors I used two 10K in parallel to get 5K :) ..and since its only a pullup its not very critical anyway.



Pin 9 on the PIC should go to pin 6 on the LCD...
Almost looks like the LCD needs to be jammed in there a bit farther...


The pinstrip I used have pretty long (and very thin) pins so its no problem.



Also, you really need more decoupling cap's... a couple across Vdd/Vss on both the PIC and the LCD (especially the LCD in this case) wouldn't hurt.


You mean closer ? Well, I guess I could do that just to get that possibility out of the way, but I dont think it should be any problem, I use a very clean powersource and have one cap on the breadboard over Vss and Vdd.



Ok, I missed the part where you said you swapped over to an 'F84A.
Those 1st 3 solder joints on the LCD don't look that good either, could be the lighting though...

The leftmost ones ? its actually flux that went white when I pressed the testpins from my multimeter to see if I really got some power to the LCD :) ..So no problem there, but I admit that the solderings on the ICSP-connector looks like crap :) ..I just made a cable between the Pickit2 and a pinstrip very quickly since I was tired of connecting and disconnecting the pickit2 all the time.

Glenn
- 7th October 2008, 00:13
I may be full of you know what...
But I think the LCD is wired backwards. I do not have the data sheet for that one, but isn't pin 14 over by the mounting hole?

Great, after some googling I realized that there are datasheets of very similar displays, and SOME have pin 1 at the edge, and some have pin 14 Doh..

The one that I had printed says it is like I wired it up on the breadboard, therefore I assumed that I followed this when I builded the parport displays, but now I better disassemble one and see how I really connected it.

skimask
- 7th October 2008, 02:21
You mean closer ? Well, I guess I could do that just to get that possibility out of the way, but I dont think it should be any problem, I use a very clean powersource and have one cap on the breadboard over Vss and Vdd.
Sometimes it doesn't matter how 'clean' the PSU is, because down the road, the PIC will mess it up for you...all by itself. And quite frankly, you won't find very many circuits, even battery powered, that don't have a cap or two sprinkled all over the place to help keep the power lines/ground lines clean and clear from spikes.

wayne2056
- 7th October 2008, 21:37
Glen,
It's been a while since I used a breadboard but looking at your photo and the two strips connected to power, make sure that the two strips you are using for power, that the two parallel columns on the strips are actually connected together internally. Else you need a jumper.

I hope you understand what i mean..

Wayne