Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Polling input for continous 50hz signal ?

Status
Not open for further replies.

asking

Full Member level 5
Full Member level 5
Joined
Sep 21, 2010
Messages
279
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,298
Activity points
3,377
Hello,

I need to check continous for 50HZ signal (20ms) on input pin.... how can i use polling ? using mikroc ? i am confused...Actually i have utilized INT port External interrupt for the same but i want another External interrupt to detect the 50HZ signal present or not. So what is the other way if i have already used INT (external interrupt) on PIC16F628A.

Thanks...
 

give both of them to a OR gate for both positive triggered or AND gate for both negatively triggered and give it to the INT pin,
If you got INT then check for the INT using port pins......
 
  • Like
Reactions: asking

    asking

    Points: 2
    Helpful Answer Positive Rating
Just use Timer/counter on capture mode... Make sure your 50Hz is a squre wave I/P......

Yes..Input signal is PWM Square wave... can you throw some more light or any resources how to use capture mode on pic ? actually i am new to it.

Thanks...

- - - Updated - - -

give both of them to a OR gate for both positive triggered or AND gate for both negatively triggered and give it to the INT pin,
If you got INT then check for the INT using port pins......

Dear can you be more clear with part INT using port pins ? which interrupt ? interrupt on change ?
 

Hi you will get the interrupt for both the signals and in ISR check it, wheather It is phase 1 or phase 2 using the port pin inputs

attachment.php
 

Attachments

  • untitled1.JPG
    untitled1.JPG
    10.4 KB · Views: 271

Yes..Input signal is PWM Square wave... can you throw some more light or any resources how to use capture mode on pic ? actually i am new to it.

Thanks...

Look at your datasheet...
CAPTURE/COMPARE/PWM (CCP) MODULE

it'll help you to check the PWM signal...
 

Hi you will get the interrupt for both the signals and in ISR check it, wheather It is phase 1 or phase 2 using the port pin inputs

attachment.php

Which OR Gate IC should i use ? can't i use Normal Diodes for OR conditions ? I tried but results are not good why is it so ? Please suggest some OR gate logic ic.

Thanks
 

PORTB will have four interrupts. See RBIF in datasheet.

Its interrupt on change :( which seems to be hard to me for coding.

- - - Updated - - -

Hi you will get the interrupt for both the signals and in ISR check it, wheather It is phase 1 or phase 2 using the port pin inputs

attachment.php

Guyz,

I am shocked to see ethat 7408 (AND GAte) did not worked :( it should work theoratically. Then i used 7432 (OR Gate) and it worked like charm in above diagram as you shown to use AND Gate but i think i have use Falling edge detector so OR gate is working just like AND Gate function. If any of the beams are broken LED lights up. But i am not able to understand why OR gate is working like and gate for 50HZ PWM Signal ?

Can anyone explain me ?

Thanks
 

hOW TO POLL FOR port Pin 1 and Port Pin 2? As its PWM signal of 50HZ and 50% duty cycle. any idea ? please... i have sucessfully implemented OR gates and i am getting it worked any of two interrupt is generated. But now its time to find from where interrupt generated...so how can i poll PWM signal on input ports ? do i need to pull down those ports using 10K resistor?
 

Hi finaly you got positive edge triggered input OR negative edge triggered input??

Hi Vankadesh,

I have the same old code with RB0/INT for falling edge detection. But i am surprise to see that GATE IC 7432 (OR) Worked instead of 7408 (AND) Gate. Now i have successfully multiplexed the two interrupts and detection is possible if any one of the line is cut. But at the same point i am still not able to find out which IR caused the beam break detection as i am unable to && Condition of input port 1 & input port 2 ? if any of pins are defined as input how can i detect the 50HZ PWM signal ? any code please ? also do i need to pull it down or pull it up ? using 10K resistor ?

Thanks..
 

Use RBIF for port pin 1 and port pin 2. It should also be PORTB pins which support RBIF. Polling will not help.
 
Last edited:
  • Like
Reactions: asking

    asking

    Points: 2
    Helpful Answer Positive Rating
Use RBIF for port pin 1 and port pin 2. It should also be PORTB pins which support RBIF. Polling will not help.

Code:
void interrupt()
{
  // RB Port Change Interrupt
  if(PIR1.RBIF == 1)   // if the RB Port Change Interrupt flag is set...
  {
    x = PORTB;      // Need to read or write to the port to clear mismatch condition
    PIR1.RBIF =0;
  }

}

IN THIS code how can i define that interrupt on change is enabled for which pin ? RB4, RB5, RB6 or RB7 ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top