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

Reset on IO pin

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



Joined: 20 Dec 2005
Posts: 16

View user's profile Send private message Send e-mail

Reset on IO pin
PostPosted: Fri Mar 18, 2011 7:32 am     Reply with quote

I have a very simple program for PIC16F1824.
Compiler V 4.119

If I set low level on the RA2 pin, the processor resets.

When I delete a row with the settings pull up, it's all okay.

Please, what is wrong ?

Code:

#include <16F1824.h>

#FUSES INTRC_IO                 //Internal RC Osc, no CLKOUT
#FUSES NOMCLR
#FUSES NOWDT                      //Watch Dog Timer
#FUSES NOPUT                      //Power Up Timer
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(clock=16000000)


#zero_ram
void main()
{
     
   disable_interrupts(GLOBAL);
   setup_oscillator(OSC_16MHZ|OSC_INTRC|OSC_PLL_OFF,0);
   setup_adc_ports(ADC_OFF);
   
   // whith this code, procesor reset when RA2 -> 0   
   port_a_pullups(TRUE);
   port_a_pullups(0x04);         // pullup odpor na PIN_A2


   // whith this code, it's O.K.
   // port_a_pullups(TRUE);
   // port_a_pullups(0x04);         // pullup odpor na PIN_A2
   
 
   
   while(TRUE)
      ;
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 18, 2011 11:49 am     Reply with quote

Remove the #zero_ram line. It may be over-writing something.
Also, simplify the program. Remove the setup_oscillator() line.
Change the #use delay() to 4MHz.
Pekub



Joined: 20 Dec 2005
Posts: 16

View user's profile Send private message Send e-mail

PostPosted: Fri Mar 25, 2011 3:50 am     Reply with quote

Thank you for your ideas. I tried them.

I found that this problem is not with the pull up resistor.
The problem is not software but hardware.

Input A2/INT in this chip is very sensitive to noise and interference, what causes a processor reset. I decided to use this pin as an output.
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