[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Motor State





Begin forwarded message:

From: Dave Baum <dbaum@enteract.com>
Date: 2000-06-06 01:59:59 +0200
To: "Axel T. Schreiner" <axel@uos.de>
Subject: Re: Motor State
In-Reply-To: <004601bfced5$92c98720$55829fc1@Noname>
Delivered-To: axel@luna2.informatik.Uni-Osnabrueck.DE
X-Sender: dbaum@pop.enteract.com
X-UIDL: c112c6095c10979ef9eb66d01c17cdeb

>Is it intentional that you do not provide access to motor states  
from nqc?
>I defined
>
>#define MOTOR_A  0 // macros for motor state
>#define MOTOR_B  1
>#define MOTOR_C  2
>#define isOn(n)  ((@(0x30000 + (n)) & 0x80) != 0)
>#define isOff(n) ((@(0x30000 + (n)) & 0xc0) == 0x40)
>#define isFloat(n) ((@(0x30000 + (n)) & 0xc0) == 0x00)
>#define isFwd(n) ((@(0x30000 + (n)) & 0x08) != 0)
>#define isRev(n) ((@(0x30000 + (n)) & 0x08) == 0)
>#define Power(n) (@(0x30000 + (n)) & 0x07)

Just laziness on my part.  The 2.2 API added

#define OutputStatus(n)		@(0x030000 + (n))	// read the
output status

and a similar one for global output status.  However, I didn't do all 
of the processing and comparisson like you've done.  I may add a few 
more macros and #defines before going final with 2.2.

Dave