Birdy YAP / Encoder_dspic33f

Dependents:   Tutorial04_dspic33fI2cCom Tutorial06_motorPositionControl

Revision:
3:ad07e5b97132
Parent:
2:57634dc24946
Child:
4:bb36786e93b7
--- a/Encoder_dspic33f.cpp	Tue Oct 29 05:52:44 2013 +0000
+++ b/Encoder_dspic33f.cpp	Tue Nov 05 12:40:27 2013 +0000
@@ -20,6 +20,16 @@
     i2c_.write( (address_<< 1)  & 0xFE, &rst, 1);
 }
   
+
+void Encoder_dspic33f::set_resolution(int16_t resolution){
+    char cmd = 'e';
+    char dat[3];
+    dat[0] = cmd;
+    dat[1] = GetByte(resolution,0);
+    dat[2] = GetByte(resolution,1);
+    i2c_.write( (address_<< 1)  & 0xFE, dat, 3);
+}
+
 void Encoder_dspic33f::set_resolution1(int16_t resolution){
     char cmd = 'e';
     char dat[4];