Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/07/02 02:33
Read: times


 
#21502 - RE: quick question on ASM variables
First and foremost, you cannot define a variable with DB, that defines a byte in Code Memory and you will not be able to write to that location. To define a variable you need to use EQU such as
VAR1: EQU 50h
You now have a variable named VAR1 which resides in Internal Ram (IRAM) location 50h and you can read and write to it unrestricted. To shift the bits in this variable you must first move it to the Accumulator, shift left or right, and move the accumulator back to the variable.
When defining variables be careful to stay away from IRAM used by the Stack. I usually set the Stack Pointer to 30h and start defining variables at 50h.
Also, be aware that in 8052 Assembler a variable is one bit or one byte. If a larger variable is needed you need to define each byte and manage the larger varible yourself. There are no double byte or double word variables.

Hope this helps

Hal

List of 16 messages in thread
TopicAuthorDate
quick question on ASM variables            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: ASM variables, moving thru it            01/01/70 00:00      
RE: ASM variables, moving thru it            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: quick question on ASM variables, Rob            01/01/70 00:00      
RE: quick question on ASM variables, Rob            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: data segment variables wont work?            01/01/70 00:00      
RE: quick question on ASM variables            01/01/70 00:00      
RE: data segment variables wont work?            01/01/70 00:00      
RE: Thanks!!            01/01/70 00:00      
RE: Thanks!!            01/01/70 00:00      

Back to Subject List