PDA

View Full Version : LCDout question



MikeTamu
- 19th August 2005, 02:49
Is there any way I can use the following pinouts with LCDout? I realize that I should use one port and either the upper or lower 4 bits...

RS: Portb.7
R/W: Ground
E: Portb.5
DB4: Portb.4
DB5: Portb.3
DB6: Portb.2
DB7: Portb.1

I'm stuck with a fabricated board that is connected in this manner. Is there any way I can go in and 'edit' in order to get the LCDout command to work with this configuration?

Thanks.

DaveB
- 19th August 2005, 14:27
Allo There,
Yes you can define pins as follows :-

DEFINE LCD_EREG PORTB ' Define enable port
DEFINE LCD_EBIT 1 ' Set up enable bit
DEFINE LCD_RSREG PORTB ' Define register select port
DEFINE LCD_RSBIT 2 ' Set up register select bit
DEFINE LCD_RWREG PORTB ' Define read/write port
DEFINE LCD_RWBIT 3 ' Set up read/write bit
DEFINE LCD_DREG PORTB ' Define data port
DEFINE LCD_DBIT 4 ' Set up data bit
DEFINE LCD_COMMANDUS 2000 ' Set Command Delay Time 2mS
DEFINE LCD_DATAUS 50 ' Set Data Delay Time 50uS

Have just started myself in the last week, got this working with a 16F873A and Powertip PC1602-H LCD module. You'll just need to alter this a bit to match your outputs and put it after any includes.

Cheers

Dave

MikeTamu
- 19th August 2005, 14:37
Thanks, I am aware of the LCD defines. I was actually wondering if I could change each individual data port. For example I don't have the data ports starting on Portb.0, but instead port portb.1. Also, the data ports are in backward order that they are supposed to be corresponding to portb.1,portb.2,portb.3, and portb.4.

So, I need to be able to address each individual data port to a different port than standard. Is this possible?

If not, is it possible to make my own Hitachi commands to do this instead?

Ioannis
- 19th August 2005, 15:08
No you cannot do that. Only select 4/8 bit, and from 4 bits high port or low port bits (that is 0-3 or 4-7).

Ioannis

rhino
- 19th August 2005, 16:14
The LCD may be connected to the PICmicro MCU using either a 4-bit bus or an 8-bit bus. If an 8-bit bus is used, all 8 bits must be on one port. If a 4-bit bus is used, the top 4 LCD data bits must be connected to either the bottom 4 or top 4 bits of one port. Enable and Register Select may be connected to any port pin. R/W may be tied to ground if the LCDIN command is not used. I thought it might have to do with the amount of current the lcd draws and how much the micro can take, but I could be wrong. Looks like you might have to cut some traces, and reroute with with "wires of shame".

MikeTamu
- 19th August 2005, 17:11
Well, I know the hardware (PIC18F252) is capable of running the LCD with my current setup. I designed the board with a Dios 28 pin microcontroller http://www.kronosrobotics.com/xcart/customer/product.php?productid=16169 which is simply a PIC18F252 with a built in Basic compiler in one package. Kronosrobotic's Basic compiler has no problem in allowing any port on the MCU to be used for any pin on the LCD. I have my current configuration working in front of me with the Dios 28 mcu.

However, for economic issues, I wanted to be able to switch to PBP. So, if the hardware permits my configuration, why doesn't PBP allow it? I assume MElabs wants a robust compiler, so I am not sure why there is not provisions in the compiler to allow LCD pin switching on permitting PICs.

I guess I will have to write my own Hitachi LCD interface. I don't know what other options I have at this point.

NavMicroSystems
- 19th August 2005, 17:38
MikeTamu,

PBP does allow it,
but you'll have to write your own "LCDOUT" Routine.

See this thread (http://www.picbasic.co.uk/forum/showthread.php?t=1674&page=1&pp=20&highlight=lcd%2A)

MikeTamu
- 19th August 2005, 18:13
Thanks, somehow I missed this thread in my search.

Thinking more on the matter I found a solution that has been glaring me in the face this whole time. I can just edit some wires on the cable going to my lcd screen, and thus rename ports. Luckily I happen to get at least the upper 4 bits of portb on my interface.

However, I am still interested in making a user friendly 'all-in-one' lcdoutX routine for future problems if they come up.

NavMicroSystems
- 19th August 2005, 18:53
...However, I am still interested in making a user friendly 'all-in-one' lcdoutX routine for future problems if they come up.

Well, if it just a single shot (on an existing board) I would spend $2 and use another PIC as "serial backpack" for the LCD. (and free up some PIC Pins)
Or rewire some pins.

If we are talking about higher quantity I would design the Hardware to meet the requirements of my development tools in the first place.

MikeTamu
- 19th August 2005, 22:11
Correct.

Unfortunately, I was not introduced to PBP until after this board was designed. The board was designed with a 3rd party brand microcontroller which is a repackaged PIC.

It is low quantity and I have learned a valuable lesson here. I think for now a cable fix will suffice.