To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcxOpen lugnet.robotics.rcx in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / 2728
2727  |  2729
Subject: 
RCX to RCX NQC
Newsgroups: 
lugnet.robotics.rcx
Date: 
Tue, 13 Sep 2005 01:03:27 GMT
Viewed: 
4210 times
  
   In a semi-followup to Steve's earlier "remote battery tester"... While the
standard firmware provides almost no way to get bytes into the RCX (other than
"Message()", one byte at a time), it can certainly export them ("SendSerial").
And it occured to me this might work as well, if the "remote" RCX sends a series
of bytecodes that display the battery voltage on the LCD of the "slave". The 2.0
SDK mentions (pg60):

   "With proper setup of the data formatting (0x03)
   and transmit control parameter (0x00), the command
   [SendUARTData (0xC2)] can be used to send IR
   commands to other RCXs - just look up the byte
   codes in this document, [etc.]"

So, I tried it with the following program, just to get the slave RCX to beep.
Command 0xD2 simulates the remote, while the two bytes following it should send
a "remote beep" command:

task main()
{
SetSerialComm(0x00);
SetSerialPacket(0x03);

SetSerialData(0, 0xD2); // RemoteCommand
SetSerialData(1, 0x80); // | flags for just the remotes
SetSerialData(2, 0x00); // | "double beep"
SendSerial(0, 3);       // send serial data
}

That works great... once. Then the slave RCX does nothing (i.e.- it will not
respond to the master RCX running the same program again). If I use the "real"
remote on the slave, it will respond to that, and after it will respond again,
*once* to the master RCX program.
   OK, so going back to the SDK, there's a note that "to execute several remote
commands, send a 'remote 0' between them to clear internal buffers" (pg61). Add
that and it works again, as I'd expect (i.e.- the slave beeps every time the
master runs the program):

SetSerialData(0, 0xD2); // |
SetSerialData(1, 0x80); // | Send a "remote beep" command
SetSerialData(2, 0x00); // |
SendSerial(0, 3);       // |
SetSerialData(1, 0x00); //   | Send a "remote 0" command
SendSerial(0,3);        //   |

But if I try something different, like PlaySystemSound (0x51) or SetWatch
(0x22), it seems again to work only the first time the slave "sees" it, and the
slave can only be reset to a receptive state by accepting a command from the
"real" LEGO remote (even turning the slave off & on doesn't "reset" it) or using
the "remote 0" command.
   First actual question: is this the case, or am I missing something about
bytecodes in immediate mode?

   Second, after trying a number of things, I can't get the display to show the
battery level in this "remote" way. In other words, when I try sending a byte
stream like "e5 00 03 22 00 00", (that should, according to the SDK as well as a
disassembled NQC program, set the LCD display to the battery level), I get...
zilch. Nothing. Aaarrgh.
   Any suggestions? Is this a case where the bytecode may be acted upon by the
slave RCX, but it returns to the default "show watch" state so rapidly that
nothing ever displays on the LCD? Is this the end of Rico?

--
Brian Davis
"The same thing we do every night, Pinky... try to take over the world, one RCX
at a time."



Message has 1 Reply:
  Re: RCX to RCX NQC
 
On Mon, September 12, 2005 8:03 pm, Brian Davis wrote: ... (...) ... Somewhere in there, it tells you the RCX will not accept the same command twice in a row. Each command has two op codes that are 8 digits apart. So (I think) for SetWatch you (...) (19 years ago, 13-Sep-05, to lugnet.robotics.rcx)

8 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