Proton basic compiler PWM


+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 18

Thread: Proton basic compiler PWM1798 days old

  1. #1
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Proton basic compiler PWM

    Hello all I am try to studying Proton Basic compiler..... Now am Stuck... This is my code



    [code]
    Device = 12F675
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON,
    CMCON=7
    ANSEL=0

    XTAL = 4

    Symbol buton=GPIO.0
    Symbol LED=GPIO.1
    cal_1:
    Low LED
    If buton=0 Then GoSub abc: GoTo cal_1
    GoTo cal_1:


    abc:
    high led
    DelayMS 10000
    Return
    End

    [code]

    I need a loop (restart timer )when I press again the switch when the delay time reached....

    Thank you
    Last edited by manojsoorya; 20th October 2015 at 15:54. Reason: unconditional formating

  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
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,826
    Thumbs Up
    Received: 52
    Given: 96
    Total Downloaded
    1.37 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Hi,

    Can you explain again what you want to do, with more detail.

    Thanks
    Tim

  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
    hadv215
    Guest hadv215's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    As far as I can see your code will do just that.
    When GPIO.0 = 0 you start the delay. During that delay pressing the button has no effect. After 'abc' returns you can press the button again.

    The first 'GoTo cal_1' can be deleted.

    Why did you write 'pwm' in the title, what you show us has nothing to do with pwm.

    Regards
    Harm

  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
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Quote Originally Posted by Tim View Post
    Hi,

    Can you explain again what you want to do, with more detail.

    Thanks


    Thank you Tim for your Reply.

    I have a circuit for a delay switch. It has one switch and one LED. The LED will turn ON after pressing the Switch. When the programe reaches the delay time, the LED will turned OFF. In my programme, working Okey, But I want to extend the delay time when I press the switch again before reaching the delay time.

    Thank you..

  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
    Prolific Poster charliecoultas's Avatar
    Join Date
    Sep 2010
    Posts
    1,473
    Thumbs Up
    Received: 51
    Given: 48
    Total Downloaded
    3.45 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Something like this?
    Device = 12F675
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON,
    CMCON=7
    ANSEL=0
    XTAL = 4

    dim timr as byte
    Symbol buton=GPIO.0
    Symbol LED=GPIO.1


    while ‘do it forever
    Low LED ‘led off
    If buton=0 Then GoSub abc ‘led on and and time it
    wend


    abc:
    Timr = 100 ‘100 x 100mS = 10 seconds
    repeat
    high led ‘led on
    DelayMS 100 ‘wait 100mS
    if buton = 0 then
    timr = 100 ‘check button every 100mS
    else
    dec timr 'timr = timr-1
    endif
    until timr = 0
    return
    Last edited by charliecoultas; 21st October 2015 at 15:45.

  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
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Another example: -

    Code:
    Device = 12F675 
    
    Xtal = 4 
    
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON, 
    
    Dim Timr As Word
    
    CMCON=7 
    ANSEL=0
    
    Symbol buton=GPIO.0 
    Symbol LED=GPIO.1 
    Timr = 0 
    
    cal_1: 
    Low LED 
    If buton = 0 Then GoSub abc
    GoTo cal_1:
    
    '----------------------------------------------------------
    
    abc: 
    Repeat
    
    If buton = 0 Then Timr = 0
    High LED 
    
    DelayMS 1 
    Inc Timr
    
    Until Timr = 10000
    Timr = 0
    Return
    Regards

    Joseph

  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
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Quote Originally Posted by joesaliba View Post
    Another example: -

    Code:
    Device = 12F675 
    
    Xtal = 4 
    
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON, 
    
    Dim Timr As Word
    
    CMCON=7 
    ANSEL=0
    
    Symbol buton=GPIO.0 
    Symbol LED=GPIO.1 
    Timr = 0 
    
    cal_1: 
    Low LED 
    If buton = 0 Then GoSub abc
    GoTo cal_1:
    
    '----------------------------------------------------------
    
    abc: 
    Repeat
    
    If buton = 0 Then Timr = 0
    High LED 
    
    DelayMS 1 
    Inc Timr
    
    Until Timr = 10000
    Timr = 0
    Return


    Thank you dear brother..Its working fine...God Bless you.

  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
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Glad it worked. Maybe a thumbs up!
    Regards

    Joseph

  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
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Quote Originally Posted by joesaliba View Post
    Glad it worked. Maybe a thumbs up!

    Hi Brother

    I need another change in the code...

    When I press the switch, The LED will ON for a 3 second and OFF, If the switch are ON too. If the switch is OFF, The LED will be OFF.

    Thank you.

  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
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    I do not understand.

    So, you want that if the switch is kept pressed the LED will be ON only for 3 seconds (even if the switch is kept pressed), and when you leave switch the LED is OFF even if the time is shorter than 3 seconds?
    Regards

    Joseph

  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.

  21. #11
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Quote Originally Posted by joesaliba View Post
    I do not understand.

    So, you want that if the switch is kept pressed the LED will be ON only for 3 seconds (even if the switch is kept pressed), and when you leave switch the LED is OFF even if the time is shorter than 3 seconds?


    Exactly....True Brother.

    Thank you

  22. 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.

  23. #12
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    The following should work. I did not test it but it should work.

    Now that you are getting an idea how all should work, you should try out something yourself first and come back with YOUR code for forum members to see and tell you how to improve. I switched ON the computer after 5 days of work, so time is a bit restricted at the moment. But as I told you, I will help when ever is possible but please do some effort and write the code you first. This will also makes you learn how to write code: -

    Code:
    Device = 12F675 
    
    Xtal = 4 
    
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON, 
    
    Dim Timr As Word
    
    CMCON=7 
    ANSEL=0
    
    Symbol buton=GPIO.0 
    Symbol LED=GPIO.1 
    Timr = 0 
    
    cal_1: 
    Low LED 
    If buton = 0 Then GoSub abc
    GoTo cal_1:
    
    '----------------------------------------------------------
    
    abc: 
    DelayMS 35          ' Some push debounce delay
    
    Repeat
    
    If buton = 1 Then Break
    High LED 
    
    DelayMS 1 
    Inc Timr
    
    Until Timr = 3000
    
    Timr = 0
    '----------------------------------------------------------------------------------------
    
    While buton = 0   ' Stay here if push is still pressed otherwise it will enter 
    Wend                  ' loop again. So first, user must release push and then press again 
    
    Return
    Last edited by joesaliba; 30th October 2015 at 20:14.
    Regards

    Joseph

  24. 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.

  25. #13
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Quote Originally Posted by joesaliba View Post
    The following should work. I did not test it but it should work.

    Now that you are getting an idea how all should work, you should try out something yourself first and come back with YOUR code for forum members to see and tell you how to improve. I switched ON the computer after 5 days of work, so time is a bit restricted at the moment. But as I told you, I will help when ever is possible but please do some effort and write the code you first. This will also makes you learn how to write code: -

    Code:
    Device = 12F675 
    
    Xtal = 4 
    
    Config INTRC_OSC_NOCLKOUT, MCLRE_OFF, WDT_OFF, PWRTE_ON, 
    
    Dim Timr As Word
    
    CMCON=7 
    ANSEL=0
    
    Symbol buton=GPIO.0 
    Symbol LED=GPIO.1 
    Timr = 0 
    
    cal_1: 
    Low LED 
    If buton = 0 Then GoSub abc
    GoTo cal_1:
    
    '----------------------------------------------------------
    
    abc: 
    DelayMS 35          ' Some push debounce delay
    
    Repeat
    
    If buton = 1 Then Break
    High LED 
    
    DelayMS 1 
    Inc Timr
    
    Until Timr = 3000
    
    Timr = 0
    '----------------------------------------------------------------------------------------
    
    While buton = 0   ' Stay here if push is still pressed otherwise it will enter 
    Wend                  ' loop again. So first, user must release push and then press again 
    
    Return


    Brother, The LED not OFF while the button pressed.....

  26. 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.

  27. #14
    manojsoorya
    Guest manojsoorya's Avatar

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    I just change this....

    code:

    abc:
    high led
    delayms 10




    ;DelayMS 1 ' Some push debounce delay
    Repeat


    If buton = 1 Then Break
    high LED




    DelayMS 10
    Inc Timr


    Until Timr = 1


    Timr = 0


    [code]

  28. 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.

  29. #15
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,600
    Thumbs Up
    Received: 81
    Given: 33
    Total Downloaded
    6.78 GB

    0 Not allowed!

    Default Re: Proton basic compiler PWM

    Explain better how it should be: -

    1) Press button LED ON for 3 seconds
    2) If the push is still pressed LED stays ON for 3 seconds and then goes OFF
    3) If push is released and less than 3 seconds passed the LED is OFF

    Change the above how you want it.
    Regards

    Joseph

  30. 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. Replies: 11
    Last Post: 8th January 2019, 07:55
  2. [SOLVED !] Error: Proton BASIC Compiler has stopped working
    By alexterrell in forum Proton Plus Compiler v3
    Replies: 9
    Last Post: 26th September 2015, 16:25
  3. [SOLVED !] Proton PICbasic V3_5_0_6 versus Proton+ Basic Compiler V3.2.5.5
    By Eddy in forum Pre-Sales and Upgrade Questions
    Replies: 6
    Last Post: 23rd October 2011, 11:34
  4. [SOLVED !] Free book for proton basic is here and authentic reseller of proton compiler?
    By Ring in forum Pre-Sales and Upgrade Questions
    Replies: 1
    Last Post: 22nd February 2011, 20:16
  5. [SOLVED !] Proton+ basic compiler
    By robotman in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 19th March 2009, 01:03

Tags for this Thread

Posting Permissions

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