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 / 26444
26443  |  26445
Subject: 
Re: Bluetooth Direct and System Commands
Newsgroups: 
lugnet.robotics
Date: 
Mon, 18 Sep 2006 00:40:03 GMT
Viewed: 
2772 times
  
In lugnet.robotics, Brian Bagnall wrote:
There are some Bluetooth commands that are a little cryptic and sparsely
documented in the official Lego docs. I was wondering if anyone could point me
to some talk on this or shed some light on what these are used for:

Direct Commands:

MESSAGEWRITE
MESSAGEREAD

MessageRead is used to read a message from one of the 10 message queues
(optionally clearing the message after it is read).

MessageWrite is used write a message to one of the 10 message queues on the NXT.

Neither one of these will do anything (except return an error message) unless
there is a program running on the NXT.

LSGETSTATUS
LSWRITE
LSREAD

These three are used to communicate with I2C devices (sensors) such as the
Ultrasonic sensor.  The typical usage is to write a message telling the sensor
to do something, repeatedly get the status until it indicates that the sensor is
ready, and then read to get the sensor's response.  Something like this:

thread ReadLS
syscall CommLSWrite, lswArgs

DoCheckStatus:
subcall CheckLSStat, chkls_ret
// check return values of subroutine and repeat if needed
or bBadRead, bLSStatEQ0, bLSStatLT0
brtst EQ, DoCheckStatus, bBadRead
// ls status checks out okay

syscall CommLSRead, lsrArgs
mov readBuf, lsrArgs.Buffer
subret rlsb_ret
endt

To read byte 1 from the US sensor you write 0x02 0x42 using LSWrite and then
after you get status (LSGetStatus) until it reports okay you read (LSRead) with
a buffer of 1 byte.

System Commands:

OPEN WRITE LINEAR
OPEN READ LINEAR (INTERNAL COMMAND)
OPEN WRITE DATA
OPEN APPEND DATA

OpenWriteLinear is used to create an executable file (.rxe, .rtm, or .sys) or an
icon file (.ric) on the NXT.  OpenWriteData is used to create any other type of
file on the NXT.  OpenAppendData is used to open an existing file that has not
been completely filled up yet so that you can append more data to the end of the
file.  OpenReadLinear is used internally to open and read executable files and
icons.

POLL COMMAND LENGTH
POLL COMMAND

These, I believe are used to read data from the high speed port (which is not
used in the standard NXT firmware, to the best of my knowledge).

John Hansen



Message is in Reply To:
  Bluetooth Direct and System Commands
 
There are some Bluetooth commands that are a little cryptic and sparsely documented in the official Lego docs. I was wondering if anyone could point me to some talk on this or shed some light on what these are used for: Direct Commands: MESSAGEWRITE (...) (18 years ago, 17-Sep-06, 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