Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Tutorial04_dspic33fI2cCom Tutorial06_motorPositionControl
Encoder_dspic33f Class Reference
Includes. More...
#include <Encoder_dspic33f.h>
Public Member Functions | |
Encoder_dspic33f (PinName sda, PinName scl, int16_t resolution, int address, int freq=400000, bool invert=false) | |
Constructor. | |
void | reset (void) |
Reset encoders. | |
void | set_resolution (int16_t resolution) |
Set encoders resolution resolution: number of pulse per revolution using X2 encoding. | |
void | read (double *inarr) |
Read angle values (radian) of encoders. |
Detailed Description
Includes.
Definition at line 10 of file Encoder_dspic33f.h.
Constructor & Destructor Documentation
Encoder_dspic33f | ( | PinName | sda, |
PinName | scl, | ||
int16_t | resolution, | ||
int | address, | ||
int | freq = 400000 , |
||
bool | invert = false |
||
) |
Constructor.
- Parameters:
-
sda mbed pin to use for sda line of I2C interface. scl mbed pin to use for SCL line of I2C interface. resolution encoder resolution in x2 mode freq i2c frequency invert change polarity of encoder count Usage: Encoder_dspic encoder_left(p9, p10, 10000, 0x08);
Definition at line 3 of file Encoder_dspic33f.cpp.
Member Function Documentation
void read | ( | double * | inarr ) |
Read angle values (radian) of encoders.
array of size 2 containing {angleEncA, angleEncB}
Definition at line 35 of file Encoder_dspic33f.cpp.
void reset | ( | void | ) |
Reset encoders.
set revolution count and POSXCNT to zero
- Returns:
- void
Definition at line 18 of file Encoder_dspic33f.cpp.
void set_resolution | ( | int16_t | resolution ) |
Set encoders resolution resolution: number of pulse per revolution using X2 encoding.
- Returns:
- void
Definition at line 24 of file Encoder_dspic33f.cpp.
Generated on Tue Aug 23 2022 03:48:33 by
