CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Multiple byte read (Problem)
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Tue Dec 13, 2016 2:08 pm     Reply with quote

Master ST SAD+W SUB SR SAD+R MAK MAK NMAK SP
Slave SAK SAK SAD DATA DATA DATA

and also why are there 3 Data . it necessary to read 2 Data ,X and Y .Is this just example notation?
newguy



Joined: 24 Jun 2004
Posts: 1934

View user's profile Send private message

PostPosted: Tue Dec 13, 2016 2:22 pm     Reply with quote

Zek_De wrote:
Also could you recommend 5-3.3 V converter and this is a module


All you need is an n-channel enhancement FET and two resistors:

- Logic low voltage signal connected to source of FET. Pullup R to Vdd of the lower of the two logic levels you're translating.
- Gate of FET connected to Vdd of the lower of the two logic levels you're translating.
- Drain of FET connected to a pullup R to the Vdd of the higher of the two logic levels. Drain also connects to logic high voltage signal.

This level shifter is bidirectional.
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

PostPosted: Tue Dec 13, 2016 2:35 pm     Reply with quote

Okay friends these codes properly work. But one more question, how can I get other scale-factor (0.021686) ? Now 0.021686 is not true values because now I'm doing multiple reading and this 0.021686 is changed. I must find it by moving the device? Now I must find less values. İs there absolute another way except moving device ?
Code:

 i2c_start();
   i2c_write(0xD2);
   i2c_write(OUT_X_L_INC);
   i2c_start();
   i2c_write(0xD3);
       out[0] = i2c_read(1);
       out[1] = i2c_read(1);
       out[2] = i2c_read(1);
       out[3] = i2c_read(1);
       out[4] = i2c_read(1);
       out[5] = i2c_read(0);
   
   i2c_stop();
   Rk[x_eksen] = make16(out[1],out[0]);
   Rk[y_eksen] = make16(out[3],out[2]);
   Rk[z_eksen] = make16(out[5],out[4]);

   for (int j = 0; j<3; j++)
   {
      deltaR[j] = (float32)Rk[j] - Ro[j];
     
      if (abs(deltaR[j]) > Rth[j])
      {
     
            angle[j] = angle[j] + deltaR[j] * 0.07; //0.021686

      }

   }
Zek_De



Joined: 13 Aug 2016
Posts: 100

View user's profile Send private message

[Solved]Multiple byte read (Problem)
PostPosted: Tue Dec 13, 2016 2:45 pm     Reply with quote

Also thank you for all friends my problem is solved and thanks also extra information.
temtronic



Joined: 01 Jul 2010
Posts: 9632
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Dec 13, 2016 3:38 pm     Reply with quote

The EASIEST way to interface a PIC to all 3 volt devices is to use a 3 volt PIC. It allows for direct pin to pin connections, ONE power supply and will work first time,every time.
There are some PICs ,like the 18F46K22, that will work both at 3 AND 5 volt, so you can reduce inventory and not worry about 'will it work'? !

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group