Post the code...
Code is basicly like this:
DEFINE LCD_BITS 4
DEFINE LCD_DREG PORTD
DEFINE LCD_DBIT 0
DEFINE LCD_RSREG PORTD
DEFINE LCD_RSBIT 4
DEFINE LCD_EREG PORTD
DEFINE LCD_EBIT 5
TRISD = %01000000
LED VAR portD.7
...
--->8---(klipeti-klipeti)--->8--- (lots of stuff)
...
Lcdsub:
lcdout $FE,2,"hello"
lcdout $FE,C0,"world"
return
...
main:
LED=1 ' This should illuminate the led?
gosub Lcdsub
pause 500
LED=0
pause 500
goto Main
So, if I replace LED=1 with pulsout portD.7,65530 it will blink..
Otherwise it wont.. BUT..
If I remove gosubs away, LED=1 will work and it LED will blink..
> It's this that makes it suspicious.
yep, I know.. the code is 500 lines...
I just tried to save some bandwidth.. o:-)
> And which version of PBP are you using?[/QUOTE]
pbpro v:2.50a and uCodeStudio+ v:3.005
Ok, how about this code, and ONLY this code:
Code:DEFINE LCD_BITS 4 DEFINE LCD_DREG PORTD DEFINE LCD_DBIT 0 DEFINE LCD_RSREG PORTD DEFINE LCD_RSBIT 4 DEFINE LCD_EREG PORTD DEFINE LCD_EBIT 5 TRISD = %10000000 LED VAR portD.7 Lcdsub: lcdout $FE,2,"hello" : lcdout $FE,C0,"world" : return main: LED=1 : gosub Lcdsub : pause 500 : LED=0 : pause 500 : goto Main END
Last edited by skimask; - 24th January 2008 at 18:09.
> Ok, how about this code, and ONLY this code:
Well, I dunno.. BUT I got another question..
What would happen if IF-THEN-ELSE overlaps from memory-page to another? Is it allowed? Is pbp-compiler capable of handle veeeeery loooooong IF-THEN-ELSE structures (like 200lines long?) including gosubs from page to page? If not-should I get a warning? o:-)
I don't have any problem with what you're talking about, with 2.50a anyways. But quite frankly, I just avoid it altogether by just making the 'middle' of the If/Then another routine.
I've had some programs (one in particular), over 4300 lines long (and that's compacted with a lot of colons like I do often, uncompacted, figure roughly 13,000+ lines). Never had a problem with the amount of code inside of an If/Then, Select Case, While/Wend, or otherwise.
You tend to forget things like RETURN after a GOSUB, or maybe you RETURN from somewhere that you had GOTO'd instead of GOSUB'd. Keep that in mind. I just fixed a buried GOSUB (one of the drawbacks of 'compacting' source code) that would only show up after the loop went thru itself 32 times and ended up causing a stack overflow which killed my entire OS on the one project. I've been fighting it for over 6 months now.
And paging really isn't so much of an issue, moreso with 18F series PICs, and even moreso with PBP for the last few years.
Bookmarks