Subject:
|
Re: Electrical Data Link between 2 RCXs
|
Newsgroups:
|
lugnet.robotics.rcx.nqc
|
Date:
|
Wed, 25 Oct 2000 16:08:30 GMT
|
Viewed:
|
2152 times
|
| |
| |
Bernd Frassek wrote:
> The following describes an "electrical data link" (one direction) between 2
> RCXs (see also my subject "Connecting 2 RCXs").
>
> The task is that one RCX sends a number (e.g. a status) to another RCX via a
> cable. The IR link cannot be used because they can't "see" each other. So, the
> output of the transmitting RCX is connected with the input of the receiving RCX
> (input set to TOUCH_SENSOR). The data link should be fast, allowing the
> receiving RCX to react quickly.
>
> The transmitting RCX generates a sequence of 1's and 0's
> The protocol is very simple: it consists of a startbit and 3 following bits,
> allwoing seven numbers (1 - 7) to be transmitted. The duration of each bit is
> around 30 ms. E.g. the output for a 5 ("101") would be
>
> _____|---------------|_______|-------|_________
> | start | bit 2 | bit 1 | bit 0 |
>
> ^ ^ ^ ^
> The above symbols (^) show the points of time when the receiving RCX checks the
> status of the bits. At first the routine will wait for a 1 at the input.
> Afterwards it waits for the end of the startbit (30 ms). A delay of 10 ms is
> performed. After that every 30 ms the bits 2 to 0 are checked. The whole
> transmission is 120 ms long (see below remarks about timing).
>
> The 1's and 0's are created by setting the motor output of the transmitting RCX
> to OFF for a 1 and to FLOAT for a 0 (thanks to Dean Husby for this "trick" -
> note, that by this procedure no voltage is being sent to the input of the
> receiving RCX).
>
> The two programs are given below. They work well with a cycle of 30 ms. Using
> 20 ms for each bit may lead to wrong numbers, due to the RCX's slow execution
> of statements (see also subject "Timing of RCX statements). Of yourse it would
> be nicer to have a more general program that allows transferring of an 8 bit
> number (1 to 255). I tried this out with a code like
>
> if ((num & 0x08) == 0x08) {_setbit;} else {_clrbit;}
> if ((num & 0x04) == 0x04) {_setbit;} else {_clrbit;}
> if ((num & 0x02) == 0x02) {_setbit;} else {_clrbit;}
> if ((num & 0x01) == 0x01) {_setbit;} else {_clrbit;}
>
> but I could not get a stable timing (i.e. equidistant bits) unless I increased
> the duration of a single bit to 100 ms or more and using a timer. The demand
> for a fast link won't be fulfilled. But for transmitting small numbers out of a
> set of seven like e.g. a status (e.g. 1 = drive, 2 = stop, 3 = move arm, etc.)
> the given programs are fine and the compiled code for the transmitting routine
> is fairly small.
Have you tried using SENSOR_MODE_EDGE or PULSE? Maybe it can keep track of it
better?
Edge could be very useful as it can count both on's and off's whereas pulse counts
only on's.
Dean
--
Coin-Op's For Sale!: http://www.akasa.bc.ca/tfm/coin-op.html
Dean's Lego Workshop: http://www.akasa.bc.ca/tfm/lego_wr.html
Vancouver Lego Club: http://www.akasa.bc.ca/vlc
|
|
Message is in Reply To:
| | Electrical Data Link between 2 RCXs
|
| The following describes an "electrical data link" (one direction) between 2 RCXs (see also my subject "Connecting 2 RCXs"). The task is that one RCX sends a number (e.g. a status) to another RCX via a cable. The IR link cannot be used because they (...) (24 years ago, 25-Oct-00, to lugnet.robotics.rcx.nqc)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|