Word Array
I know that there are no Word Arrays in SX/B so What would be a way to simulate them?
There has to be a way. but I'm not saavy enough to figure it out. [noparse]:)[/noparse]
I need a 4 element word array. I'm using an SX-28.
Thanks in Advance for any help,
Regards,
Eric
·
There has to be a way. but I'm not saavy enough to figure it out. [noparse]:)[/noparse]
I need a 4 element word array. I'm using an SX-28.
Thanks in Advance for any help,
Regards,
Eric
·

Comments
Start with some variables:
Declare a subroutine and function
And here is the code for those declarations:
' Use: PUT_WORD index, value ' PUT_WORD: tmpB1 = __PARAM1 IF __PARAMCNT = 1 THEN tmpW1 = __PARAM2 ELSE tmpW1 = __WPARAM23 ENDIF tmpB1 = tmpB1 << 1 myWords(tmpB1) = tmpB1_LSB INC tmpB1 myWords(tmpB1) = tmpB1_MSB RETURN ' Use: value = GET_WORD index ' GET_WORD: tmpB1 = __PARAM1 tmpB1 = tmpB1 << 1 tmpW1_LSB = myWords(tmpB1) INC tmpB1 tmpW1_MSB = myWords(tmpB1) RETURN tmpW1Post Edited (JonnyMac) : 3/9/2007 3:00:08 AM GMT
I get error until I Change
myWords(tmpB1) = tmpB1_LSB <--- To TmpW1_LSB
myWords(tmpB1) = tmpB1_MSB <--- To TmpW1_MSB
I'm still trying to understand what tmpB1 = tmpB1 << 1 is doing can you explain.
Byte variables do not have a _LSB or _MSB suffix.
tmpB1 = tmpB1 << 1 ' means to shift tmpB1 to the left 1 bit (effectively multiplying it by two)
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"Educate your children to self-control, to the habit of holding passion and prejudice and evil tendencies subject to an upright and reasoning will, and you have done much to abolish misery from their future and crimes from society"
Benjamin Franklin
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
www.hittconsulting.com
·
I understand what "tmpB1 = tmpB1 << 1" means I'm just not sure why he used it in the code above.
Regards,
Eric
Thanks Jonny for the code.··
Declare a subroutine and function
And here is the code for those declarations:
' Use: PUT_WORD index, value ' PUT_WORD: tmpB1 = __PARAM1 IF __PARAMCNT = 1 THEN tmpW1 = __PARAM2 ELSE tmpW1 = __WPARAM23 ENDIF tmpB1 = tmpB1 << 1 myWords(tmpB1) = tmpW1_LSB ' I changed this line INC tmpB1 myWords(tmpB1) = tmpW1_MSB ' I changed this line RETURN ' Use: value = GET_WORD index ' GET_WORD: tmpB1 = __PARAM1 tmpB1 = tmpB1 << 1 tmpW1_LSB = myWords(tmpB1) INC tmpB1 tmpW1_MSB = myWords(tmpB1) RETURN tmpW1[/code][/size]