Use a switch by change not on/off status.


Results 1 to 17 of 17

Threaded View

  1. #14
    Join Date
    Jun 2005
    Location
    Up the bush, Western Plains, NSW Au
    Posts
    216


    Did you find this post helpful? Yes | No

    Default Re: Use a switch by change not on/off status.

    I have used the following on a few occasions quite successfully:

    Lets say the switch is on portc.3

    SW VAR PORTC.3




    WHILE SW = 0 : WEND 'THIS WILL CONTINUALLY LOOP AS LONG AS THE INPUT IS LOW, MAKE IT SW = 1 TO DETECT
    'GOING LOW.
    ' ASSUMES THAT ALL YOU ARE DOING IS WAITING FOR A SWITCH CHANGE
    'ACCORDING TO THE MANUAL THIS LOOP CHECKS ABOUT 50 TIMES A SECOND
    'SO IT SHOULD SEE THE CHANGE WITHIN 1/50 OF A SECOND.

    DO SOMETHING HERE 'THIS IS WHAT YOU WANT TO DO AT THE SWITCH CHANGE
    Last edited by muddy0409; - 22nd November 2014 at 12:16.
    Peter Moritz.
    Up the bush, Western Plains,
    New South Wales,
    Australia.

Similar Threads

  1. Toggle switch (latching switch) state
    By craigwb in forum General
    Replies: 4
    Last Post: - 6th November 2011, 14:18
  2. Switch sensor vs. switch PIC pin
    By fratello in forum Schematics
    Replies: 10
    Last Post: - 4th August 2011, 11:17
  3. Interrupt status?
    By circuitpro in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 28th February 2011, 01:27
  4. Replies: 6
    Last Post: - 9th January 2011, 15:26

Members who have read this thread : 0

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