Welcome! Log In Create A New Profile

Advanced

fload and frun....last resort is to ask....LOL

Posted by Tinine 
fload and frun....last resort is to ask....LOL
September 11, 2016 10:39PM
Spent most of my day trying to make sense of these. Are there any proven examples available?

frun just gives me "General exception address 9d007c14"....The manual example doesn't work.

ByPic is still putting a big ol' smile on this face :-D

Cheers!
Re: fload and frun....last resort is to ask....LOL
September 12, 2016 09:01AM
details are in the Documentation keywords tab, specifically:

fload: here
frun: here
Re: fload and frun....last resort is to ask....LOL
September 12, 2016 10:44AM
The documentation is where I learned of their existence. The frun example gives me the aforementioned error and fload has no example. I mean; if you fload functions from a file, how do you call the functions?

The code cannot be successfully downloaded if it has calls to functions that don't exist and won't exist until dynamically loaded at runtime, right?

I must be missing something.
Re: fload and frun....last resort is to ask....LOL
September 12, 2016 03:24PM
These can only be used with SD card files.

It really needs an example so:

this file is called main.bas on the SD card, it will run at start up because its called main.bas
function main()
    print "\nChecking loaded files"
    if lookup("ROOKIE3_1") = 0 then
        print "\n** Loading Rookie3 1 **"
        fload("MX170_~1.bas")
        flsave("ROOKIE3_1")
        reset
    endif
    if lookup("ROOKIE3_2") = 0 then
        print "\n** Loading Rookie3 2 **"
        fload("MX170_~2.bas")
        flsave("ROOKIE3_2")
        reset
    endif
    frun("start.bas","go","")
endf

The files "mx170_~1.bas" and "mx170_~2.bas" are also on the SD card (short file names). At the start of mx170_~1.bas is:

constant ROOKIE3_1 1

and at the start of mx170_~2 is:
constant ROOKIE3_1 2

lookup("ROOKIE3_1") will search flash and RAM and return 0 if that function or constant is not there and so it is loaded by fload and then saved by flsave. Normally flsave is used with flsave("") but flsave("ROOKIE3_2") will save that constant or function and everything after it.

reset is required after flsave.

frun is used to load a file on the SD Card called start.bas and then execute the function called go.
Re: fload and frun....last resort is to ask....LOL
September 12, 2016 10:13PM
Many thanks, Jim.

I was thinking that I could load/execute functions from SD willy-nilly without wiping-out existing code/data. I don't need this but I am just trying to get to know ByPic inside-out.

I have been programming a machine control simulation with awesome results. I am currently using a COTS (commercial-off-the-shelf ) controller that costs me big bucks....ByPic is, at worst-case 40X faster!!!!!!

Sorry to sound like a broken record but I am LOVING this thing!!! Didn't quit playing until 4am this morning and I had a conference call at 8am....LOL.

Can't fathom that this forum is not buzzing with activity.
Re: fload and frun....last resort is to ask....LOL
September 13, 2016 09:04AM
I think if that had been me I would have not been able to make that call (bit of a lightweight).

It's nice to hear that you get the concept, actually not that many people do and they probably never will. The concept of write, compile, download, run and test is too entrenched. I have a few products that need Arduino libraries and although the Arduiono is a great concept it is so slow to develop on compared.

Come to think of it that is where the paradigm originates. If you take a processor and compile with C it runs as fast as it can get - and will of course run faster than ByPic. All specifications, adverts, the way developers think are based on processor speed. But there is no though of how quick it is to actually develop on! How mad is that?

Just thinking out loud but I never thought of that before, providing the processor is fast enough (and it usually is) its not the processor speed that is important but the development speed and ease of use.

I suppose I ought to get in touch with Siemens, but never will - might update the website though.
Sorry, you do not have permission to post/reply in this forum.