Help ?


Closed Thread
Results 1 to 21 of 21

Thread: Help ?

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    ROFL!

    And I thought you were the High Colonic Master.

    IF colons separate multiple statements on the same line as an IF, they are ALL executed if the condition is TRUE, and none will execute if it's false.

    So the 2 examples shown, are the same thing.

    .
    DT

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Darrel Taylor View Post
    ROFL!
    And I thought you were the High Colonic Master.
    IF colons separates multiple statements on the same line as an IF, they are ALL executed if the IF condition is TRUE, and none will execute if it's false.
    So the 2 examples shown, are the same thing.
    .
    I know that's what the manual says, but in the past, I've had certain situations where if one of those statements after the THEN is a goto or a gosub, the If/Then 'acts up' under certain circumstances. I can't quantify exactly what those circumstances are...I just know that I've been avoiding that certain way of doing the IF/THEN statements for a reason ever since it bit me way back when.
    Maybe that's one of those things that got fixed back in PBP 2.2, or it might've gotten fixed since, I don't know...I just avoid it...

  3. #3
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Default

    Here's a how to save on some code space a long with a marginal increase in speed. Avoid using the AND operator where possible by multiple nesting IF's.

    Code:
    if (EGT > 300) then
       if (RPM > PumpAdd +10) then
          if  (FlameOut_1=0) then
              FlameOut_1=1 
              gosub opengasoff  'Close Gas Valve
          endif
       endif
    endif
    Also try to avoid GOTO and GOSUB where possible. Most often, programs which make extensive use of them turn out to be spaghetti code.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default Code problems...

    On 2nd glance at the code (which is over 2400 lines)...

    There's a handful of places in the code as a whole where you are decrementing (or incrementing) a byte variable without doing any underflow (or overflow) checking. For instance, a variable contains 4 and you subtract 5, now you've got 255 instead of -1 (which PBP doesn't do)...
    Add underflow and overflow checking to those spots. Only subtract if the value is large enough to be subtracted from...same thing with adding, only add if the number is small enough to be add to...to keep the byte (or word) values from under- or over- flowing.

  5. #5
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Thumbs up

    Ok
    thanks to all for the Idea off code speed and help

    i going to modify the code more efficient to the PICBASIC PRO Code.

  6. #6
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Thumbs up

    Thanks to Melanie and all other.

    I change from Pic18f252 to Pic18f2620 and now is working with no problem up to now.

    now i compiler and program the PIC and no Glitch.

  7. #7
    Join Date
    Jan 2005
    Location
    Puerto Rico
    Posts
    133


    Did you find this post helpful? Yes | No

    Red face

    after change all the code to the new pic18f2620 and start working in my ECU and made new board the things do not go very well as expected.

    so if some one have done a big project or pro application with picbasic pro and that me of an opinion upon as achieving to do it.
    My Hobbies is PicBasic PRO

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