PDA

View Full Version : PicBasicPro with PICDem2 Plus



DelBoy
- 2nd July 2004, 10:27
Is there anyone able to guide me (the poor novice) through a problem i have using PicBasic Pro and the LCD Display on a PICDEM 2 PLUS development board.
I am just trying to display a simple message, like "hello."
I think i have correctly DEFINEd all of the various port values that correspond to the way the display is connected to the p18F452. The data bits are RD0-RD3 and the control bits RA1-RA3.
If there are any other components in the program, ie. then these work as expected. I have tried many combinations of writing this short program, but the screen still remains blank. The display works fine when programmed using MPLAB assembly code.
I'd be most grateful for any assistance.
Thanks
I've attached the code for anyone who may be interested.

Melanie
- 2nd July 2004, 11:14
Make friends with Datasheets...

Since you've defined Digital Outputs for your LCD across PortA, try setting ADCON1=$07 at the start of your program... and come back and say if it worked...

See Datasheet 17.2 ADCON1 register, then look down at the table setting the PCGF3-PCGF0 bits) to see why. By default this register powers up as all zero's (see Table 4.2 Register File Summary for the POR [Power On Reset] values).

Later on, when you want to play with Analogue Inputs, revisit the PCFG bits of ADCON1 and configure appropriately... (eg you'll probably want to set RA0 as Analogue and the others Digital).

Tip: It's always a good idea to also define the TRIS Registers (TRISA, TRISB, TRISC etc) at the start of your program, whether you're using a particular pin or not. Pins used for LCD can be defined as Outputs. Get in the habit of doing this, as in these early simple stages you can omit them and things might still work, but later they'll bite you if you forget about them and you'll spend countless hours trying to figure why your programs don't work as expected.

DelBoy
- 3rd July 2004, 10:13
Melanie,

Adding ADCON1=$07 has worked, just one small problem though... the text is upside down.
Many Thanks

Melanie
- 3rd July 2004, 16:34
Rotate the LCD, Monitor, Datasheet, back of envelope, etc by 180 degrees clockwise to fix the problem. Rotate anticlockwise if you are in the southern hemishpere (ie South of London). A large crate of beer has been known to solve the problem temporarily. Note, that rotating the PIC in it's socket by 180 degrees usually does not produce the desired result.

DelBoy
- 4th July 2004, 12:44
Hi again,

This must have been one of my many glitches, cos it's all sorted out. I can actually read the text, even without the introduction of the crate of beer. Many Thanks

However, i'm sure i'll be seeking your valuable assistance again. I promise not to pester you too much.

Delboy