trouble with FLAGs


Results 1 to 6 of 6

Threaded View

  1. #2
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Try something like this.
    Code:
    IF Switch = 0 Then
        Flag = ~Flag           ' Invert Flag bit
        WHILE Switch = 0   ' Wait for button release
        WEND
    ENDIF
    This allows your Switch test routine to control toggling the Flag bit + Switch debounce. Then do whatever you need afterwards based on the Flag bit logic state.

    Note: Be sure to use a pull-up on your Switch input, and release the Switch quickly to avoid hanging in the test routine or odd results with a floating input.
    Last edited by Bruce; - 9th November 2004 at 22:07.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. trouble with microcode loader
    By meho in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th August 2012, 15:39
  2. LCD issue - what does FLAGS = 0 really do?
    By BrianT in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th February 2008, 06:26
  3. Trouble using int. osc. On 18f2455
    By KPDes in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th June 2007, 11:35
  4. set flags within a variable?
    By peterdeco1 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 24th October 2006, 12:07
  5. 16f876 PortA set-up trouble?
    By ronjodu in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th February 2006, 20:31

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