PDA

View Full Version : Having problems with I/O ports F & G on 16F946



manta_z
- 16th April 2009, 17:20
Anyone using port F & G as general outputs?

I cannot get these ports to work correctly as general I/O's.

I have set all the LCDSe to 0 (set pins as I/O based on DS)

They always act funny like not really true in/outs.

Some clear some do not, none of them work as inputs etc.

I assuemd it is something to do with the LCD module stuff.

I turned it all off but these ports still acts weird.

I have tried setting bit, seetin whole port, setting tris, setting single tris etc.
Nothing changes.

Can anyone simulate this?

All the other ports and pins work just like expected but wehn I try it on those ports it goes goofy.

ZM

mister_e
- 16th April 2009, 17:35
I don't have this one in stock, but I would try

LCDCON = %01000000

manta_z
- 16th April 2009, 18:07
I don't have this one in stock, but I would try

LCDCON = %01000000

Wow, thanks Mister-E that was a fast response. ;)

DataSheet states:

Once the module is configured, the LCDEN bit of the
LCDCON register is used to enable or disable the LCD
module. The LCD panel can also operate during Sleep
by clearing the SLPEN bit of the LCDCON register.

Are these settings order specific?
Setup other regs. first then set LCDCON (off) etc?


I have all the LCD settings off, but did not try LCDCON = %0100000 as you mentioned. Does it make a difference since I never sleep my pic?
I will try that setting and see what happens.
This is just baffling me to no end.



LVDCON = 0
LCDCON = 0
LCDPS = 0
LCDSE0 = 0
LCDSE1 = 0
LCDSE2 = 0
LCDSE3 = 0
LCDSE4 = 0
LCDSE5 = 0

TRISF = 0
TRISG = 0



Z

manta_z
- 17th April 2009, 01:54
I don't have this one in stock, but I would try

LCDCON = %01000000

Setting that bit did nothing. :(

But I found this out today after some testing.

If I add a micro second delay between any H-L or L-H output on those pins it works fine and no other pins act up.

So I assume there is some internal LCD element charge/time issue on these pins before the data state is valid?

Since any value below 4 micro seconds does weird things on pins and even reboots the pic from time to time.

I also added some delays in the setting of directions (tris) and other settings but that had no effect.

Does this make since, anyone else use LCD pins normally and not have this issue?

Mz

mister_e
- 17th April 2009, 08:56
Can you post your code?

Are you writing to the whole port or some PORT bits here and there?