Subject:
|
New pbLua Beta13o - Now with FLASH Writing!
|
Newsgroups:
|
lugnet.robotics.nxt
|
Date:
|
Wed, 12 Sep 2007 02:04:06 GMT
|
Viewed:
|
22112 times
|
| |
| |
All of you that have been helping to test pbLua....
I have released another Beta of pbLua - and it's got
FLASH writing (and reading) goodness in it.
<http://www.hempeldesigngroup.com/lego/pbLua/>
It does not yet have the ability to boot from a string in
FLASH but it's very close. The nxt.MemInfo() routine returns
some key information, including the address of the start of
user FLASH, and the start address and length of a string starting
with "-- FLASH Boot" in user FLASH. If there is no string that
matches, you get 0.
If you could put a string into FLASH, then you could read it
out and run it! Here's how to use it:
s = "-- FLASH Boot\n"
s = s.."nxt.SoundTone()\n
s = s.."\000"
The null termination is important. You could put it all on
one line like this:
s = "-- FLASH Boot\nnxt.SoundTone()\n\000"
Now put the string in FLASH, like this:
a=nxt.MemInfo()
This gets you the start address of user FLASH
nxt.MemWrite(a,s)
This writes the string in FLASH, now reboot the NXT and get
back to the console...
a,b,n=nxt.MemInfo()
This time b is the start address of the boot string, n is the
length of the boot string...so read the boot string...
boot=nxt.MemRead(b,n)
Now load the string into a function and execute it:
f = loadstring(boot)
f()
You should hear a tone!
Cool, huh? I'll have the autoboot ready after I do a bit more work...
Cheers, Ralph
|
|
Message has 2 Replies:
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in NXT programmable brick
|
|
|
|