Strange behaviour of my PBP code.


Closed Thread
Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    Ohh so simple!

    When I notified the problem fist time I was saying to myself that this time I will try to solve the problem without help from anybody, so I have spent a lot off hours on trying to find the problem, but then I give up and started a thread here again.

    Thank you Darrel.

  2. #2
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    But itīs OK to use Gotoīs within the subroutine as long as I call a label that is in the subroutine and only leave the subroutine by doing a Return
    Last edited by Fredrick; - 23rd August 2009 at 19:43.

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


    Did you find this post helpful? Yes | No

    Default

    Exactly!

    You've got it now.
    <br>
    DT

  4. #4
    Join Date
    Jan 2008
    Location
    Sweden
    Posts
    187


    Did you find this post helpful? Yes | No

    Default

    How is it with variables?
    If I overflow a byte sized counter it will turn to 0 after passing 255, but is it OK to let a variable overflow? or should I take care of the overflow like this

    Code:
    IF Counter > 254 Then 
    Counter = 0
    Endif
    Last edited by Fredrick; - 24th August 2009 at 12:15.

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


    Did you find this post helpful? Yes | No

    Default

    For BYTE sized variables, when the value goes over 255 the upper bits are lost, which makes it automatically wrap around to 0.
    You don't need to do it manually.

    For words, it wraps when over 65535.
    <br>
    DT

Similar Threads

  1. PBP Extensions, What are they?
    By PJALM in forum PBP Extensions
    Replies: 9
    Last Post: - 28th September 2021, 11:26
  2. PBP code to read R/C signal from receiver
    By malc-c in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 28th October 2009, 21:51
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 21st March 2007, 23:55
  5. 16f819 - acting strange... only does first line of code
    By 4Lewis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 10th May 2006, 22:53

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