AMS AS5600 Manual - Page 8

Browse online or download pdf Manual for Control Unit AMS AS5600. AMS AS5600 14 pages. 12-bit programmable contactless potentiometer
Also for AMS AS5600: Operation Manual (12 pages), User Manual (13 pages), Operation Manual (10 pages)

AMS AS5600 Manual
AS5600 Adapter Board

3.2.2 Reading out the AS5600 sensor

Source code examples are also available for download on the ams webpage.
Following source code shows an easy example of reading out the sensor:
/*------------------------------------------------------
FILE:
AS5600
Author: Mark A. Hoferitza, Field Application Engineer, ams AG
www.ams.com
Date: 27 May 2014
Description:
Development of sketches for AS5600 "Potuino"
Read Raw Angle and Angle.
Single Value, no averaging.
-------------------------------------------------------*/
#include <Wire.h>
int AS5600_ADR = 0x36;
const int raw_ang_hi = 0x0c;
const int raw_ang_lo = 0x0d;
const int ang_hi = 0x0e;
const int ang_lo = 0x0f;
const int stat = 0x0b;
const int agc = 0x1a;
const int mag_hi = 0x1b;
const int mag_lo = 0x1c;
void setup(){
Serial.begin(9600);
Wire.begin();
}
void startup(){
}
void loop(){
//
Wire.beginTransmission(AS5600_ADR);
//
Wire.write(0x);
//
Wire.write(0x00);
//
Wire.endTransmission();
//***************************************************************
// Read Raw Angle Low Byte
Wire.beginTransmission(AS5600_ADR);
Wire.write(raw_ang_lo);
Wire.endTransmission();
Wire.requestFrom(AS5600_ADR, 1);
while(Wire.available() == 0);
int lo_raw = Wire.read();
// Read Raw Angle High Byte
Wire.beginTransmission(AS5600_ADR);
Wire.write(raw_ang_hi);
Wire.endTransmission();
Wire.requestFrom(AS5600_ADR, 1);
while(Wire.available() == 0);
word hi_raw = Wire.read();
hi_raw = hi_raw << 8;
hi_raw = hi_raw | lo_raw;
//**********************************************************
// Read Angle Low Byte
ams Eval Kit Manual, Confidential
[v1-0] 2015-Jan-21
//shift raw angle hi 8 left
//AND high and low raw angle value
Page 8
Document Feedback