Help ?


Closed Thread
Results 1 to 21 of 21

Thread: Help ?

Hybrid View

  1. #1
    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.

  2. #2
    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.

  3. #3
    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.

  4. #4
    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.

  5. #5
    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

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


    Did you find this post helpful? Yes | No

    Thumbs up Circuit

    Ecu CIRCUIT
    Attached Files Attached Files
    Last edited by jetpr; - 25th September 2007 at 14:05.
    My Hobbies is PicBasic PRO

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


    Did you find this post helpful? Yes | No

    Thumbs up

    Hello to All I Find the my problems thanks for all help.

    the problem is the new series of pic18f... there berry sensitive to the power so i found when my
    DC Motor run made a big load and get the pic18f2620 out of the point in the code.

    so i found using a Tektronix Oscilloscopes so i add Electrolytic Capacitor to the power mosfet
    and now Work berry stable ..

    I am berry Happy to found the problems ...

    thanks for all the helps ...
    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