In SX Microcontrollers, SX/B Compiler and SX-Key Tool, robotworkshop wrote: Hello Joe, The SX48 has couple bytes less general RAM than the SX28 since it has two more ports than the SX28. The SX28 treats the unused ports as a little extra RAM. As far as I know, word variables can only be defined and reside in general RAM. They don't seem to be supported in arrays. I usually define any word variables early and move most of the byte variables into an array. When doing so you can give it a regular name so you don't always have to use the index of the array. As an example: mtrStruct VAR Byte (16) encOld VAR mtrStruct(0) ' previous encoder bits encNew VAR mtrStruct(1) ' new encoder bits m1Dir VAR mtrStruct(2) ' Motor 1 Direction m1tDir VAR mtrStruct(3) timout1 VAR mtrStruct(5) ' LSB of timeout timout2 VAR mtrStruct(6) ' MSB of timeout timWrk VAR mtrStruct(7) ' Work variable You can access the variables either using the array name and index or by just using the variable name. This only works for bytes. JonnyMac has posted some ISR based Serial code to the list and that has a great example of a byte array used as an array as well as for variables. First, I would assign all your word variables first and move any bytes into an array. If it is still tight then take a good hard look to see if you REALLY need all the work variables you are using. If you have to have them then you'll just have to leave a word variable available as a work variable and store some of your words in byte array. When you need to work with them you can pull it out and put it in the work variable like: TmpW1_LSB = ByteArray(0) TmpW2_MSB = ByteArray(1) When you are done just store it back: ByteArray(0) = TmpW1_LSB ByteArray(1) = TmpW1_MSB As you write larger programs there are a few quirks like this but once you are aware of them it isn't too bad to code around them. Good luck, Robert ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=257850#m257866 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)