Better code check before compile?


Closed Thread
Results 1 to 30 of 30

Hybrid View

  1. #1
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Interesting... This is easy to check I guess.

    Ioannis

  2. #2
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    I made a typo, putting = instead of -

    hpwm 2,rmd*rmd=1,20000

    This statement does not produce any errors, as it should. Also, RMD value remains the same

  3. #3
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Found another.

    Here is sample code, both variants should work same, but they don't

    Code:
    if ticker>150 and ard<140 and atrig=0 then
    ticker=1 
    atrig=1 
    endif
    This one is fine, but this one:
    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1: atrig=1
    is not - atrig is always set to 1, no matter if ticker and ard values are as defined in if-then thing. It looks like that code after : is handled as separate code, not part of if-then. But, if I add say GOSUB XX after it, it is executed.

  4. #4
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    That is not bug. That way should work. This : is same as new row.
    So this line
    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1: atrig=1
    is same as this

    Code:
    if ticker>150 and ard<140 and atrig=0 then ticker=1
    
    atrig=1
    I'm using PBP since 2004. And I found only one bug in pbp, and encounter multiple in MPASM.... DT helped me a lot to track bug to MPASM...

  5. #5
    Join Date
    Feb 2013
    Posts
    1,153


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    no, it is not, because if I add GOSUB statement, it is being triggered on IF-THEN condition only.

  6. #6
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    Hehe. Read manual...
    This : replaces new row. Same as you press enter on your keyboard. So try to compile code from my code above. You will get same results.
    Only thing behind THEN depending on IF. Next statement after : does not.

  7. #7
    Join Date
    Sep 2009
    Posts
    755


    Did you find this post helpful? Yes | No

    Default Re: Better code check before compile?

    From manual
    Code:
    2.18 Line-Concatenation ( : )
    Multiple commands may be written on a single line using colon characters to tell PBP where to insert a "virtual" line break.

Similar Threads

  1. Code check and refinement suggestions?
    By kevlar129bp in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 31st July 2013, 02:37
  2. Replies: 4
    Last Post: - 24th January 2007, 22:20
  3. Code check -- button not working
    By docwisdom in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 2nd March 2006, 22:43
  4. Can some one please check my code out thanks
    By Jhdgkss in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 10th February 2006, 08:19
  5. Code check (sorry)
    By barkerben in forum General
    Replies: 5
    Last Post: - 30th November 2004, 15:54

Members who have read this thread : 1

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