To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2168
    Storing Data —Steve Hassenplug
   When using LegOS (a most excellent creation, btw) is it possible to store a value and use it in different programs? Actually, I'm sure it is, but how would someone do it? I want to have one program to configure my light sensor, and use those values (...) (23 years ago, 20-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: Storing Data —Michael Obenland
   (...) What you request is shared memory and shared memory is not a part of legOS. My way to simulate shared mem is to put the two (or more) tasks into one legOS program. Each task is started as a thread by an execi() call, triggered by the user via (...) (23 years ago, 21-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: Storing Data —John A. Tamplin
   (...) As there is no memory management, any memory not on the stack is by definition shared between any threads. Concurrency control is up to you however. John A. Tamplin jat@jaet.org 770/436-5387 HOME 4116 Manson Ave 770/431-9459 FAX Smyrna, GA (...) (23 years ago, 21-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: Storing Data —Steve Hassenplug
   (...) It was suggested by some of my 'c++' co-workers that this was the case (shared memory was available). However, I don't deal with that in my Visual Basic world. They also suggested there were 'unused' memory blocks in LegOS where data could be (...) (23 years ago, 21-Dec-01, to lugnet.robotics.rcx.legos)
   
        How to make shared memory....not —Michael Obenland
   (...) You ask for it, you get it. BUT: It works, sort of. It will not survive any multitasking problems. Shared memory has to be handled by the OS, not by a user program. I split your problem to 3 programs. Program 1 allocates the memory and prints (...) (23 years ago, 22-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: How to make shared memory....not —Steve Hassenplug
   (...) Thanks, Michael. This appears to be exactly what I'm looking for. I assume if I want to store more values, I can just change the 'shared' struct, right? (add l, m, n...) When you say 'multitasking problems', you're talking about storing & (...) (23 years ago, 27-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: How to make shared memory....not —Michael Obenland
   (...) Yes. That is the only thing you have to do. You can store whatever you want. (...) Exactly. If you know you what you do, nothing bad can happen. BTW., this scheme can be extended to something like a shared library. If you store pointers to (...) (23 years ago, 27-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: How to make shared memory....not —Steve Hassenplug
   (...) ooohh. I like that idea. So I can write one program with all my functions and my other programs can just include a couple function calls. Again, in my VB world, I don't mess with pointers. When you have a minute, can you type up a sample (...) (23 years ago, 27-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: How to make shared memory....not —Andy Gombos
     I think this is what you want, but I am still learning. :) int inc (int&); int dec (int&); int (*pFunc) (int); //pointer to a function that accepts/returns an int if (add) { pFunc = inc; } else { pFunc = dec; } int a = pFunc(10); So, if add is true, (...) (23 years ago, 27-Dec-01, to lugnet.robotics.rcx.legos)
    
         Re: How to make shared memory....not —Steve Hassenplug
     (...) Yes, I'm sure I can. And I think it would be 'safer' that way. But Mike's idea about functions sounds interesting. I don't really have any idea about how I would use that in a real program, but it sure sounds interesting. Steve (23 years ago, 27-Dec-01, to lugnet.robotics.rcx.legos)
   
        Re: How to make shared memory....not —Michael Obenland
   Hi Steve, (...) Yes. Actually, I am working on a robot that finds a path trough a maze. After solving the maze, a second program can run through the maze with the informations from the first program. (I will do this with shared mem). Both programs (...) (23 years ago, 28-Dec-01, to lugnet.robotics.rcx.legos)
 

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