Birdy YAP / Encoder_dspic33f

Dependents:   Tutorial04_dspic33fI2cCom Tutorial06_motorPositionControl

Revision:
2:57634dc24946
Parent:
1:a9290cf59d1f
Child:
3:ad07e5b97132
--- a/Encoder_dspic33f.cpp	Sat Jun 08 03:55:09 2013 +0000
+++ b/Encoder_dspic33f.cpp	Tue Oct 29 05:52:44 2013 +0000
@@ -20,15 +20,25 @@
     i2c_.write( (address_<< 1)  & 0xFE, &rst, 1);
 }
   
-void Encoder_dspic33f::set_resolution(int16_t resolution){
+void Encoder_dspic33f::set_resolution1(int16_t resolution){
     char cmd = 'e';
-    char dat[3];
+    char dat[4];
     dat[0] = cmd;
-    dat[1] = GetByte(resolution,0);
-    dat[2] = GetByte(resolution,1);
-    i2c_.write( (address_<< 1)  & 0xFE, dat, 3);
+    dat[1] = '1';
+    dat[2] = GetByte(resolution,0);
+    dat[3] = GetByte(resolution,1);
+    i2c_.write( (address_<< 1)  & 0xFE, dat, 4);
 }
 
+void Encoder_dspic33f::set_resolution2(int16_t resolution){
+    char cmd = 'e';
+    char dat[4];
+    dat[0] = cmd;
+    dat[1] = '2';
+    dat[2] = GetByte(resolution,0);
+    dat[3] = GetByte(resolution,1);
+    i2c_.write( (address_<< 1)  & 0xFE, dat, 4);
+}
 void Encoder_dspic33f::read(double * inarr){
     char rx[8];   
     float data[2] = {0.0, 0.0};