Assigning a string variable to another string variable
I'm so close I can smell it.
I'm using this to get my data:
Code:
DAT VAR byte[255]
UNIT1 VAR byte[255]
UNIT2 VAR byte[255]
UNIT3 VAR byte[255]
CMD VAR BYTE
HSERIN 1, COMPLETE_RX_TRANSFER,[wait ("&"),dec2 CMD, STR DAT\255\"#"]
This works well. The problem is, I want to filter the DAT data and then assign different string variables for the DAT. It looks like this:
Code:
SELECT CASE CMD
CASE 80
UNIT1=DAT
CASE 81
UNIT2=DAT
CASE 83
UNIT3=DAT
END SELECT
The problem is that when I go to display the newly assigned variables I only get the first character. I've tried UNIT1=DAT\255 and that returns an error. What am I missing? I know I can just filter it with HSERIN but I thought it would make the program quicker if I used one HSERIN statement and then used select case to sort the data.
Re: Assigning a string variable to another string variable
Hi,
I don't quite understand why you need to do what you're trying to do, it seems like a waste of RAM to have multiple copies of the same data instead of just acting on the data stored in the DAT array. But anyway, one way would be like
Code:
i VAR BYTE
For i = 0 to 254
UNIT1[i] = DAT[i]
NEXT
/Henrik.
Re: Assigning a string variable to another string variable
I'm not quite sure what I'm doing but your technique worked well.
Thanks.