PDA

View Full Version : Help ?



jetpr
- 7th July 2007, 03:09
Hello to all

I am using the pic18f252 with PICBASIC PRO and MicroCode Studio Plus with the last version of picbasic pro and I have about 1,900 line of code but I am having some very strange problems as sometimes the code jumps steps and don't know if the problem of PICBASIC or of the pic18f252 and I am using the new USB Programmer

This type of problem has frustrated and I am thinking about changing all it of PICBASIC by a compiler of C. But I do not want to commit a so large error that have a great deal of money in this.

If someone it can give me an idea that can be.

skimask
- 7th July 2007, 04:43
I am using the pic18f252 with PICBASIC PRO and MicroCode Studio Plus with the last version of picbasic pro and I have about 1,900 line of code but I am having some very strange problems as sometimes the code jumps steps and don't know if the problem of PICBASIC or of the pic18f252 and I am using the new USB Programmer
Attach that code...I ain't scared!

Melanie
- 7th July 2007, 07:37
My largest PBP program runs at about 4,500 lines and works flawlessly. However, I can't say the same for 18F series PICs - they do have anomalies, especially the early ones. Take the 18F2420 for example... part of the 18F242/252 family... all's well until you try to use PortE.3 in a design - then Gawd help you! Hey ski - you actually want to look at somebody's 1900 line program? Run out of credit at the bar, and you're killing time waiting for payday or something?

skimask
- 7th July 2007, 07:49
My largest PBP program runs at about 4,500 lines and works flawlessly. However, I can't say the same for 18F series PICs - they do have anomalies, especially the early ones. Take the 18F2420 for example... part of the 18F242/252 family... all's well until you try to use PortE.3 in a design - then Gawd help you! Hey ski - you actually want to look at somebody's 1900 line program? Run out of credit at the bar, and you're killing time waiting for payday or something?

Sure...I figure I can add some colons here and there...make it...oh I don't know, maybe 190 lines instead :D
Heck, my old mp3 player project ended up being 2,057 lines AFTER combining lines and my current project is already up to 2,015 (again with a load of colons) and I'm only about 1/2 done with it.
Besides, like you said, with some of the 18F series, they're a bit flakey. I haven't had a problem with them in over a couple of years, but those early ones...Look out!
Who knows...might be something that you or I would easily recognize as an obvious error, but somebody with limited PBP experience wouldn't see it...but after pointing it out, stands out like a sore thumb after the first time.

T.Jackson
- 7th July 2007, 08:27
4,500 lines is absolutely huge for embedded systems software. My current project - cloning Donkey Kong for the PC, so far I've done the first level (100% playable) plus most of the raw foundation for everything is tact. I'm up to about 1,600 lines so far, the code is yet to be optimized. In the final completed version, I'm estimating 3,000 lines.

Melanie
- 7th July 2007, 11:24
4,500 lines is absolutely huge for embedded systems software...

You should see the size of the LST file after compilation! 10.4Mb, 3385 pages, 229138 lines... geeze... try printing that one out for reference...

keithdoxey
- 7th July 2007, 13:23
4,500 lines is absolutely huge for embedded systems software...

You should see the size of the LST file after compilation! 10.4Mb, 3385 pages, 229138 lines... geeze... try printing that one out for reference...

I bet the source code for the mouse driver in Windows Vista is bigger LOL

jetpr
- 7th July 2007, 15:48
Thanks to all

I do not want to offend nobody of this community of PICBASIC but to kiss one does not find another exit and I love PICBASIC PRO
To change to another thing to be almost impossible

But thanks for the help I going to change the PIC18f252.

jetpr
- 7th July 2007, 20:57
a change of the pic18f252 to pic18f2620 expect that this work myself

skimask
- 7th July 2007, 21:38
a change of the pic18f252 to pic18f2620 expect that this work myself

Good switch, but don't expect it to work without changing some of the code around a bit. I made a switch from a '452 to a '4620 awhile back...basically the same chip, but more memory, more hardware, etc.etc...
Are you going to attach the code or not?

jetpr
- 7th July 2007, 22:10
hello this is my code of 3 Years off my hobbies Turbines for Models

skimask
- 7th July 2007, 23:41
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.

if (EGT > 300) and (RPM > PumpAdd +10) and (FlameOut_1=0) then FlameOut_1=1: gosub opengasoff 'Close Gas Valve
A single line If/Then with a colon in it generally doesn't work. If it was me, I'd use:


if (EGT > 300) and (RPM > PumpAdd +10) and (FlameOut_1=0) then
FlameOut_1=1 : gosub opengasoff 'Close Gas Valve
endif


Is that zip file the actual code you are programming into your PIC and using right now?
Oh...987 lines is what I got it down too :D

Darrel Taylor
- 7th July 2007, 23:52
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.

.

skimask
- 7th July 2007, 23:57
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...

T.Jackson
- 8th July 2007, 02:52
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.



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.

skimask
- 8th July 2007, 06:57
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.

jetpr
- 9th July 2007, 02:44
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.

jetpr
- 28th July 2007, 17:10
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.

jetpr
- 23rd September 2007, 04:42
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.

jetpr
- 25th September 2007, 13:59
Ecu CIRCUIT

jetpr
- 23rd November 2007, 03:05
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 ...