PDA

View Full Version : Problems with PORTD on 18F658



blainecf
- 13th June 2006, 16:59
Greetings all you brain trusts!

Using the 44pin PLCC version of this chip to control a bank of relays.

Thought I did all the standard stuff; all the relays hooked to PORTB worked as expected, none of the relays hooked to PORTD worked.

However, when I changed the code to:

OUTPUT PORTD.7

...

HIGH PORTD.7

the relays work just fine.

Previously, I was using TRISB and TRISD, then setting the individual ports on or off using PORTD.7 = %1, which worked on PORTB but not on PORTD. (Syntax was identical)

Any ideas?

schu4647
- 13th June 2006, 17:15
I am by far an expert at this stuff and I have never used this particular chip, but when I do an A to B comparison of Ports B and D the only difference seems to be PSP. Looking at page 153 of the datasheet it says that you need to set bit 4 of the PSPCON register to 0 to make it general IO. Did you do this? It may be that way by default. I would try PSPCON=%00000000.

blainecf
- 13th June 2006, 17:27
Proving once again, it's not what you know, but whether you have access to a (literate) genius.

Worked great!

schu4647
- 13th June 2006, 17:32
That is the new rule I live by come 2 days ago. Whenever IO doesn't work right I probably didn't set a register right.