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!!!
 

cristi7521

Member level 2
Joined
Nov 14, 2005
Messages
50
Helped
5
Reputation
10
Reaction score
0
Trophy points
1,286
Activity points
1,529
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

z01z

Junior Member level 2
Joined
Oct 10, 2004
Messages
24
Helped
7
Reputation
14
Reaction score
0
Trophy points
1,281
Activity points
150
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

dilraj.n

Advanced Member level 4
Joined
Feb 2, 2007
Messages
105
Helped
14
Reputation
28
Reaction score
7
Trophy points
1,298
Activity points
1,730
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.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top