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.

Edge detector in PIC using CCS

Status
Not open for further replies.

boncker

Member level 2
Joined
Dec 9, 2006
Messages
51
Helped
3
Reputation
6
Reaction score
1
Trophy points
1,288
Location
Brazil
Activity points
1,610
Hello guys,

I need to detect an external edge transition input in the PIC 16F877A in the port C4.
Is there any command that detects edge transition in CCS compiler?

Thanks!!!
 

Hello!

You can detect edge transition only if the signal arrive to pin with external interrupt or interrupt on change pin (portB). In this case you can use interrupt function.
If signal comes to pin C4 you can use only pooling.
For reading a input pin you should use if(input(PIN_C4)).......

Cristi
 

    boncker

    Points: 2
    Helpful Answer Positive Rating
I don't know how the ports are called in CCS, but something like this should work.
Code:
while(RC4);
This waits until the pin becomes low, so a falling edge. Use "!RC4" for the other direction.
 

    boncker

    Points: 2
    Helpful Answer Positive Rating
while(input(PIN_C4)); is waiting for a falling edge and
while(!input(PIN_C4)); is waiting for a raising edge
 

    boncker

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top