View previous topic :: View next topic |
Author |
Message |
bfmitch
Joined: 21 Aug 2004 Posts: 8
|
Need a sanity check |
Posted: Mon Jul 18, 2005 9:52 am |
|
|
Maybe I'm missing something. I'm using a PIC18F452. I'm trying to use bit E2 (which is also AN7 and CS for the PSP) as an input. The problem is, that it always drags down the 5 volt signal it's being fed to about .25 volts.
First I checked the board. Looked at all the traces, etc... and they're just fine. If I remove the PIC chip, the signal doesn't get dragged down. So it must be how I have the PIC intialized.
I set the ADC parameters so that bit is used as a digital IO line and used TRISE to make sure it was an input. No joy.
I disabled the PSP using setup_psp(DISABLED), the signal is still dragged down.
I used TRISE again to disable the PSP and set the IO directions. Still not working.
I tried using output_float to see if I could at least get it to go high impedance. You can guess it didn't work.
Doe E2 perform some function besides the PSP Chip Select and Analog input 7?
I suppose that the chip itself could be the problem. Of course, I won't have another one for a few days.
Any ideas? |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1635 Location: Perth, Australia
|
|
Posted: Mon Jul 18, 2005 10:02 am |
|
|
My guess is you have defined a register address incorrectly.
Here is a section of operational code using the PIC18F452 using PORTE (E2 used as an output)
Code: |
#define PE_DefData 0b00000111
#define PE_DefTRIS 0b00000011 //; USB control
// ; 2 Flush USB FIFO output
// ; 1 USB_RDF USB Read ready flaginput
// ; 0 USB_WRF USB Write ready flag input
setup_adc_ports(NO_ANALOGS);
setup_adc(ADC_OFF);
setup_psp(PSP_DISABLED);
setup_spi(FALSE);
setup_wdt(WDT_OFF);
// .. other unrelated stuff deleted
// initialise port E
output_e(PE_DefData);
set_tris_e(PE_DefTRIS);
|
_________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
bfmitch
Joined: 21 Aug 2004 Posts: 8
|
It's the chip |
Posted: Mon Jul 18, 2005 10:38 am |
|
|
My sample PIC18F4525 just arrived. I already had the fuses, etc... worked out just waiting for it to show up. I programmed the new chip, plugged it in and the problem was gone.
Thanks! |
|
|
|