To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.nxtOpen lugnet.robotics.nxt in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / NXT / 930
929  |  931
Subject: 
New pbLua Beta13o - Now with FLASH Writing!
Newsgroups: 
lugnet.robotics.nxt
Date: 
Wed, 12 Sep 2007 02:04:06 GMT
Viewed: 
21756 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:
  Re: New pbLua Beta13o - Now with FLASH Writing!
 
(...) Way cool ! Exciting ! (17 years ago, 12-Sep-07, to lugnet.robotics.nxt)
  Re: New pbLua Beta13o - Now with FLASH Writing!
 
(...) Hi Ralph, WOW, great work!!! It works perfectly... Some additional notes and documentation about storing Lua programs at flash memory is available at: (URL) for your excellent support Christian (17 years ago, 20-Sep-07, to lugnet.robotics.nxt)

5 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR