Skip to content

Commit 9b895ce

Browse files
committed
Updates README file examples of of use
1 parent 07fbcc9 commit 9b895ce

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/encoders/ma735/README.md

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MA735 SimpleFOC driver
22

3-
This is based on the [MA730](https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/ma730) driver in SimpleFOC, with some tweaks to support the unique registers and options of the MA735. It is a inferior, but less expensive chip after all.
3+
This is based on the [MA730](https://github.com/simplefoc/Arduino-FOC-drivers/tree/master/src/encoders/ma730) driver in SimpleFOC, with some tweaks to support the unique registers and options of the MA735. It is a little bit inferior, but less expensive chip after all. The advantage however of this chip (besides cost) is that resolution is inversely proportional to reading speed, ranging from 9-13 bit resolution and 64us to 16ms read times.
44

55

66
## Hardware setup
@@ -42,6 +42,16 @@ void setup() {
4242
}
4343
```
4444

45+
Set some registers before start
46+
```c++
47+
void setup() {
48+
sensor1.init();
49+
50+
// Note that with this driver there is a write check so registers are not written to if the value is the exact same. Other drivers do not have a write check, and you can easily wear out the NVM every time the code is run. 1,000 cycles max.
51+
sensor1.setResolution(10.0);
52+
}
53+
```
54+
4555
Here's how you can use it:
4656

4757
```c++
@@ -57,14 +67,18 @@ Here's how you can use it:
5767
// get the angle, in radians, no full rotations
5868
float a2 = sensor1.getCurrentAngle();
5969

60-
// get the raw 14 bit value
61-
uint16_t raw = sensor1.readRawAngle();
62-
6370
// get the field strength
6471
FieldStrength fs = sensor1.getFieldStrength();
6572
Serial.print("Field strength: ");
6673
Serial.println(fs);
6774

68-
// set pulses per turn for encoder mode
69-
sensor1.setPulsesPerTurn(999); // set to 999 if we want 1000 PPR == 4000 CPR
75+
//get the calculated resolution from FilterWindow register
76+
float res = sensor.getResolution();
77+
Serial1.print("Resolution: ");
78+
Serial1.println(res);
79+
80+
//get the calculated update time in micro seconds from the FilterWindow register
81+
int Time = sensor.getUpdateTime();
82+
Serial1.print("Update Time (microsecs): ");
83+
Serial1.println(Time);
7084
```

0 commit comments

Comments
 (0)