Best way to find a rising edge?


Results 1 to 5 of 5

Threaded View

  1. #1
    jcsquire's Avatar
    jcsquire Guest

    Default Best way to find a rising edge?

    Hi,

    My first post here! Seems like a great forum; glad to be a member. I need to know when an input pin sees a 0-5V transition (must do with several pins; don't want to use interrupts).

    In C I'd do it this way:
    byte old, nowHigh;
    old = pin_in; // set old as the old value of the pin
    pause 10
    nowHigh = pin_in & !old; // set nowHigh if it is now high but used to be low

    My newbie questions:
    1) In PBP is it smarter to use BIT variables to do this?
    2) How do I get the NOT operator (! in C) in PBP? Or do I have to do something like
    nowHigh = (pin_in==1) AND (old==0) ?

    And what kind of variable is nowHigh = (pin_in==1) AND (old==0) anyway? Is it a BIT since pin_in is a bit, or if nowHigh is a BYTE is it automatically typecast to a BYTE?

    Thanks for shedding any light on this!

    - Jim
    Last edited by jcsquire; - 31st May 2006 at 05:53.

Similar Threads

  1. mS Timer
    By whmeade10 in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th September 2020, 12:12
  2. RC Servo decoding/encoding using 12F683
    By ScaleRobotics in forum Code Examples
    Replies: 13
    Last Post: - 14th September 2010, 00:49
  3. Interrupt On both (Rising and Falling)
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 12th March 2008, 14:34
  4. 2 interupts - portb.0 rising and falling edges
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th July 2005, 01:10
  5. Replies: 2
    Last Post: - 5th June 2005, 19:55

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts