Blink without the pause command


Closed Thread
Results 1 to 9 of 9

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    I agree with Dave. But the approach to take really depends on what it is you need to do in
    between the LED on\off periods, how long the LED should be on AND off, the oscillator speed,
    and which PIC you're using.

    Trying to work out the number of if-thens between toggling the LED on or off isn't a very
    good approach, since the time will vary as your code in between the on\off periods will
    change, and require recalibration with every change.

    More information would really help folks here to help you..;o}
    Regards,

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

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Another way would be to use a timer module.

    You can check the timer overflow bit and increment a variable at each overflow.

    Then, you can ON and OFF the LED at any desired time using this variable.


    --------------------
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  3. #3


    Did you find this post helpful? Yes | No

    Default

    I'm using a pic 12F683 (internal oscillator) to turn on/off some lights on my R/C car...

    I'm reading the output from the receiver with pulsin and then I can turn on/off the lights...

    I'm using the pwm output to control the stop lights... Normally, they are 50% lit and when I hit the brakes they go 100% brightness...

    Also, I want to blink two yellow LEDs as turn lights, but I cannot wait while the LEDs are blinking because I need to know if something else happens, like hitting the brakes....

    So, that's why I wanted to know how to blink the LEDs without the pause command...

    I think I could do something with the "ifs", but as you said Bruce, will have to recalibrate the code...

    Thanks for your answers!

    Daniel.

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


    Did you find this post helpful? Yes | No

    Default

    I would go with Darrel Taylors' instant interrupts with timer1. Disable interrupts before using
    PULSIN. Then re-enable them after PULSIN. A few mS either way shouldn't be a big deal for
    a heart-beat type LED on/off.
    Regards,

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

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


    Did you find this post helpful? Yes | No

    Lightbulb

    Hi, Daniel

    the easy way with R/C signals ...

    the servo signal is THE "missing timer" ... say the 1.5 ms is @ 40 Hz ( example )

    if you want to blink @ 2Hz ...

    just count the incoming 1.5 ms pulses and TOGGLE the led output for COUNT // 10 = 1,or 2 ... but not 0

    takes very little CPU time.

    hé,hé ...

    Alain
    Last edited by Acetronics2; - 17th August 2007 at 08:53.
    ************************************************** ***********************
    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 " !!!
    *****************************************

Similar Threads

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