Its not in backwards. I know it can happen, Ive done it pleanty of times myself. Usually i put it in the programmer the wrong way. This is definately correct though. I am using the OSC1 and OSC2 pins for a 3 pin resonator (20MHz). MCLR is being used as MCLR. I dont see any options to use it as an I/O pin on this chip. It has a 10K resistor to VDD.
CMCON doesnt make much sense to me but that only seems to affect portA. My Code tested portD by turning 2 outputs on and off alternately. mister_e's code tests both portA and portB. I had trouble with portA before but at least portB worked. The only thing i see about portD is that it can act as a parallel port. The datasheet says trisE.4 must be set to enable "PSPMODE" but its default value is 0 so portD should be working as normal I/O pins.
The values of portD are unknown at startup. Usually that means the LEDs i have connected will flash sometimes when the PIC powers up. This time there not doing. Its like the chip is never turning on. I thought there might be a problem with my breadboard so i tested the power pins on the PIC and there is definately power getting there.
Ill have a go with your test code when i get home but for now ill continue reading the datasheet to see if there are any other registers that might affect it
Bookmarks