| View previous topic :: View next topic |
| Author |
Message |
Zek_De
Joined: 13 Aug 2016 Posts: 100
|
|
Posted: Tue Dec 13, 2016 2:08 pm |
|
|
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
|
|
Posted: Tue Dec 13, 2016 2:22 pm |
|
|
| 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
|
|
Posted: Tue Dec 13, 2016 2:35 pm |
|
|
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
|
| [Solved]Multiple byte read (Problem) |
Posted: Tue Dec 13, 2016 2:45 pm |
|
|
| 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
|
|
Posted: Tue Dec 13, 2016 3:38 pm |
|
|
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 |
|
 |
|