View previous topic :: View next topic |
Author |
Message |
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
pin output came high |
Posted: Fri Aug 01, 2014 4:02 am |
|
|
hallo i am trying solutions for problem that i have with output pin of 10f206, the problem is that when i give power to pic 3,3v the pin out came high (3,3v) instantly for after became low like i need. This is big problem for me because i need that output pin be always low state when I give power. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Fri Aug 01, 2014 4:16 am |
|
|
You need to put a pull down resistor on the line.
This is a 'read the data sheet' problem.
On the PIC, most pins wake up as inputs. Open circuit effectively. This is done so the PIC will never 'drive' anything when it wakes (the exception are pins on things like 'power PWM' sections, where fuses allow you to program these to be driven high/low). So you need to ensure that your circuitry will always go to the state you want, when undriven.
As soon as you take control of the pins (a few uSec), you can then program the pins to drive the way you want. However it is up to you to ensure that undriven pins will be pulled the way you want before this time. If the pin is going high, then it suggests the circuitry 'pulls high', except when 'driven low'. You need to look at your design and correct this.
The PIC pins will not actively drive, till the power up sequence is completed, and code is running. |
|
|
alan
Joined: 12 Nov 2012 Posts: 357 Location: South Africa
|
|
Posted: Fri Aug 01, 2014 4:28 am |
|
|
This sometimes also happens as the compiler with standard_io set the tris register before writing to the port.
I had a similar problem on a dsPIC.
Had to use fast_io write a low and then set the tris manually.
Regards |
|
|
ferrarilib
Joined: 11 Jun 2005 Posts: 38
|
|
Posted: Fri Aug 01, 2014 7:06 am |
|
|
thanks Ttelmah and alan . the output pin have pull down resistor but is same problem.
So i can try do pin as input for a dalay time ad after do output ? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Fri Aug 01, 2014 9:00 am |
|
|
Do a variant on what alan is saying:
Code: |
#byte PORTB=getenv("SFR:PORTB")
#bit B0 = PORTB.0
#bit B1 = PORTB.1
#bit B2 = PORTB.2
#bit B3 = PORTB.3
//Then for the pin you are using (example on B0)
B0=FALSE;
output_low(PIN_B0);
|
This ensures the output latch is set 'low', before the pin is driven as an output.
Best Wishes |
|
|
|