View previous topic :: View next topic |
Author |
Message |
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
18F2520 pin B0 not responding??? |
Posted: Fri Nov 28, 2008 7:47 am |
|
|
Hello every body,
I've got a weird issue with the portB pin 0 of the 18F2520.
I cannot have a low level on this pin.
This pin is connected to a 4.7k pull-up and I've check for short.
the code is very simple:
Code: | void main()
{
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF|ADC_TAD_MUL_0);
setup_spi(SPI_SS_DISABLED);
setup_wdt(WDT_OFF);
setup_timer_0(RTCC_INTERNAL);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab
// TODO: USER CODE!!
while(1)
{
#asm
nop
nop
#endasm
output_low(PIN_B0);
#asm
nop
nop
#endasm
}
} |
Registers after execution (debugging with ICD-U40):
TRISB = 0xFE,
LATB = 0xFE,
PORTB = 0x1F ???
Why does the PORTB register keep b0 set?
Is there a special function for this pin that I haven't seen in the datasheet?
Thanks for any help.
Franck.
PCD 4.083. |
|
|
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
|
Posted: Fri Nov 28, 2008 9:04 am |
|
|
Hi,
I think I found the problem: pin B0 dead on both 18F2520 that I was tested...
Stupid mistake ,sorry about that.
Franck. |
|
|
Wayne_
Joined: 10 Oct 2007 Posts: 681
|
|
Posted: Fri Nov 28, 2008 9:11 am |
|
|
Sure your not using #use fast_io
As you have left out the #use statements from your listing we cannot tell. |
|
|
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
|
Posted: Fri Nov 28, 2008 9:34 am |
|
|
I was not using the fast io, I checked the asm code to be sure.
I have changed the micro and it's working now.
Thanks,
Franck. |
|
|
|