[SOLVED !] Simple timer


Yesterday 08:38
Forum: Proton Studio
Starter: johngb
Views: 0
Replies: 2
Closed Thread
Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: Simple timer318 days old

  1. #1
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    1 Not allowed!

    Default Simple timer

    Iam making a simple timer for 60 seconds with setpoint.suppose if I set 45 then timer start with a pulse and when I get 0 then timer stop.

    I tried but Iam not able to place set value.
    Pls help.

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,423
    Thumbs Up
    Received: 104
    Given: 25
    Total Downloaded
    5.39 GB

    0 Not allowed!

    Default Re: Simple timer

    Post your code and please explain a bit better what you want.
    Regards

    Joseph

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    0 Not allowed!

    Default Re: Simple timer

    my Code

    Device = 16F877A
    Xtal = 16
    Include "MODEDEFS.BAS"
    All_Digital = True
    Declare LCD_DTPin = PORTB.4
    Declare LCD_RSPin = PORTB.2
    Declare LCD_ENPin = PORTB.3
    Declare LCD_Interface = 4
    Declare LCD_Lines = 4
    Declare LCD_Type = 0

    Dim onn As Byte

    TRISA=1
    TRISC=%11111111
    TRISB=0
    TRISD=%11111110
    TRISE=0

    main:

    If onn=0 Then PORTB.1=0 ;relay on
    If onn < 0 Then PORTB.1=1 ;relay off
    DelayMS 1000
    If PORTD.7=1 Then onn=onn-1 ;timer start decreasingly when d.7 is high
    If PORTD.6=1 Then onn=onn+1 ;set point


    Print At 1,1,"IN=",Dec0 onn," "

    GoTo main

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    0 Not allowed!

    Default Re: Simple timer

    Lcd should display INJ=60 .suppose by button I set 60 to 45 .now by an input pulse timer starts 44,43,42,41,40.....till zero .when it reaches 0 then a relay should on.After on an input pulse will be given to make timer to reset to 45 again and relay to off position again.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  9. #5
    Senior Member tumbleweed's Avatar
    Join Date
    May 2011
    Posts
    455
    Thumbs Up
    Received: 84
    Given: 0
    Total Downloaded
    243.13 MB

    0 Not allowed!

    Default Re: Simple timer

    Code:
    Dim onn As Byte
    
    If onn < 0 Then PORTB.1=1 ;relay off
    A 'byte' is unsigned, so it can never be negative (< 0)

    If you subtract 1 from a byte that's = 0 you'll get 0xff (255)

  10. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  11. #6
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    0 Not allowed!

    Default Re: Simple timer

    Sorry it's equal to = sign

  12. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  13. #7
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,276
    Thumbs Up
    Received: 33
    Given: 7
    Total Downloaded
    704.64 MB

    0 Not allowed!

    Default Re: Simple timer

    Hi,
    I dont think you need the 0 (Dec0)

    I think you also need to have
    If PORTD.7=1 and onn > 0 Then PORTB.1=0 ;relay on 'only turn relay on if start is on and timer greater than zero
    If onn = 0 Then PORTB.1=1 ;relay off
    andIf PORTD.7=1 and onn > 0 Then onn=onn-1 ;timer start decreasingly when d.7 is high
    if you do not have the and condition onn > 0 it will roll over to 255 and the timer will start again

    You could simplify it to
    If PORTD.7=1 and onn > 0 Then
    PORTB.1=0 ;relay on 'only turn relay on if start is on and timer greater than zero
    Dec onn
    Else
    PORTB.1=1 ;relay off
    Endif

    Regards,
    Bob


    Last edited by RGV250; 11th October 2018 at 21:22.

  14. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  15. #8
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    0 Not allowed!

    Default Re: Simple timer

    Giving error 'incorrect else'

  16. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  17. #9
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    1 Not allowed!

    Default Re: Simple timer

    Dear Bob,
    I also need an end condition when timer reaches 0.it do not start again.if I want to start again then input pulse will be given again.

  18. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  19. #10
    Member amod's Avatar
    Join Date
    Mar 2018
    Posts
    111
    Thumbs Up
    Received: 105
    Given: 5
    Total Downloaded
    10.35 MB

    2 Not allowed!

    Default Re: Simple timer

    Dear Bob,
    Timer maximum time is 60 sec.setpoint can be between 0 to 60 sec.if I set 45 then each time timer start from 45 sec till it reaches 0.when it reaches 0 then relay should start.

  20. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. simple timer query
    By staffstony in forum Proton Plus Compiler v3
    Replies: 4
    Last Post: 18th July 2008, 09:11
  2. How to turn 8-bit timer into 16-bit timer?
    By HelpMe! in forum Proton Plus Compiler v3
    Replies: 6
    Last Post: 29th October 2007, 20:08
  3. Timer example
    By smclark in forum The Lounge
    Replies: 8
    Last Post: 6th September 2007, 17:04
  4. Timer
    By FabioPedro in forum The Lounge
    Replies: 5
    Last Post: 9th June 2007, 21:49
  5. simple second timer
    By crankshaft in forum Proton Plus Compiler v3
    Replies: 17
    Last Post: 27th May 2007, 01:14

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts