 |
 |
View previous topic :: View next topic |
Author |
Message |
developer
Joined: 13 Jul 2017 Posts: 4
|
18F67K40 PIN_B0 input problem |
Posted: Sun Nov 04, 2018 11:15 am |
|
|
hi,
I designed circuit and i use pin_b0 pin input, but it it not working.
Circuit: Input terminal is 24V, voltage divider(22k - 4k7), 5v1 zener => pin_b0 input. I measure input terminal is 24V but pin_b0 voltage is 0.7V and it does not change. I use set_tris_b(0xFF); and test code
Code: |
if(input(pin_b0) == 1)
{
output_high(led);
}
else
{
output_low(led);
} |
I testing and led is low. help me pls. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19792
|
|
Posted: Sun Nov 04, 2018 12:30 pm |
|
|
If you can, you need to rule out your hardware. If the chip is socketted, remove it, and see if the pin goes high when the PIC is not there.
Something silly, like the zener connected backwards would give that behaviour.
In software, if your test is genuinely simple, and just has the chip waking, sets the TRIS, and tests the bit, then there is no reason for the PIC to hold this low.
Obviously if you have more complex code, the possibility does exist that something in the code is setting the pin as an output and pulling it low. This comes down to investigating every instruction that talks to PortB.
There is no peripheral on PortB, other than simple I/O, that can pull the pin low. |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|