To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 334
333  |  335
Subject: 
Re: Rotation sensors?
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Thu, 22 Jul 1999 13:14:36 GMT
Viewed: 
1497 times
  
Thanks Mark, those changes got rotation-sensor.c working
for me.

Mark Falco wrote:

Yep, others have reported having these problems.  Here's a fix I came up
with, but has also only been tested on my system.  There have been
reports that the existing code works for some, and not for others, so
you may need to customize this.

just replace the existing definitions in direct-sensor.c

hope this helps

mark

! A/D values for the rotation sensor states
//
#define STATE_0_VALUE (0x0f000)
#define STATE_1_VALUE (0x0d000)
#define STATE_2_VALUE (0x07000)
#define STATE_3_VALUE (0x0a000)

//! rotation sensor range matching function
//
#define IN_RANGE( val ) ((raw & 0x0f000) == val)

void ds_rotation_set(unsigned* const sensor,int pos) {
  unsigned channel=(unsigned) (sensor-&AD_A);
  unsigned raw = (*sensor);
  RotationState state;

    if(sensor>=&AD_A && sensor<=&AD_C) {    // catch range violations

      //determine initial position
      if(IN_RANGE(STATE_0_VALUE))
        state=STATE_0;
      if(IN_RANGE(STATE_1_VALUE))
        state=STATE_1;
      if(IN_RANGE(STATE_2_VALUE))
        state=STATE_2;
      if(IN_RANGE(STATE_3_VALUE))
        state=STATE_3;

    rotation_state[channel]=state;
    ds_rotations[channel]=pos;            // reset counter
    }
}

Jonathan Knudsen wrote:

Hello,

Rotation sensors appear to be broken in the 990330
snapshot. Here's part of the code I'm using:

  ds_active(&SENSOR_3);
  ds_rotation_on(&SENSOR_3);
  ds_rotation_set(&SENSOR_3, 0);

  while (!PRESSED(button_state(), BUTTON_VIEW)) {
    lcd_int(ROTATION_3);
    lcd_refresh();
    msleep(20);
  }

Is this a known problem?

Thanks,
Jonathan



Message is in Reply To:
  Re: Rotation sensors?
 
Yep, others have reported having these problems. Here's a fix I came up with, but has also only been tested on my system. There have been reports that the existing code works for some, and not for others, so you may need to customize this. just (...) (25 years ago, 20-Jul-99, to lugnet.robotics.rcx.legos)

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