SX/B - copy data from one RAM address to another
John Couture
Posts: 370
The SX/B online help references a __RAM() in it???
I'm trying to create a STRING variable where I can change the contents:
For example:
'
Name:
··· "Bill"· ' the contents of this will vary at runtime
Message:
···· "My name is John"
'
to something like
'
Message:
···· "My name is Bill"
'
1) READ has to address information in a DATA statement (I think)??
2) I don't think·I can use DATA because the contents of a data variable cannot be changed at runtime??
3) I think·the solution is somewhere with declaring the variables as byte arrays and moving data between them one byte at a time.
4)·I guess I'm unclear as to how to move data from one RAM address to another in·a FOR loop using the @ operator.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
I'm trying to create a STRING variable where I can change the contents:
For example:
'
Name:
··· "Bill"· ' the contents of this will vary at runtime
Message:
···· "My name is John"
'
to something like
'
Message:
···· "My name is Bill"
'
1) READ has to address information in a DATA statement (I think)??
2) I don't think·I can use DATA because the contents of a data variable cannot be changed at runtime??
3) I think·the solution is somewhere with declaring the variables as byte arrays and moving data between them one byte at a time.
4)·I guess I'm unclear as to how to move data from one RAM address to another in·a FOR loop using the @ operator.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Sorry for being so dense. Using your READ2.SXB code from a couple of weeks ago as base code, I added the following variables and code. I don't understand why the TX_STR does not work with the array (it works ok with the string constants)? I tried TX_STR #tempArray,10 and TX_STR @tempArray,10 I know the tempArray is in the RAM area and the string constants are in the EEPROM area .... is there a syntax trick that I am missing?
'
' NEW VARIABLES
'
intChar VAR byte
aryIndex VAR byte
tempArray VAR Byte(16)
aryEnd var byte
'
' NEW CODE (just before your goto Start)
'
intChar = "A" ' Letter "A"
aryEnd = 0 ' Just to make sure array is zero terminated
TX_STR "Sending Characters "
FOR aryIndex = 0 to 14
tempArray(aryIndex) = intChar ' fill array with ABCDEF....
TX_BYTE tempArray(aryIndex)
INC intChar
NEXT
TX_STR CRLF
PAUSE 1000
TX_STR "Sending a String "
TX_STR tempArray,10
TX_STR CRLF
GOTO Start
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College
TX_STR only works with strings that are stored in the PROGRAM MEMORY, your array is stored in RAM.
One routine cannot be used to do both you must use READ to get characters from program memory and GET to read characters from an array.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"SX-Video·Module" Now available from Parallax for only $28.95
http://www.parallax.com/detail.asp?product_id=30012
Product web site: www.sxvm.com
Available soon!! Video overlay(OSD) module...
"I'm a man, but I can change, if I have to, I guess"
Red Green
·
Thank You! Some of this is actually sinking in!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
John J. Couture
San Diego Miramar College