Subject:
|
Re: sending variables betwen rcx's?
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Tue, 13 Mar 2001 02:46:44 GMT
|
Viewed:
|
2252 times
|
| |
| |
My advice would be to try and solve the problem using the regular
message facilities (SendMessage(), ClearMessage(), Message()). If you
have more than 255 values to convey between the RCX's, then you can try
chaining multiple messages together (with an appropriate delay between
to allow the receiver to handle the first one).
With the 2.0 firmware, its possible to have an RCX send an arbitrary
command packet. This is one-way communication - there is no arbitrary
read capability. You could use this to manually set a global variable
on the other RCX (use the setv bytecode - see Lego's bytecode
documentation in the SDK for more details).
The -l (ell, not one) option for NQC will generate a code listing,
which can be a handy way to figure out the bytecodes if you know what
you want to do from NQC. For example, the following program:
------
#pragma noinit
int x, y;
task main()
{
x = 7;
y = x * 3;
}
------
generates this listing:
*** Task 0 = main
000 setv var[0], 7 14 00 02 07 00
005 setv var[1], var[0] 14 01 00 00 00
010 mulv var[1], 3 54 01 02 03 00
Total size: 15 bytes
-------
The first bytecode sets var #0 (x) to 7. The second copies var #0 (x)
to var #1 (y). The third multiplies var #1 by 3. You'll probably be
using the setv bytecode (0x14).
The RCX tries to perform duplicate reduction on incoming packets. For
this reason, you may have to alternate between sending the normal
bytecode (0x14) and setting bit 3 (0x1c). This is because if the RCX
received two 0x14 packets in a row, it may ignore the second one
thinking its a duplicate of the first. I know this happens for a lot of
bytecodes, but I'm not positive that setv is duplicate reduced.
Dave Baum
In article <GA3zqL.22n@lugnet.com>, "adam craggs"
<craggsag@dcs.gla.ac.uk> wrote:
> to all
>
> i am currently working on a robot with 2 rcx due to the number of sensors
> i
> have on the robot.
>
> my current problem is that i have 2 light sensor which is conected to
> seperate rcx. one of the rcx with light sensor is calibrated using some
> coloured card. i would like to know how i could send variables / values /
> a
> datalog from 1 rcx to other.
>
> i am currently using rcx2 firmware and have a knowlege of messages
> although
> these canot solve the problem with this.
>
> i looked into some of the low level serial codes 0x50 stop all task in
> the
> documentation. there are many pages and i think there may be a solution
> there but i dont understand how these documentation works. anyone help i
> will be most gratefull as i am quite new to mindstorms and nqc and trying
> this quite difficult project. many thanks.
>
> thanks again...
>
> from adam
--
reply to: dbaum at enteract dot com
|
|
Message has 1 Reply:
Message is in Reply To:
| | sending variables betwen rcx's?
|
| to all i am currently working on a robot with 2 rcx due to the number of sensors i have on the robot. my current problem is that i have 2 light sensor which is conected to seperate rcx. one of the rcx with light sensor is calibrated using some (...) (24 years ago, 12-Mar-01, to lugnet.robotics.rcx.nqc)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|