hello this is my code of 3 Years off my hobbies Turbines for Models
A few things to note at first look at your code...
There's a few places where you've got a GOTO followed by a GOTO. The code isn't ever going to get to that 2nd GOTO. You might have actually meant to put a GOSUB followed by a GOTO...unless it's just a change that you haven't removed.
There's at least 1 IF/THEN statement that doesn't look right. I think it's in the Autostart file.
A single line If/Then with a colon in it generally doesn't work. If it was me, I'd use:Code:if (EGT > 300) and (RPM > PumpAdd +10) and (FlameOut_1=0) then FlameOut_1=1: gosub opengasoff 'Close Gas Valve
Is that zip file the actual code you are programming into your PIC and using right now?Code:if (EGT > 300) and (RPM > PumpAdd +10) and (FlameOut_1=0) then FlameOut_1=1 : gosub opengasoff 'Close Gas Valve endif
Oh...987 lines is what I got it down too![]()
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
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...
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.
Also try to avoid GOTO and GOSUB where possible. Most often, programs which make extensive use of them turn out to be spaghetti code.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
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.
Bookmarks