View Single Post
  #4   Spotlight this post!  
Unread 03-02-2013, 10:02
tuyauxtu tuyauxtu is offline
Registered User
FRC #0781 (Kinetic Knights Robotics)
Team Role: Mentor
 
Join Date: May 2010
Rookie Year: 2010
Location: Kincardine, Ontario
Posts: 22
tuyauxtu is an unknown quantity at this point
Re: VEX 393 Encoder Issues

Hi, I went under the assumption that as an I2C bus device it could not be connected to the DIO portion of the DSC like a regular USDigital encoder.

The encoder cable has white (data), yellow (clock), red (+5V) and black (ground). We made up a female-female connector so that the red maps to the top I2C pin in the DSC (5V), the yellow to the next pin down (SCL), the white to the SDA and the black to ground. I'd appreciate it if you could post your c++ code if you are reading values from the I2C bus.

I can read the encoder in java by extending the SensorBase class (trying to mimic devices like the HiTechnicColorSensor and HiTechnicCompass), however the data is not making sense:
The returned values for the device information seem to be missing the last byte in each address (getting only 7 of the 8, first clue something's not right!), and when I read the addresses 0x40 upwards (per http://www.vexforum.com/wiki/index.p...Motor_Encoders, compensating for the unsigned integers, I get what looks like individual values in each address which follow the motor rotation but the MSB and LSB rotation tick bits 0x40 and 0x41 seem to be reversed (second clue). I doubt that I am using the I2C read method correctly in that I should be able to read, say 4 bytes in one go, starting at 0x40 and get the first rotation bytes, then combine them to an integer number that counts up and down as the motor moves. Comes out as garbage, third clue.

FRC Team 781's experience so far, I'll post if I make any progress.
Pat

Last edited by tuyauxtu : 03-02-2013 at 11:40. Reason: corrected url