CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PIC16F1829 problem with A0, A1 as inputs?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
wavelength



Joined: 21 Mar 2014
Posts: 12

View user's profile Send private message

PIC16F1829 problem with A0, A1 as inputs?
PostPosted: Tue Oct 14, 2014 1:41 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Tue Oct 14, 2014 5:59 pm     Reply with quote

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);
  }


}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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