odd pic problem on 18f6723

Discuss PIC and electronic related things

Moderators: David Barker, Jerry Messina

Post Reply
richardb
Posts: 307
Joined: Tue Oct 03, 2006 8:54 pm

odd pic problem on 18f6723

Post by richardb » Wed Nov 04, 2009 9:57 am

Hi maybe someone con help me with this odd problem.

I've been using a 6723 recently and all's been fine except for one problem, I'm using port B.6 to drive a fet to turn on a relay on a board and all is ok just after i program the pic but if i cycle the power it wont work, I've tried pulling the output high with a resistor but the output seems to be driven low permanently.

ps

I've tried this with 2 different main pcb's
pic is on a 40pin dil header and i've tried 2 different 6723 pics in the same pcb without luck.
But if i replace the 6723 with a 4550 then everything works fine.


Any suggestions?
Hmmm..

richardb
Posts: 307
Joined: Tue Oct 03, 2006 8:54 pm

grrr

Post by richardb » Thu Nov 05, 2009 2:09 pm

ok so i fixed the problem..... but it seems like a compiler bug

i removed all places in my code where i set the output low and

left the place where i set it high and the output still wouldn't come on.

but if i moved the portb.6 = 1 to just before the main code it would work.
Hmmm..

Jon Chandler
Registered User
Registered User
Posts: 185
Joined: Mon Mar 10, 2008 8:20 am
Location: Seattle, WA USA
Contact:

Post by Jon Chandler » Thu Nov 05, 2009 5:48 pm

One thing I found recently......

If you use a variable name as a port pin:

dim LED as PORTB.0


and then do something like:

LED = 1

LED = 0

You won't see any change on the port pin.

If you add a lin near the top of the program:

HIGH (LED)

or

LOW(LED)

the above works fine.

I believe the added HIGH or LOW command makes PORTB.0 (in this case) an output.

Jon

rmteo
Posts: 237
Joined: Fri Feb 29, 2008 7:02 pm
Location: Colorado, USA

Post by rmteo » Thu Nov 05, 2009 8:09 pm

Jon, have you tried:
dim LED as LATB.0

before using:
LED = 1
LED = 0

Post Reply