Blink without the pause command


Results 1 to 9 of 9

Threaded View

  1. #1

    Question Blink without the pause command

    Hi All,

    I want to blink a LED without the pause command because I want to do other things and not stop the entire loop every time the LED blinks.

    For example, with the pause command the code looks like this:

    main:
    high portb.0
    pause 500
    low portb.0
    pause 500
    goto main

    Without the pause command the code could look something like this:

    count_on var byte
    count_off var byte
    pause_led var byte

    count_on = 0
    count_off = 0
    pause_led = 5000

    main:
    if count_on = 0 then
    high portb.0
    endif

    if count_on != pause_led
    count_on = count_on + 1
    endif

    if count_on = pause_led then
    low portb.0

    count_off = count_off + 1

    if count_off = pause_led then
    count_on = 0
    count_off = 0
    endif

    endif

    goto main:

    My question is, if I want to leave the LED turned on for 1 second, how many "if" cycles should I do?

    Thanks!

    Daniel.
    Last edited by DanPBP; - 16th August 2007 at 18:29.

Similar Threads

  1. Delayed output 10 secs
    By lilimike in forum mel PIC BASIC Pro
    Replies: 37
    Last Post: - 14th October 2011, 06:28
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. Replies: 11
    Last Post: - 12th July 2008, 02:36
  4. Fade out LEDs question
    By Sam in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 22nd June 2008, 10:50
  5. Help Quick Need to make code smaller
    By Programmednew in forum mel PIC BASIC Pro
    Replies: 41
    Last Post: - 25th January 2005, 03:46

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