View previous topic :: View next topic |
Author |
Message |
scanan
Joined: 13 Aug 2004 Posts: 58 Location: Turkey
|
spurious voltage on input pin |
Posted: Wed Jan 16, 2013 3:07 am |
|
|
Hi to everybody,
I am doing a project with PIC18F6310.
my program beginning is as follow
Code: |
setup_wdt(WDT_OFF);
setup_adc(ADC_OFF);
setup_adc_ports(NO_ANALOGS);
setup_vref(FALSE);
setup_psp(PSP_DISABLED);
setup_spi(SPI_SS_DISABLED);
//setup_timer_0(RTCC_INTERNAL|RTCC_DIV_8|RTCC_8_BIT);
setup_timer_1(T1_DISABLED );
setup_timer_2(T2_DISABLED, 0xFF, 0x10);
setup_timer_3(T3_DISABLED);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_low_volt_detect(LVD_21);
setup_oscillator(OSC_16MHZ);
set_tris_a ( 0xFF );
set_tris_b ( 0xFE );
set_tris_c ( 0xC1 );
//set_tris_c ( 0x81 );
set_tris_d ( 0xFF );
set_tris_e ( 0xFF );
set_tris_f ( 0xFF );
set_tris_g ( 0x04 );
clear_interrupt(int_LOWVOLT);
clear_interrupt(int_ext1);
|
Most of my ports are defined as input and pulled down with 4K7 resistors.
When an input except PIN_A0 is set HIGH, a voltage about 0.2V or more sometimes is measured on PIN_A0. As I set more inputs to HİGH, the voltage increases on PIN_A0 until it makes PIN_A0 be detected HIGH. What could be the problem?
thx |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Wed Jan 16, 2013 8:42 am |
|
|
I'm afraid it is not at all clear what you are seeing/saying.
'set HIGH'. If you set a pin high, then you are making it an output, not an input.
Are you sure your '4K7 resistors' go back to the same ground point you are using for your voltage measurements?.
It sounds to me as if you are perhaps using a rather resistive breadboard, and when pins go high they start pulling 'up' the common point to which the pull-down resistors are attached.
Best Wishes |
|
|
scanan
Joined: 13 Aug 2004 Posts: 58 Location: Turkey
|
|
Posted: Thu Jan 17, 2013 1:37 am |
|
|
All pin defined as input are pull DOWN with 4K7 resistor.
when these input ARE CONNECTED TO +5vOLT EXCPET pın_a0 which nothing is connected just doing measyrment on this pin. I measure some voltage however I should measure 0 volt because it is pulled down. |
|
|
scanan
Joined: 13 Aug 2004 Posts: 58 Location: Turkey
|
|
Posted: Thu Jan 17, 2013 1:38 am |
|
|
Ttelmah wrote: | I'm afraid it is not at all clear what you are seeing/saying.
'set HIGH'. If you set a pin high, then you are making it an output, not an input.
Are you sure your '4K7 resistors' go back to the same ground point you are using for your voltage measurements?.
It sounds to me as if you are perhaps using a rather resistive breadboard, and when pins go high they start pulling 'up' the common point to which the pull-down resistors are attached.
Best Wishes |
All pin defined as input are pull DOWN with 4K7 resistor.
When these input ARE CONNECTED TO +5volt EXCEPT pın_a0 which nothing is connected just doing measurement on this pin. I measure some voltage however I should measure 0 volt because it is pulled down. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19535
|
|
Posted: Thu Jan 17, 2013 2:35 am |
|
|
Repeat the same comment. The fault is almost certainly a wiring problem outside the PIC. Unplug it, and repeat the test.
Best Wishes |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Jan 17, 2013 2:47 am |
|
|
Can I add.
Measure the impedances to all grounds with, or without, the PIC in place.
Mike |
|
|
|