|
|
View previous topic :: View next topic |
Author |
Message |
Guest
|
PIN_A4 always 0 |
Posted: Mon Feb 02, 2009 3:36 am |
|
|
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
|
|
Posted: Mon Feb 02, 2009 4:12 am |
|
|
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
|
|
Posted: Mon Feb 02, 2009 2:28 pm |
|
|
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 |
|
|
|
|
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
|