How to latch an output for a pre-defined time


Closed Thread
Results 1 to 6 of 6
  1. #1

    Default How to latch an output for a pre-defined time

    Hi all

    I'm not sure how to search this one up ...

    1. I would like to have a Port Pin (for example PORTD.1) stay high for a around the same time as a button press (perhaps 500ms)
    OR
    2. have the same data sent 4 times in succession. (maybe a for/next or if then loop with a counter ?)

    I'm not sure how to setup either or which one would be the better one to use.

    Any thoughts or tips would be much appreciated

    Kind regards

    Dennis

  2. #2
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    657


    Did you find this post helpful? Yes | No

    Default

    I'm afraid that you need to explain in more detail what is that you want to do so that people can help you.

    Robert

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Dennis View Post
    Hi all

    I'm not sure how to search this one up ...

    1. I would like to have a Port Pin (for example PORTD.1) stay high for a around the same time as a button press (perhaps 500ms)
    OR
    2. have the same data sent 4 times in succession. (maybe a for/next or if then loop with a counter ?)

    I'm not sure how to setup either or which one would be the better one to use.

    Any thoughts or tips would be much appreciated

    Kind regards

    Dennis
    Hi Dennis,
    For next loop:
    Code:
    Counter_Var Var byte
    MyData Var byte
    
    For Counter_Var = 0 to 3
    serout PortB.0,t9600,[#MyData]
    next Counter_Var
    
    or
     PORTD.1 = 1
    pause 500
     PORTD.1 = 0  '1/2 second on loop then off for keeps
    Last edited by Archangel; - 21st December 2009 at 05:39.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4


    Did you find this post helpful? Yes | No

    Default Hold it !

    :-)
    Joe thanks a million :-)

    Is there a something like a "stay HIGH for " command. For example to make PORTD.1 "stay in a high state for 500 milliseconds" ?

    I have seen command like PUSEUS, PULSEIN, WAIT and so forth, but was just wondering if there is a specific one like LATCH or something like that.

    Keep well

    Dennis

  5. #5
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Use a timer. This way, your PIC can still do stuff instead of just being stuck waiting for the command to be executed.

  6. #6
    Join Date
    Jan 2009
    Location
    Miami, Florida USA
    Posts
    657


    Did you find this post helpful? Yes | No

    Default

    Use a timer like rmteo suggested or you can use PAUSE 500.

    Robert

Similar Threads

  1. 12F629 LDR - Light Dependant Resistor
    By Dennis in forum Schematics
    Replies: 15
    Last Post: - 18th February 2010, 23:33
  2. Errors In MPLAB 8.02
    By HOTLNC in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 4th June 2008, 14:52
  3. Serious Serial Situation Setbacks...
    By Dansdog in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 7th February 2007, 04:46
  4. Serout2/serin2 Pbp Problem
    By SOMRU in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 11th December 2006, 20:55
  5. HSEROUT Newbie question/problem
    By Mark Scotford in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 11th July 2006, 15:44

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