Table/Lookup with SX/B?
Hey everyone, I've been using Stamps for a little while now and have been arond but first time poster because I'm starting to play around with the SX for fun. I'm a car guy so my ultimate goal is to get a fuel injection engine running on an SX. I've alread done traction control and shifting control with a BS2sx. I'm sure I'll have tons of questions but here's the first:
I need to make a table (fuel map) and from what I've read so far it seems like DATA/WDATA is the way to do it but I can't figure out how to READ a specific value. Here's an example of the table I made (values are just in there as place holder... it'll be tuned if it ever gets connected to an engine
)
I've read up the examples on displaying the whole string but I just want to grab a data based on the load and RPM
So far I've got: (say for 1,000 RPM and xx load)
I just have no idea how to get over to the xx word.
I could also be completely in left field so if that's the case, please point me in the correct direction.
Thanks!
Adam
I need to make a table (fuel map) and from what I've read so far it seems like DATA/WDATA is the way to do it but I can't figure out how to READ a specific value. Here's an example of the table I made (values are just in there as place holder... it'll be tuned if it ever gets connected to an engine
![tongue.gif](http://forums.parallax.com/images/smilies/tongue.gif)
'======================================== FuelLoad var word FuelMap: 'LOAD x xx xxx 'RPM WDATA 65535, 65535, 65535, 65535, 65535, 65535, 65535 ... '500 WDATA 65535, 65535, 65535, 65535, 65535, 65535, 65535 ... '1000 WDATA 65535, 65535, 65535, 65535, 65535, 65535, 65535 ... '1500 ... '=========================================
I've read up the examples on displaying the whole string but I just want to grab a data based on the load and RPM
So far I've got: (say for 1,000 RPM and xx load)
READ FuelMap + 2, FuelLoad
I just have no idea how to get over to the xx word.
I could also be completely in left field so if that's the case, please point me in the correct direction.
Thanks!
Adam
Comments
· Each WDATA entry is 2 bytes. So it depends on how many entries are in each line.
· If you had 10 entries in each RPM linel, you would have to add 20 to get to the 1000 RPM line, 40 to get to the 1500 RPM line, etc.
· Something like:
· Of course this could be optimized, but I wanted to show the logic behind it.
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
Post Edited (Bean (Hitt Consulting)) : 5/5/2008 11:04:17 AM GMT
So, I'm assuming that when I point it at a byte it's going to read in a word value through, right? or do I have to do READ twice and combine the bytes?
Thanks, Bean and whoever fixed the spacing in my example. [noparse]:)[/noparse]
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Did you know that 111,111,111 multiplied by 111,111,111 equals 12345678987654321 ?
www.iElectronicDesigns.com
·