|
|
View previous topic :: View next topic |
Author |
Message |
wavelength
Joined: 21 Mar 2014 Posts: 12
|
PIC16F1829 problem with A0, A1 as inputs? |
Posted: Tue Oct 14, 2014 1:41 pm |
|
|
All,
I have the AC244043 module and have a simple program reading A0, A1 as inputs and acting on them. With the module and the debugger I can read these high and low all day long.
When I set the DEBUG features off (verified in ccsload) and program a part both A0 and A1 are read as 0 all day long.
I have ADC mode set to OFF, and the TRIS for A is read and looks fine in the debugger. I am not even using fast IO.
Any ideas?
Thanks,
Gordon _________________ J. Gordon Rankin
Wavelength Audio, ltd. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 14, 2014 5:59 pm |
|
|
Quote: |
When I set the DEBUG features off (verified in ccsload) and
program a part both A0 and A1 are read as 0 all day long.
|
I assume this means you're programming a normal 16F1829 chip,
not the header, and not the -ICE version. Just a normal PIC.
I did that and it works.
I installed a 16F1829 on a Microchip Low Pin Count board. My board
has a push-button switch added to it, with a 4.7K pullup and the other
side of the switch is connected to ground. So when it's not pressed,
the switch circuit delivers +5v and when it's pressed it gives ground.
I compiled the program below with compiler vs. 5.030 and programmed
the 16F1829 with a PICkit3. I used MPLAB vs. 8.92 as the IDE. I am
running it in Release mode.
I jumpered the switch circuit to Pin A0 of the 16F1829. When I run the
program, the LED on Pin C0 is turned on when the button is not pressed,
and it's off when I press the button. This is correct operation. I also
tested the program with the input pin set to Pin A1. It also works.
Code: | #include <16F1829.h>
#FUSES INTRC_IO, NOWDT, BROWNOUT
#use delay (clock=4M)
//=================================
void main()
{
while(TRUE)
{
if(input(PIN_A0))
output_high(PIN_C0);
else
output_low(PIN_C0);
delay_ms(100);
}
} |
|
|
|
|
|
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
|