rising edge in "C"

Status
Not open for further replies.

btminzon

Full Member level 2
Joined
Jun 12, 2006
Messages
122
Helped
9
Reputation
18
Reaction score
1
Trophy points
1,298
Location
Brazil
Activity points
2,140
Hi folks. I started learning MSP430 from TI, and i need to detect the rising edge (0 to 1) in a port. How can i do that? my project is in C, but asm also it´s ok. Thanks for help
 

The most accurate way is to use an interrupt. Some ports can be configured to generate an interrupt on either edge. When the transition occurs, the program branches immediately to your interrupt handler.

Another way is to poll the input. This way you have a loop running that simply checks the state of the pin continuously and branches to your handler when the transition occurs. This may be difficult to get accurate timing if your program needs to do other things while waiting for the transition.

You can use a scheduler to spawn off a task that only monitors the input pin. You will need a RTOS or Scheduler running to do this - ie. commercial libraries. Then you can run another application that is virtually independently of the input monitor.
 

    btminzon

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

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…