If I have a line of code that's 150 characters long, is there a way to continue that code onto the next line so all of the code can be viewed on my screen without scrolling to the right?
If I have a line of code that's 150 characters long, is there a way to continue that code onto the next line so all of the code can be viewed on my screen without scrolling to the right?
Hi there,
yes there is...
just use the _ to break the line.
Check this example:
regardsCode:Lookup y, [$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$10,$08,$00,$00,$00,$00,$80,$80,$90,$00,$20,$1C,$2C,$30,_ $18,$18,$1C,$1C,$3E,$2E,$2A,$08,$2C,$10,$18,$18,$08,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$F0,_ $F0,$02,$02,$04,$04,$04,$04,$00,$00,$00,$00,$00,$01,$00,$00,$00,_ $00,$00,$00,$00,$00,$80,$80,$80,$80,$40,$40,$40,$20,$20,$10,$10,_ $10,$08,$88,$88,$4C,$44,$C4,$A4,$02,$00,$00,$00,$FC,$8C,$C4,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$20,$68,$68,$38,$00,$00,$00,$00,$00,$E0,_ $20,$10,$B0,$68,$C8,$00,$00,$80,$30,$C8,$08,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$FE,$01,$11,$C1,$A8,$88,$88,$54,$D4,$00,$00,_ $00,$00,$00,$00,$00,$00,$02,$14,$01,$0D,$0A,$6A,$10,$00,$00,$00,_ $F7,$39,$18,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$4E,_ $00,$00,$00,$03,$EE,$01,$01,$03,$01,$F3,$45,$C3,$60,$D7,$BE,$46,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$3F,$00,$14,$2C,$8A,$4A,$56,_ $19,$06,$00,$00,$00,$00,$00,$00,$00,$00,$00,$01,$02,$0C,$02,$00,_ $00,$80,$00,$00,$02,$01,$03,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$80,$00,_ $80,$80,$00,$31,$00,$00,$00,$00,$FF,$00,$00,$00,$00,$DE,$39,$38,_ $08,$6B,$FC,$32,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$02,$01,$00,$00,$00,$00,$00,$00,$80,$80,$40,$40,$40,$20,$20,_ $20,$10,$10,$18,$08,$04,$05,$01,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$02,$05,$06,$03,$00,$00,$08,$10,$10,$20,$20,$20,$24,$56,_ $5C,$80,$80,$81,$83,$89,$00,$00,$00,$00,$80,$C0,$50,$48,$28,$2C,_ $12,$12,$10,$08,$08,$08,$04,$04,$02,$02,$03,$01,$01,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,_ $00,$00,$00,$00,$00,$00,$00,$00] ,LcdReg
Rui
I thought the maximum allowed number of constants for LOOKUP was 255, it looks to be way more than that it the list - has that changed?
Never the less, it does show the "line continuation".
/Henrik.
OK, I'll do my best to clarify that myself.....
Previously the limit was 255 or 256 but in version 2.5C the limit for PIC18 parts was increased to 1024 entities. The PBP3 manual (which of course is the correct place to look when in doubt) says 1024 for PIC18 parts while the online help in MCSP 5.0.0.3 doesn't mention that, it says 256 for 18C parts though.
/Henrik.
While the manual doesn't say a lot about how to use the line extension character, from experience you need to extend from an operator and not just anywhere in the line.
For example:
myvariable31 = myvariable1 + myvariable2 + myvariable3 +_
myvariable4 + myvariable5
should work.
However;
myvariable31 = myvariable1 + myvariable2 + myvar_
iable3 + myvariable4 + myvariable5
will not.
It's called a line extension, but it's really statement extension to include terms and operators on the following line. You can't just jam it anywhere in the line of text and have the next line pick up exactly where the first left off.
I have one.Maybe you could phrase that the other way around, and suggest a scenario where it doesn't work?
I can't code wrap when the characters extend past column 255 even though we're given 1024.
Could you explain what you mean by that.
This code which goes out to column 333 compiles just fine with PBP3.
It wraps in the forums code box, but you should get the idea.Code:I VAR WORD value VAR WORD LOOKUP I, [$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,$45,$35,$67,$7E,_ $8F,$00,$0F,$C0,_ $EF,$55,$01,$00], value
DT
What happens when you try to compile this code?
Code:HSEROUT ["iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAArtSURBVFhHVVhpb1XXFfVfaACPb579bGYwHvBsP9vPfp6NzGDjCcJghkClpKSIUmVom1aKKqVRUtqilhZwmANUplUSNUOhqIRIQYKUqimhUMKPWF1rn3fd5MN9w7nn7",_ "nHttfe5BQFfCXylhSgrWYIyfgf1n79DZYV2+UsWI+Avht9XjJLixQj5eb+siFehffvzv/Ws31dke7Wu/wFeYe3ht3TovtbtHuXpW3sL7AEK9Ba8Db5SGsKNft2jUd8U4hkdpkFSYJcMpqxSGi0Dy/i81oNU7CvV+hJTrHvOGN6XgVwrcMp58cay8ti3LBzMtlJA3hgKichT/tcV5jNBKvxpf9Z+",_ "B3hfUXMRXIKgKXGetjfWIhQopTOLbe3F2RkXzXxUCmThkf07EeYmGRMOliHIkAZpYUCecnOYys/um8KpTAPme1pweO1yRIsW4RdVK/GnjhacymUQ4f+/",_ "PjeO8z2NmG9bjxNtDWaY5CmFumSAIqNIRLgeDpaafEaCG2lAeSyE8kTYLD5MS20tGbHNIVp8elMvHk0P4el4H25PDuBMWx2ut9fjK659NDOKBPFyqa0WD2cG8HhzD66PdOP1nZNmRJqyo6EyRlnKS1FBueXxsMmW4wWyyuW7GCEuet4LYHYpBQzjq001+HQgi/sbe3FxpBMJGn+hdT1uTg/",_ "XibVX6mVPtMoHvzotJcMCrfzp2Bbp97K+POKB7WvEOxPa9oc9//AEEBNtPX0IZcAAAAAElFTkSuQmCC",34,"/>"]
Compiling that code ... generates a "FATAL ERROR: Internal: Locate could not find nCmd = 32174784"
But it has nothing to do with "Line Continuation" and the "_" underscore.
There are simply too many characters in the HSEROUT command.
If you break that into 2 HSEROUT statements, it compiles fine ...
If you add a single character to the first HSEROUT ... it will fail.Code:HSEROUT ["iVBORw0KGgoAAAANSUhEUgAAACEAAAAkCAYAAAAHKVPcAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAArtSURBVFhHVVhpb1XXFfVfaACPb579bGYwHvBsP9vPfp6NzGDjCcJghkClpKSIUmVom1aKKqVRUtqilhZwmANUplUSNUOhqIRIQYKUqimhUMKPWF1rn3fd5MN9w7nn7",_ "nHttfe5BQFfCXylhSgrWYIyfgf1n79DZYV2+UsWI+Avht9XjJLixQj5eb+siFehffvzv/Ws31dke7Wu/wFeYe3ht3TovtbtHuXpW3sL7AEK9Ba8Db5SGsKNft2jUd8U4hkdpkFSYJcMpqxSGi0Dy/i81oNU7CvV+hJTrHvOGN6XgVwrcMp58cay8ti3LBzMtlJA3hgKichT/tcV5jNBKvxpf9Z+",_ "B3hfUXMRXIKgKXGetjfWIhQopTOLbe3F2RkXzXxUCmThkf07EeYm"] HSEROUT ["GRMOliHIkAZpYUCecnOYys/um8KpTAPme1pweO1yRIsW4RdVK/GnjhacymUQ4f+/",_ "PjeO8z2NmG9bjxNtDWaY5CmFumSAIqNIRLgeDpaafEaCG2lAeSyE8kTYLD5MS20tGbHNIVp8elMvHk0P4el4H25PDuBMWx2ut9fjK659NDOKBPFyqa0WD2cG8HhzD66PdOP1nZNmRJqyo6EyRlnKS1FBueXxsMmW4wWyyuW7GCEuet4LYHYpBQzjq001+HQgi/sbe3FxpBMJGn+hdT1uTg/",_ "XibVX6mVPtMoHvzotJcMCrfzp2Bbp97K+POKB7WvEOxPa9oc9//AEEBNtPX0IZcAAAAAElFTkSuQmCC",34,"/>"]
Because there are already 512 characters. Apparently, the maximum it can handle.
DT
I know. That's what I've been doing but now it's becoming a problem because there are so many HSEROUT statements. A 2kB image takes up 17kB of code space. Is there a better way to send an image that doesn't take up so much code space with HSEROUT statements?If you break that into 2 HSEROUT statements, it compiles fine ...
Really!
You could have an HSEROUT statement for every character, and it wouldn't use a single word more than putting everything in a single HSEROUT.... it's becoming a problem because there are so many HSEROUT statements.
That's just the way HSEROUT works.
It calls a macro for each character, it doesn't matter which HSEROUT statement calls the macro.
Store it in FLASH ... a 2kB image will use 2kB (on 18Fs).A 2kB image takes up 17kB of code space. Is there a better way to send an image that doesn't take up so much code space with HSEROUT statements?
Read it back with READCODE.
DT
Bookmarks