Blink LED / toggle output with causing a software delay


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Nov 2009
    Posts
    5

    Default Blink LED / toggle output with causing a software delay

    Hello all - I'm very, very new to this, so please forgive me

    I need to toggle an output @ 2hz (250ms High / 250ms Low etc), when a specific action has been performed, blinking an LED as a visual indicator.

    The PULSOUT command stalls the program routine and for it's entire duration, in in my case, I'd be using a looped PULSOUT GPIO.1,250000

    Is there a way to toggle an output for a fixed ON/OFF period, whilst the program can continue to run, monitoring inputs etc ?

    Many thanks

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Wink

    Hi, Tim

    Welcome aboard ...

    YES there are lots of different ways ...

    BUT ... we , at least, need to know which processor you use and what you already use as resources ...

    Shortly ...

    Your program ALSO is welcome ...

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    967


    Did you find this post helpful? Yes | No

    Default

    timetec

    Think about using the inbuilt hardware timer and its associated interrupt. With this, you can flash leds in the background. But, like Alain says, please tell us more about your selected PIC for this to be meaningful to you

    Welcome aboard

  4. #4
    Join Date
    Nov 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Many thanks for the replies

    The MCU is a 12F629, using all GPIO ports.

    Here's the routine :

    To monitor 2 momentary switch inputs, & enable an output (blinking an LED @ 2Hz), when a switch is pressed.

    There is a seperate O/P for each corresponding switch.

    If both outputs become active, a 3rd output toggles 10 seconds high and then reverts back to a low state -- the LED outputs are then reset.

    All working perfectly, but I'm having to use FLED's on the outputs.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Default

    Hi, Tim

    Sorry, but I do not understand what you want to do or actually do ... :

    Blink outputs WHILE button pressed ?
    Blink @ First press and stop @ second press ?

    You talk about 2 Leds ???
    the LED outputs are then reset.
    ... 2 inputs + 3 outputs + 2 Leds ...

    are more pins than available on the 629 ...

    soooo ... PLEASE : Your program .... so we can understand what you do !

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    Join Date
    Nov 2009
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    5 I/O are used - 2 switch inputs, 2 LED outputs, 1 'reset' output

    Example :

    Switch 1

    Blink LED output IF the Switch 1 has been pressed - keep it blinking @ 2Hz

    If Switch 1 pressed again, keep it blinking ! - exactly the same for Switch 2

    If both LED outputs are active - send 10 second pulse to 3rd output pin.
    Then reset all switches / LED's & start again.

Similar Threads

  1. Conway's Game Of Life
    By wellyboot in forum mel PIC BASIC Pro
    Replies: 45
    Last Post: - 28th May 2020, 06:14
  2. Free Project - 245 LED Display
    By T.Jackson in forum Code Examples
    Replies: 221
    Last Post: - 16th August 2009, 04:59
  3. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  4. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  5. LCD will not start
    By btaylor in forum mel PIC BASIC Pro
    Replies: 49
    Last Post: - 24th May 2007, 02:30

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