Datasheets are a wonderful place to get lost, I looked at it and knowing what to do it didn't make sense.Originally Posted by skimask
flotulopex,
ADCON1 = 7 ' turns off adc
CMCON = 7 'turns off comparators
Datasheets are a wonderful place to get lost, I looked at it and knowing what to do it didn't make sense.Originally Posted by skimask
flotulopex,
ADCON1 = 7 ' turns off adc
CMCON = 7 'turns off comparators
Last edited by Archangel; - 11th September 2006 at 23:56.
Hi Flotulopex,
Where are your DEFINES for the LCD?
Your program should start like this:
OSCCON = %01100000 'Internal RC set to 4MHZ
DEFINE LCD_DREG PortA
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTA
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTB
DEFINE LCD_EBIT 4
DEFINE LCD_BITS 4
DEFINE LCD_LINES 2
TRISA = %00000000 'make Port A outputs
TRISB = %00000000 'make Port B outptuts
ADCON1 = 7 ' turns off adc
CMCON = 7 'turns off comparators
Pause 1000 'Wait for display to initialise
Main:
lcdout $FE, 1 'Clear LCD
lcdout $FE, 2 'Position cursor at home
lcdout "Hello World" 'Send "Hello World" to LCD on line 1
lcdout $FE, $C0 'Position cursor second line
lcdout "Second line" 'Send "Second line" to LCD on line 2
pause 1000 'Pause 1 second to see it
goto Main
end
The next problem I believe you have is you don't power your circuit from the programmer power. I'm assuming you are using ICSP programming. You should power the circuit from its own separate power supply. Do you have capacitors on the power supply lines? 10uF and .1uF on the 5 volt side of the voltage regulator going to the PIC. Make sure you have a .1uF across the PICs power leads as close as possible. Have a 100uF or 10uF and a .1uf across the input side of the voltage regulator also.
If you don't have a copy of the PBP manual then download one! There is a real nice example of how LCDOUT is suppose to be connected and programmed. Also the contrast pin of the LCD display is suppose to be connected to the wiper or center pin of a 5K potentiometer with one of the two remaining pins connected to +5vdc and the other side to ground. After you have all of this setup, if you are still getting blocks on the screen, then adjust the pot until the blocks are just barely seen. Then try your program.
This should help you get going!
BobK
Thank you All.
I'll try to turn off ADCs and COMPARATORs as soon as I'm back home.
Yes, I compared the PBP manual with other documents I have found on the net. The difference I see with the PBP manual's shematic and others is the pull-up resistor on RA4. I'll try this too.
Yes, I'm using ICSP. Is it a problem to use the programmer's power source? It has 1A source and is very stable. I have installed a 3 pole switch to interrupt the MCLR, DATA and CLOCK lines once the PIC is programmed and I just keep Vdd and Vss.
I'm using the MICROCHIP AN589 programmer and there are capacitors in this circuit. I will add a 0.1µF close to the PIC.
About the defines, as far as I understood the PBP help file (in MicroCode Studio), I'm using the default settings so I thought the defines were not mandatory (am I wrong?).
Roger
Well,
I did all what you suggested and unfortunately it didn't work.
The last thing may be... the display itself?
I have three displays doing the same thing when connected to the PIC. The first is an ELECTROFONT 98301 (MK620NY-LY) and the second (I have 2 of them) is a VL 16265SS3 R2. I couldn't find their data sheets so I can only assume they are like almost all other displays "Hitachi 44780" compatible.
These displays come from HP servers made around 2000.
When adjusting the contrast, the display flickers a little.
During the programming, the display stays always on.
I even changed the PIC and still the same happens.
I then tried to remove one-by-one the wires from the display hoping for a change. Unfortunately, until Vcc and GND are removed, the display stays like the picture I sent in a previous post.
One more thing I just tested -which can sound really stupid- WITHOUT the PIC. Guess what, still the same.
Any other idea?
Last edited by flotulopex; - 12th September 2006 at 17:16.
Roger
You say in your first post that you are using 16F88Originally Posted by flotulopex
Try adding the line....
ANSEL = %00000000 ' Disable Analogue Inputs
..to disable the analogue inputs which are on by default.
Regards
Keith
www.diyha.co.uk
www.kat5.tv
Hello again,
DEFINES are not DEFAULTS. Defaults are part of the 16F88.inc file and pertain to certain setup requirements. These are also configurable by you if you need to change them for your particular application. DEFINES are used to setup things like LCD displays, serial printers or other types of serial outputs using the DEFINE DEBUG type statements. You must add the define statements yourself. Again another topic to read in the MELABS PBP manual.
I don't know anything about the Microchip programmer. If I get a chance this coming weekend I'll look it up. I use the MELABS USB and EPIC programmers and they don't have enough power to handle programming and powering your circuitry.
I ordered 4 of those serial LCD driver boards. If they get here by Thursday I'll get one built over the weekend and let you know how they work. I though the prices were well within reason.
Sorry about the ansel = item. I didn't take the time to read the datasheet. Shame on me! But at least I was on the right track! Thanks Keith!!!
BobK
Last edited by BobK; - 13th September 2006 at 02:13.
One thing to look at - the pins on an LCD are a bit weird. The pins are numbered as if you put a connector on the FRONT side of the board.
Most people put the pins out the backside. As a result, what you think is pin #1, really isn't
Check that before you try anything else. If that is the problem (it reverses the odd and even pins), the display is probably destroyed.
Don't ask me how I know all this !
Charles Linquist
Neither did I !!!!Originally Posted by BobK
I learnt the hard way the first time I used the 16F88 and couldnt get some of the pins on PortB to work right![]()
Keith
www.diyha.co.uk
www.kat5.tv
Bookmarks