Quote:
Originally posted by Cheese Head

I have a couple of questions I have been able to figure out. I figure that you people here could give me accurate answers, in english. Here's what they are:
1) What is 2's compliment? how does it work? what would I use it for?
2) Is there any way to get more than 26 variables? What determines that, like is a memory constraint?
3) What is the difference between GET and PUT?
4) What are the EEPROM and Scratchpad RAM? What is the difference?
5) How can I use the NOT command? Using the ~ does not seem to work for us, maybe we are using it wrong.
Thanks in advance!
|
Basic Stamp User's Manual - A FIRST Programmer's Holy Bible
Many of the answers to your questions can be answered here.
1) Answered above.
2) 26 variables is not the constraint. The constraint is actually 26 bytes. You can meet this using any combination of words (2 bytes, numbers 0-65535), bytes (0-255), nibs (1/2 byte, numbers 0-15 (useful for speed settings)), and bits (1/8 byte, only 0 or 1 (useful for on/off)).
Technically there are 32 bytes, but 6 are used by the chip for I/O Pins and such.
One way to get around the limitation is by loading the program into "slots". Read the manual for more details. Basically, when a slot is loaded the same RAM is used, erasing all the previous contents. Scratchpad RAM, however, is carried over between slots. There are 64 bytes present (and bytes only). Only 0-62 are available. Read the manual to learn how to use it (GET and PUT commands).
3) Check the manual. GET retrieves a value from Scratchpad RAM. PUT places a value into a Scratchpad RAM location.
4) 1. EEPROM is where your program is stored. It can be written to, but only all-or-nothing. The entire EEPROM needs to be erased and then data sent to it.
2. RAM on the chip is available for your program to use. 26 bytes are available for variable use. These can be used to add/subtract/divide/multiply numbers.
3. Scratchpad RAM is available for storing numbers only. You can't perform math operations with it.
5) ~ will inverse the bits. For example, 128 becomes 126. 0 becomes 255. 1 becomes 254, etc. 127 is still 127.