Pni RM3000-F Sensor Suite Instrukcja Użytkownika Strona 45

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 46
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 44
PNI Sensor Corporation Doc #1016102 r04
RM3000-f & RM2000-f Sensor Suite User Manual Page 45
/*************************************************************************
* Function Name : ThreeD_magic_init
* Description : initializes the 3D MagIC.
* Input : None
* Output : None
* Return : None
*************************************************************************/
void ThreeD_magic_init(void)
{
unsigned char i;
unsigned int cycle_count = 200;
unsigned int cycle_count_read_back[3];
//
// change the phase and polarity to be 1/1
//
spi_1_go_0_phase_0_pol();
//Set Cycle Count HERE
usec_delay(1);
SPI_tom_CS_LOW();
usec_delay(1);
//Write Cycle Count Reg, start at X-axis, auto increment to Y & Z
SPI_read_write(0x83);
//CC is programmed as 200 for now.
for(i=0;i<3;i++)
{
usec_delay(1);
SPI_read_write((unsigned char)(cycle_count>>8));
usec_delay(1);
SPI_read_write((unsigned char)cycle_count));
}
SPI_tom_CS_HIGH();
//Read CC
usec_delay(1);
SPI_tom_CS_LOW();
usec_delay(1);
//Optional-Read Cycle Count Reg, start at X-axis, auto increment to Y&Z
//for verification purpose only.
SPI_read_write(0xc3);
for(i=0;i<3;i++)
{
usec_delay(1);
cycle_count_read_back[i]=(SPI_read_write(0)<<8);
usec_delay(1);
cycle_count_read_back[i]|=SPI_read_write(0);
}
SPI_tom_CS_HIGH();
// change the phase and polarity to be 1/1
spi_1_go_1_phase_1_pol();
}
Przeglądanie stron 44
1 2 ... 40 41 42 43 44 45 46

Komentarze do niniejszej Instrukcji

Brak uwag