To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 15187
15186  |  15188
Subject: 
RE: Serial Port Protocol
Newsgroups: 
lugnet.robotics
Date: 
Tue, 17 Apr 2001 01:46:11 GMT
Original-From: 
James Matthews <GENERATION5@BTINTERNETantispam.COM>
Reply-To: 
<jmatthews@STOPSPAMgeneration5.org>
Viewed: 
666 times
  
Hi there,

I've just gone through this myself, only a few days ago. Check

http://www.generation5.org/aisolutions/rob08.shtml

...and it should answer your question. But to cut-and-paste what I wrote:

===========================================
Sending the Same Message
You cannot send the same message to the RCX, since the RCX never executes
the same opcode twice in a row. Therefore, every opcode comes with an
alternate opcode with the 3rd bit set (1000 in binary, 0x08 in
decimal/hexadecimal). Therefore, if I wanted to check for the battery level
again, I'd have to send another opcode set, with the 0x08 bit set and all
the complements and checksums updated. Therefore, my second battery request
would look like:

char buffer2[7] = { 0x55, 0xff, 0x00, 0x38, 0xc7, 0x38, 0xc7 };

Want to check the battery again? Then change back to the normal code and
alternate.
===========================================

FYI, my first battery request looked like:

      char buffer[7]  = { 0x55, 0xff, 0x00, 0x30, 0xcf, 0x30, 0xcf };

HTH,

James.


-----Original Message-----
From: news-gateway@lugnet.com [mailto:news-gateway@lugnet.com]On Behalf
Of douglas edric stanley
Sent: 17 April 2001 01:23
To: lego-robotics@crynwr.com
Subject: Serial Port Protocol


Hi all. I'm new to the list.

I'm using Robolab and NQC on a Mac, interfacing with Macromedia Director 8
through the serialXtra. So far so good, thanks in no small part
to the info
posted by Dave Baum and Kekoa Proudfoot. I can make the Lego
"beep" and send it
messages which control the RCX. All from Director. When I get it working
perfectly I can put it open-source somewhere, as I saw on the list that
periodically people ask about interfacing Director with
Mindstorms. I've done a
lot of robotics interfacing with Director, and I've always found
it a perfect
match.

But it's not perfect yet. I've run into the odd repeat-serial
communications
protocol issues. When I clear out the message buffer in my
Robolab program,
message sending works fine, i.e. I can send over and over the
same message.

But when I do a "beep", as Dave Baum explained how to do, I run into the
messaging problems Kekoa outlined at:

http://graphics.stanford.edu/~kekoa/rcx/#Protocol

Notably: "Messages sent by PC seem to alternate between having
0x08 set and not
set. This 0x08 bit is a sequence bit only in one special case. RCX never
executes same exact opcode twice in a row. Second and beyond are
dropped. But
the same reply that was sent the first time is sent again. Toggle
0x08 bit to
make sure same opcode twice in a row is accepted."

I'm not totally sure I understand this. I don't know what Opcodes are. I
undstood the following comment, "Sometimes packets start with aa
ff 00 instead
of 55 ff 00", so I made a flip-flop header routine that switches
between "55"
and "AA" (I guess this is 0x55 and 0x100-0x55 ?)  in Lingo and I
stop getting
parity errors from the Serial Xtra. But I still haven't
understood exactly what
the 0x08 bit is. Where is this 0x08 bit? For me, the 0x08 bit is
2^7. So do I
add 128? Or is this some sort of signed/unsigned issue? (I'm not
an expert at
all this, I get by as well as I can).

When Dave wrote:

"At the packet level, all packets look like this: '0x55 0xff 0x00
D1 ~D1 D2 ~D2
... Dn ~Dn C ~C' where D1...Dn are the message body, and C = D1 +
D2 + ... Dn.
The data for sending an IR message is F7 followed by the 8 bit
"message". For
example: '55 ff 00 f7 08 12 ed 09 f6' "

I got it, and it got messaging working, but this was incomplete.
When you try
this with sending a beep (D1 = 0x51, D2 = 0x03) you can only send
it once. You
have to send another message before sending a second beep.

So I'm kind of trapped between Dave's explanation which is, for me, half
complete (because he doesn't explain how to deal with toggling
issues at the
packet level); and Kekoa's response which was just slightly over
my head. I've
done bitmasking and all that fun stuff, but again I'm not a pro.
I only get by
with tinkering...

Douglas Edric Stanley
destanley@mac.com

http://www.abstractmachine.net

Professor of Digital Arts, School of Fine Arts, Aix-en-provence
Artist-in-residence, Laboratoire SCAN, Villa Arson, Nice
Artist/Researcher, Interactive Aesthetics Lab (LEI), University of Paris 8




Message is in Reply To:
  Serial Port Protocol
 
Hi all. I'm new to the list. I'm using Robolab and NQC on a Mac, interfacing with Macromedia Director 8 through the serialXtra. So far so good, thanks in no small part to the info posted by Dave Baum and Kekoa Proudfoot. I can make the Lego "beep" (...) (23 years ago, 17-Apr-01, to lugnet.robotics)

4 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