electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

pic16f676 mclr input problem


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> pic16f676 mclr input problem
Author Message
faraz101



Joined: 07 Mar 2007
Posts: 97
Helped: 2


Post25 May 2008 3:58   

pic16f676 mclr input problem


guys i am using mclr pin of pic 16f676 as input.but it is not working here is my code please help me.


#include "D:\PIC16F676 UPS\CODE\mclr2\mclr.h"
#define SWITCHON PIN_A3
#define MAIN_LED PIN_C0

void main()
{

setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_comparator(NC_NC);
setup_vref(FALSE);

while(1)
{
if(input(SWITCHON))
{
output_low(MAIN_LED);
delay_ms(1000);
output_low(MAIN_LED);
delay_ms(1000);
}
else
{
output_low(MAIN_LED);
delay_ms(500);
output_low(MAIN_LED);
delay_ms(500);
}
}
}
Back to top
photonix



Joined: 15 Mar 2005
Posts: 46
Helped: 4


Post25 May 2008 4:06   

Re: pic16f676 mclr input problem


Have you correctly set the config bit yet??
Back to top
faraz101



Joined: 07 Mar 2007
Posts: 97
Helped: 2


Post25 May 2008 4:36   

pic16f676 mclr input problem


yes when i upload the hex file in melabs programming software it shows that mclr is input.
i am using ccs compiler and in project wizard i have set mclr as i/o pin.
thanx
Back to top
Google
AdSense
Google Adsense




Post25 May 2008 4:36   

Ads




Back to top
laktronics



Joined: 06 Jan 2007
Posts: 945
Helped: 156


Post25 May 2008 6:10   

Re: pic16f676 mclr input problem


Hi,
Why you are writing twice Output_Low, one of them should have been Output_high ? No need to set TRIS?
Regards,
Laktronics
Back to top
gebepic



Joined: 23 May 2008
Posts: 49
Helped: 6
Location: The Universe


Post25 May 2008 12:32   

pic16f676 mclr input problem


Config word
3 1 c 4 normal Means pin RA3 can be used as input
3 1 e 4 used as reset can be used ONLY as RESET

I tried to figure out your C and I undertood (maybe WRONGLY) that you use RA3 as an IO pin,in this case Config word should be 3 1 C 4 or 11 0001 1100 0100 B

gebepic.
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> pic16f676 mclr input problem
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
PIC16F676 Kit input problem (3)
pic's mclr pin problem. (14)
ICD2 Clone MCLR problem (5)
PIC16f676 Intenall Oscilator problem. (12)
PIC16F676 (5)
MCLR in PIC16F88 (5)
mclr/vpp (7)
PIC16F676 on breadboard (3)
C template for PIC16F676 (4)
Voltage on AN0 of PIC16F676 (6)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS