Timer Of 40 Days 12f675 Or 16f628


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hola Leonardo,

    Ahora que usted tiene PicBasic Pro. La manera más fácil de hacer el programa de 40 días es utilizar el primer ejemplo que di al principio de este thread.

    Primero, usted necesita Download el programa de
    http://www.picbasic.co.uk/forum/showthread.php?t=190

    Entonces, intente esto...
    Code:
    <font color="#008000"><b>CLEAR
    
    </b></font><b>Bcount  </b><font color="#008000"><b>VAR  BYTE
    
    INCLUDE </b></font><font color="#FF0000">&quot;Elapsed.pbp&quot;         </font><font color="#0000FF"><b><i>; Include the Elapsed Timer Routines
    </i></b></font><font color="#008000"><b>GOSUB </b></font><b>ResetTime               </b><font color="#0000FF"><b><i>; Reset Time to  0d-00:00:00.00    
    
    </i></b></font><b>Start</b>:
        <b>Bcount </b>= <b>0
    MainLoop</b>:
        <font color="#008000"><b>BUTTON </b></font><b>PORTB</b>.<b>1</b>,<b>0</b>,<b>200</b>,<b>255</b>,<b>Bcount</b>,<b>1</b>,<b>Start40   </b><font color="#0000FF"><b><i>; Wait for button press
        </i></b></font><font color="#008000"><b>PAUSE </b></font><b>1
    </b><font color="#008000"><b>GOTO </b></font><b>MainLoop
    
    Start40</b>:
        <font color="#008000"><b>GOSUB </b></font><b>StartTimer          </b><font color="#0000FF"><b><i>; Start the Elapsed Timer
    </i></b></font><b>Loop40</b>:
        <font color="#008000"><b>IF </b></font><b>DaysChanged</b>= <b>1 </b><font color="#008000"><b>THEN
            </b></font><b>DaysChanged</b>= <b>0
            </b><font color="#008000"><b>IF </b></font><b>Days </b>= <b>40 </b><font color="#008000"><b>THEN     </b></font><font color="#0000FF"><b><i>; Has it been 40 days
                </i></b></font><font color="#008000"><b>GOSUB </b></font><b>StopTimer
                </b><font color="#008000"><b>GOSUB </b></font><b>ResetTime   </b><font color="#0000FF"><b><i>; Reset Elapsed Timer
                </i></b></font><font color="#008000"><b>HIGH </b></font><b>PORTB</b>.<b>0      </b><font color="#0000FF"><b><i>; Turn ON output
                </i></b></font><font color="#008000"><b>PAUSE </b></font><b>10000       </b><font color="#0000FF"><b><i>; Hold output high for 10 seconds
                </i></b></font><font color="#008000"><b>LOW </b></font><b>PORTB</b>.<b>0       </b><font color="#0000FF"><b><i>; Turn OFF output
                </i></b></font><font color="#008000"><b>GOTO </b></font><b>Start         </b><font color="#0000FF"><b><i>; go back to beginning.
            </i></b></font><font color="#008000"><b>ENDIF
        ENDIF
        </b></font><font color="#0000FF"><b><i>; .. You can do other things here while waiting for 40 days (if needed) ..
    </i></b></font><font color="#008000"><b>GOTO </b></font><b>Loop40</b>
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Thumbs up Thanks

    Hola Darrel,

    Gracias por contestarme en mi idioma natal el español, estoy muy agradecido por su ayuda y hare lo que me dice.

    Muchas Gracias

    Leonard





    Quote Originally Posted by Darrel Taylor
    Hola Leonardo,

    Ahora que usted tiene PicBasic Pro. La manera más fácil de hacer el programa de 40 días es utilizar el primer ejemplo que di al principio de este thread.

    Primero, usted necesita Download el programa de
    http://www.picbasic.co.uk/forum/showthread.php?t=190

    Entonces, intente esto...
    Code:
    <font color="#008000"><b>CLEAR
    
    </b></font><b>Bcount  </b><font color="#008000"><b>VAR  BYTE
    
    INCLUDE </b></font><font color="#FF0000">&quot;Elapsed.pbp&quot;         </font><font color="#0000FF"><b><i>; Include the Elapsed Timer Routines
    </i></b></font><font color="#008000"><b>GOSUB </b></font><b>ResetTime               </b><font color="#0000FF"><b><i>; Reset Time to  0d-00:00:00.00    
    
    </i></b></font><b>Start</b>:
        <b>Bcount </b>= <b>0
    MainLoop</b>:
        <font color="#008000"><b>BUTTON </b></font><b>PORTB</b>.<b>1</b>,<b>0</b>,<b>200</b>,<b>255</b>,<b>Bcount</b>,<b>1</b>,<b>Start40   </b><font color="#0000FF"><b><i>; Wait for button press
        </i></b></font><font color="#008000"><b>PAUSE </b></font><b>1
    </b><font color="#008000"><b>GOTO </b></font><b>MainLoop
    
    Start40</b>:
        <font color="#008000"><b>GOSUB </b></font><b>StartTimer          </b><font color="#0000FF"><b><i>; Start the Elapsed Timer
    </i></b></font><b>Loop40</b>:
        <font color="#008000"><b>IF </b></font><b>DaysChanged</b>= <b>1 </b><font color="#008000"><b>THEN
            </b></font><b>DaysChanged</b>= <b>0
            </b><font color="#008000"><b>IF </b></font><b>Days </b>= <b>40 </b><font color="#008000"><b>THEN     </b></font><font color="#0000FF"><b><i>; Has it been 40 days
                </i></b></font><font color="#008000"><b>GOSUB </b></font><b>StopTimer
                </b><font color="#008000"><b>GOSUB </b></font><b>ResetTime   </b><font color="#0000FF"><b><i>; Reset Elapsed Timer
                </i></b></font><font color="#008000"><b>HIGH </b></font><b>PORTB</b>.<b>0      </b><font color="#0000FF"><b><i>; Turn ON output
                </i></b></font><font color="#008000"><b>PAUSE </b></font><b>10000       </b><font color="#0000FF"><b><i>; Hold output high for 10 seconds
                </i></b></font><font color="#008000"><b>LOW </b></font><b>PORTB</b>.<b>0       </b><font color="#0000FF"><b><i>; Turn OFF output
                </i></b></font><font color="#008000"><b>GOTO </b></font><b>Start         </b><font color="#0000FF"><b><i>; go back to beginning.
            </i></b></font><font color="#008000"><b>ENDIF
        ENDIF
        </b></font><font color="#0000FF"><b><i>; .. You can do other things here while waiting for 40 days (if needed) ..
    </i></b></font><font color="#008000"><b>GOTO </b></font><b>Loop40</b>

Similar Threads

  1. Timer code examples for PIC 16F628
    By Tastature in forum mel PIC BASIC
    Replies: 6
    Last Post: - 22nd November 2013, 02:47
  2. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  3. dual 7-segment countdown timer code
    By dr.ragh in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 30th April 2007, 13:19
  4. Timer does not work 12F675
    By Leonardo in forum mel PIC BASIC
    Replies: 12
    Last Post: - 22nd September 2005, 21:12
  5. Button pressed time control
    By tanero in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 15th August 2005, 15:17

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