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 support@ccsinfo.com

PIN_A4 always 0

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








PIN_A4 always 0
PostPosted: Mon Feb 02, 2009 3:36 am     Reply with quote

Hi.

What's wrong in this test program?

I am externally switching A4 low-high etc, but code always reads 0, and prints 0. RS232 is working fine as A0 for example with same test works as it should.

Is there something special about A4? I am using PIC16F687. Compiler 4.074.

Thanks. D.

Code:

#include "16F687.h"

#device adc=10
#FUSES NOWDT
#FUSES INTRC
#FUSES NOPROTECT
#FUSES NOBROWNOUT
#FUSES NOFCMEN
#FUSES NOCPD
#FUSES NOPUT

#use delay(clock=4000000)
#use rs232(baud=9600,parity=N,UART1,bits=8)

#define LED  PIN_C4

void main()
{
   BYTE test;

   setup_uart(1);
   delay_ms(5);

   do
   {
      delay_ms(1);
      test = input(PIN_A4);
      putc(test);
      if (test)
         output_high(LED);
      else
         output_low(LED);
   }while (1);
}
Ttelmah
Guest







PostPosted: Mon Feb 02, 2009 4:12 am     Reply with quote

Look at section 3.1 of the data sheet. What does it say RA4 is used for, when you are using the internal oscillator?. What is the difference between the INTRC fuse, and the INTRC_IO fuse?....

Best Wishes
Guest








PostPosted: Mon Feb 02, 2009 2:28 pm     Reply with quote

Many many thanks. I keep reading the data sheet over and over, and have it open all the time. but little details always get you if you are inexperienced like me. Thanks again
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