Timer PIC16F57


Closed Thread
Results 1 to 26 of 26

Thread: Timer PIC16F57

Hybrid View

  1. #1
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hell Leonel,

    Ok! Just wanted to make sure!...

    I also noticed you changed my "If" statements to "while" statements.
    Since I do not have a testing ground here, I do not know what will happen, if the program "Jumps" out of the middle of a while statement too many times.
    I have had no problems jumping out of a "If" statement... but I am not sure about a while statement. So, I did not use while statements, for fear of crashing <g>.

    Ralph, Steve, Melanie, Darrel, Bruce... Whats the answer???

    Code:
    Loop
    a=1
    
      while a <100 
        .....
        if a==50 goto Loop
        ...
        a=a+1
      wend
    ....
    goto Loop.
    If a hits 50 a bunch of times, will this give PBP a problem and lose its stack? or run haywire? I know in some older versions of C/C++, it could cause a problem with memory...but I am not sure in PBP.

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  2. #2
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default help

    To be honest i donīt know the answer too! If anyone can help us...
    In all my experience (10 months in PBP ) i didnīt have problems, but... thereīs always a but!

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    personnaly if i want to jump out of a while statement i would prefer to validate the WHILE condition and set a JUMP or FLAG bit to do XYZ task...

    well code will talk by itself...

    Code:
    Start:
         While AVar!=50
              if AVar==20 then 
                   AVar=50
                   FlagBit=1
                   endif
              Wend
         IF FlagBit=1 then Start
    BUT i would also prefer another approach... like two WHILE statement one after the other... case by case i guess.

    I don't belive that the Stack will be a problem since it's not a GOSUB...
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Dec 2003
    Location
    Wichita KS
    Posts
    511


    Did you find this post helpful? Yes | No

    Default

    Hello Steve,

    Steve>>i would prefer to validate the WHILE condition and set a JUMP or FLAG bit to do XYZ task...<<

    Great minds think alike <grin>... (Hope you don't take that as a insult)

    I am like you... I like to force the while to do its job...

    Thanks Bud!... I hope things are well in Canada...

    Dwayne
    Ability to Fly:
    Hurling yourself towards the ground, and missing.

    Engineers that Contribute to flying:
    Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute

    Pilots that are Flying:
    Those who know their limitations, and respect the green side of the grass...

  5. #5
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Great minds think alike ... (Hope you don't take that as a insult)
    i don't see why i should ;o]
    I hope things are well in Canada...
    couldn't be better thanks!!!
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  6. #6
    Join Date
    Feb 2005
    Location
    Portugal
    Posts
    79


    Did you find this post helpful? Yes | No

    Default Thankīs

    What i understand that itīs better to put a flag bit in a while do a goto in an if statement!! Ok...
    Thank 's to all of you for your help...

Similar Threads

  1. Elapsed Timer Demo
    By Darrel Taylor in forum Code Examples
    Replies: 111
    Last Post: - 29th October 2012, 17:39
  2. High Resolution Timer & Speed Calculator
    By WOZZY-2010 in forum Code Examples
    Replies: 4
    Last Post: - 7th February 2010, 16:45
  3. Timer + rc5
    By naga in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 19th November 2009, 07:56
  4. Timer interrupt frequency
    By Samoele in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 17th January 2009, 23:49
  5. timer interupt help 16f73
    By EDWARD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2005, 08:41

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