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

Interrupt stop when multimeter on pin

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



Joined: 23 Apr 2013
Posts: 3

View user's profile Send private message

Interrupt stop when multimeter on pin
PostPosted: Tue Apr 30, 2013 11:59 am     Reply with quote

Hi all!

I want to receive an irda signal, and put out to 2 output pin (16F628).
The LED pin flashing correctly when data comes , but when I measure with a multimeter(1Mohm res) on the PIN_A1, the LED stop flashing.
PIN_A1 not changed.
(I try with 10kohm pull up resistor too in PIN_A1)
(I try another pin too)

Why?

I copy a code from here: http://www.ccsinfo.com/forum/viewtopic.php?t=44113

I use 16F628 and 16f688 pic, but the same.

Code:
#include <16F628.h>

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES INTRC_IO                          //High speed Osc (> 4mhz for PCM/PCH) (>10mhz for PCD)
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O

#use delay(clock=4000000)

#define LED PIN_B4
#define DELAY 1000

#use FIXED_IO(A_outputs=PIN_A1)
int1 a[58]={}; //array for storing the complete stream     
int flag=0,state,i;


#int_TIMER0                                     
void timer0_interrupt(void)   
{                                                           
  set_timer0(65258);//value of T i-e 444 us                               
  if(!input(PIN_A2))                             
  {
    a[state]=0;//store 0 in array
    state++;   //increament the postion 
    output_high(LED);
   
  }
  else if(input(PIN_A2))
  {
    a[state]=1;//store 1 in array
    state++;   //increament the postion
    output_low(LED);
    output_low(PIN_A1);
  }       
  if(state>=58)//if stream is complete then disable the timer 0
  {
    state=0;
    flag=1;
   
 

  }
}             


#int_EXT                                 
void isr_ext(void)       
{                                                       
  flag=0;                                                                     
  set_timer0(65397);//value of 1/2T i-e 222 us
  enable_interrupts(INT_TIMER0);
}   
//!
//!
void main()
{
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1|RTCC_8_bit);

  ext_int_edge(2,H_TO_L);//when interrupt goes high to low (falling edge)     
  enable_interrupts(INT_EXT);//enable int2                                         
  enable_interrupts(Global); //enable global interrupts             
 

   while(true)                                 
  {                   
    if(flag==1)           
    {           
      disable_interrupts(INT_TIMER0);
       
      for(i=0;i<58;i++)
      {                     
     
       
      }                   
      flag=2;               
    }
  }
   

}
Confused

10kohm pull up on MCLR, 100nF and 100uF between VDD, Vss. On solderless breadboard.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Apr 30, 2013 1:22 pm     Reply with quote

Quote:
set_timer0(65397);
set_timer0(65258);

Timer0 is an 8-bit timer in the 16F628. The maximum count it can hold is 255.

Quote:
ext_int_edge(2, H_TO_L);

16F628 only has one external input pin (not 3). Therefore, the parameter
of "2" does nothing.


Quote:
but when I measure with a multimeter(1Mohm res) on the PIN_A1, the LED stop flashing

It could be a static electricity issue. Put one hand on a good earth ground
(for example, a screw on the back of your PC), and then use the other
hand to hold the multimeter.
huhu



Joined: 23 Apr 2013
Posts: 3

View user's profile Send private message

PostPosted: Wed May 01, 2013 7:25 am     Reply with quote

Thank you PCM programmer for the corrections.
It may be an electrical noise, this is the very first time that I use solderless breadboard.
Idea
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Wed May 01, 2013 11:35 am     Reply with quote

Quote:
It may be an electrical noise, this is the very first time that I use solderless breadboard.

I hope you've remembered to fit HF decoupling caps as close as possible to the power supply pins on the PIC.

Mike
huhu



Joined: 23 Apr 2013
Posts: 3

View user's profile Send private message

PostPosted: Sat May 04, 2013 2:59 am     Reply with quote

Yes, i did.
I found lot of complaints that the solderless breadboard is so noisy.
Thanks for replies.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat May 04, 2013 3:09 am     Reply with quote

huhu wrote:
I found lot of complaints that the solderless breadboard is so noisy.

I've used them for donkey's years.
I think they're brilliant up to low MHz.
You have to be careful with layout, shielding is difficult, but can be done.
Use very short leads, neat wiring, plenty of decoupling.

Mike
Ttelmah



Joined: 11 Mar 2010
Posts: 19439

View user's profile Send private message

PostPosted: Sat May 04, 2013 3:32 am     Reply with quote

Ignoring the breadboard, a multimeter lead can always cause problems. This is like attaching a three foot or so aerial to a pin. Depending on what else is radiating signals nearby, with the diode structures in the PIC input, this can effectively form a radio receiver.....

Best Wishes
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Sat May 04, 2013 4:43 am     Reply with quote

You can mitigate the aerial effect with a resistor (100R to 10k).
Connect one end close to the pin under test, and the other to the meter lead.

Mike
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