#DEFINE logic
Archiver
Posts: 46,084
So the conditional compilation directive #DEFINE isn't global? How
strange. I have to set #DEFINE DebugOn = 1 for each 2K page. or
#DEFINE BAUD = 9600 for each page. Thats lousy. I thought conditional
compilation took place BEFORE sending code to the chip. So why bother
with chopping it into 2k page space?
Speaking of directives, why on earth would one page be in a BS2P and
another in a BS2 and yet another be in a BS2SX? Please rethink the
logic of conditional compilations and give us something not so prone
to errors.
Thanks
Paul
strange. I have to set #DEFINE DebugOn = 1 for each 2K page. or
#DEFINE BAUD = 9600 for each page. Thats lousy. I thought conditional
compilation took place BEFORE sending code to the chip. So why bother
with chopping it into 2k page space?
Speaking of directives, why on earth would one page be in a BS2P and
another in a BS2 and yet another be in a BS2SX? Please rethink the
logic of conditional compilations and give us something not so prone
to errors.
Thanks
Paul
Comments
The larger units have multiple code pages, but
you can only 'run' programs from the other pages,
you can't use the other pages as subroutine holders,
for instance.
Thus, every 'page' has its own program. #define
only applies to each 2K code page program. (Are you
referring to 'CON' keywords? Same issue.)
I consider this a 'strange' implementation, but it
comes out of portability with the original BS2.
It's an effective, simple way to expand the memory
space without any major code changes.
There do exist ways to let the various 'pages' share
variables -- you might check those out in the
'Nuts & Volts' pages.
So that's why it is this way.
--- In basicstamps@yahoogroups.com, "Paul" <prcoy@y...> wrote:
> So the conditional compilation directive #DEFINE isn't global? How
> strange. I have to set #DEFINE DebugOn = 1 for each 2K page. or
> #DEFINE BAUD = 9600 for each page. Thats lousy. I thought
conditional
> compilation took place BEFORE sending code to the chip. So why
bother
> with chopping it into 2k page space?
> Speaking of directives, why on earth would one page be in a BS2P
and
> another in a BS2 and yet another be in a BS2SX? Please rethink the
> logic of conditional compilations and give us something not so
prone
> to errors.
> Thanks
> Paul
>strange. I have to set #DEFINE DebugOn = 1 for each 2K page. or
>#DEFINE BAUD = 9600 for each page. Thats lousy. I thought conditional
>compilation took place BEFORE sending code to the chip. So why bother
>with chopping it into 2k page space?
>Speaking of directives, why on earth would one page be in a BS2P and
>another in a BS2 and yet another be in a BS2SX? Please rethink the
>logic of conditional compilations and give us something not so prone
>to errors.
>Thanks
>Paul
Hi Paul,
A number of us continue to lobby Parallax for "include file"
capability, which would allow us to transfer shared program elements
easily from bank to bank within a project. As it is, create a block
of program code, usually declarations, that you need to have in all
banks. Update that block in all banks, even by "copy and paste" the
entire block. I agree, it is an error prone part of multibank
programing.
The original BASIC Stamp II code was designed around that 2k page
size, and it is really tight and elegant bit-coding. To maintain
compatibility and efficiency, while moving to larger memory
capability, the banking scheme was by far the path of least
resistance. The new editor is a great improvement, and, I think, it
is still evolving.
-- Tracy
I may need to "expand" my Parallax Basic code in near future and
appreciate your comments on the subject of block / page issues.
Just for clarification - can these terms be used interchangeably?
I would think not - I see page as hardware and block as code.
Is that correct?
Also if you have a snippet of code or link to some sample code you
know about to show us how to tie the execution between different
pages / blocks. Nothing fancy, don't want to waste you time.
Vaclav
directly (i.e, you CAN'T do a GOSUB to a subroutine in another slot).
The Scratchpad RAM can be used and a communications buffer between
program slots. This article should help if you're interested in
expanding your program across multiple slots.
http://www.parallax.com/dl/docs/cols/nv/vol3/col/87.pdf
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: aa7ej [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fAxOkYw5-GMheXMrtZYnaXN81PKyTLlUxkhC-0gdplCRqAFi-XMDWWeNHhDs3nlFHLZFptmWAg]aa7ej@y...[/url
Sent: Thursday, October 30, 2003 11:43 AM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: #DEFINE logic
Tracy,
I may need to "expand" my Parallax Basic code in near future and
appreciate your comments on the subject of block / page issues. Just for
clarification - can these terms be used interchangeably? I would think
not - I see page as hardware and block as code. Is that correct?
Also if you have a snippet of code or link to some sample code you
know about to show us how to tie the execution between different
pages / blocks. Nothing fancy, don't want to waste you time. Vaclav
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Your use of Yahoo! Groups is subject to
http://docs.yahoo.com/info/terms/
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
>I may need to "expand" my Parallax Basic code in near future and
>appreciate your comments on the subject of block / page issues.
>Just for clarification - can these terms be used interchangeably?
>I would think not - I see page as hardware and block as code.
>Is that correct?
>
>Also if you have a snippet of code or link to some sample code you
>know about to show us how to tie the execution between different
>pages / blocks. Nothing fancy, don't want to waste you time.
> Vaclav
Hi Vaclav,
There is a "block" in relation to hardware. A page (2048 bytes)
consists of 128 blocks of 16 bytes. You can see those blocks when
you look at the memory map (CTRL-M), where each line is one block.
This can affect your programming. For example, suppose you put DATA
in the first 51 bytes of memory:
DATA "The fires in California are burning out of control",CR
i var byte
x var byte
for i=0 to 49
read i,x
debug x
next
You run that program. Then you write the following program:
DATA "Santa Ana",CR ' 10 bytes
i var byte
x var byte
for i=0 to 50 ' still 51 bytes
read i,x
debug x
next
You will end up with "time flies" flashing on the screen followed by
"lifornia are burning out of control" on the screen. That is because
the 6 bytes after time flies are replaced (by the IDE) with zeros,
but the IDE programming protocol does not touch the blocks of 16
bytes that are already there in the eeprom with previously stored
data. So, if you want to want to leave some data in your eeprom
untouched between runs, plan around blocks.
In addition to the N&V article Jon wrote, you might also find info of
interest x-bank programming here:
http://www.emesys.com/BS2SX.htm
If you are going to do anything fancy in multibank programming, I
highly highly suggest springing for the BS2p or BS2pe. The STORE
command is worth its weight in gold.
-- Tracy
-- Tracy
> Oops. Correction. I should have said, "Santa Ana", not "time
flies".
>
> -- Tracy
And I was blaming it on my operating system when it could not find it.
Vaclav