If you look at the memory map afer compiling a program, it will tell
you what memory is available (object, variable, and EEPROM). In this
window, the object memory it typically the most precious (any Dim
statement with an oWhatever type). An oByte will be placed in object
memory space and a Byte will be placed in variable space. If you
place the EEPROM delimiter in the Dim statement (i.e. Dim A As EEPROM
Byte) then that variable will be stored on the internal EEPROM) When
you declare a Bit, Nib, or Byte, they all take up one byte of memory
space. Objects cannot be declared on the internal EEPROM.
Examples:
Dim A As oByte ' Defines in object space
Dim A As Byte ' Defines in variable space
Dim A As EEPROM Byte ' Defines in internal EEPROM
This statement is not allowed:
Dim A As EEPROM oByte
This is because you are defining A as a oByte object. Because it is
being treated as an object, it cannot be in the EEPROM, only the
object space.
External EEPROM:
The EEPROM at address cvE0 (decimal 80, I think) is the external
EEPROM (seperate chip) where the program is stored. Depending on the
length of your program, you can use the additional space on this
EEPROM for storage space but you cannot assign variables to it (hence
my first suggestion) You can only access bytes of storage by using
direct addressing.
The maximum size for an external EEPROM isactually 64k-bytes
(512kBits). I have used a 24LC512 with no problems.
If RShift, and LShift are only usable with oByte style variables,
then divide or multiply by powers of two for the same result. I
cannot remember if I have actually used that in a program before but
the code compiles which tells me that the compiler knows how to
handle it.
Dim A(8) As Nib:
This will use 9 bytes of space. The index is zero based and it will
not split the individual bytes in the memory space. Sorry. All of
these use 9 bytes of space:
Dim A(8) As Bit
Dim A(8) As Nib
Dim A(8) As Byte
--- In oopic@yahoogroups.com, "tuandung248" <trungtuandung@...> wrote:
>
> thank you. you're pretty clear but there are just some parts where
> i'm confused:
>
> 1. what's with the internal and external EEPROM? i'm buying a new
32Kb
> EEPROM (max for oopicR) to use but how to i use variables there?
> isn't the program code stored in the external EEPROM instead of the
> internal EEPROM? where doess the "EEPROM byte" let you store
variable to?
>
> 2. Don't Rshift, Lshift, etc only belong to object types that
inherit
> from oValue class? so they should only work if you use objects like
> oWord or oByte, instead of word or byte. So if I declare "Dim A(8)
as
> nib" don't I get 4 blocks of half-byte next to each other?
>
> As a sidenote, if I want to use bit shifting on a variable type, I
> think I have to assign the value to object type first.
> eg.
> Dim A as EEPROM word
> 'extreme example: if i wanna multiply A by 2
> Dim B as oWord
> B = A
> B = A.Lshift(1)
> A = B
>
> thanks again. This is a great place to learn from others.
>
> >
> > 1. You could do it that way but you are still going to have to
use
> > the same amount of variable space. There is not a varible
between a
> > byte and a word so you would end up with a decimal value between
0
> > and 729 (3^6). Since that is greater than 256 (8 bits) you have
to
> > go one step up to a word (16 bits). When you do this, you have
no
> > way to save the left over bits so use them however you want. So
your
> > method won't actually save any space over mine, they both use 729
* 2
> > bytes of storage. I don't know if I have made since here or not,
if
> > not, I will try to clarify.
> >
> > 2. Those statements will not work. There is only 256 bytes of
space
> > available on the EEPROM (Internal) and you are trying to use 2187
> > bytes. Also when you specify a nibble versus a byte, the
compiler
> > only lets you use the first 4 bits but all 8 bits are allocated
> > (Hense the RShift, LShift, Mod...). That is one reason I rarely
use
> > nibbles or boolean values, they do not save any space, they all
use
> > one byte of RAM space.
> >
>
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/oopic/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/oopic/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com
<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
No comments:
Post a Comment