Thanks for the replies but nothing appears to be working. I've removed the SPI bean and replaced it with the SPI Init bean (to offer more control). Here's the initialization code: (generated by PE). This will show you the settings.
Code://Init code generated by PEvoid Accelerometer_Init(void){/* Control register 2 setting */ /* SPI1CR2: MODFEN=1 */ setReg8(SPI1CR2, 16); /* Frequency setting */ setReg8(SPI1BR, 0); /* Control register 1 setting */ /* SPI1CR1: MSTR=1,SSOE=1 */ setReg8(SPI1CR1, 18); }//bigmac's send code//************************************************//*//* This method sends a character across the SPI//* interface. It returns the last read value.//*//************************************************Byte1 Accelerometer_SendChar(Byte1 data){ while (!SPI1SR_SPTEF); /* Wait for Tx buffer empty */ SPI1DR = data; while (!SPI1SR_SPIF); /* Wait for Rx buffer full */ return SPI1DR;}//My register init code//************************************************//*//* This method uses the SPI interface to //* initialize the Left and Right Accelerometers.//*//************************************************void Set_ControlRegisters_Accel(void){ //Word data structure Byte1 send_data1, send_data2; //Top 4 Bytes: Writing to Address for CTRL_Reg_1; //Bot 4 Bytes: Data to set the CTRL_Reg_1. send_data1 = 0x60; send_data2 = 0xC4; SPI1CR1_SSOE = 0; //Send the data across the SPI interface. (void)Accelerometer_SendChar(send_data1); (void)Accelerometer_SendChar(send_data2); SPI1CR1_SSOE = 1; //Top 4 Bytes: Writing to Address for CTRL_Reg_2; //Bot 4 Bytes: Data to set the CTRL_Reg_2. send_data1 = 0x61; send_data2 = 0x80; SPI1CR1_SSOE = 0; //Send the data across the SPI interface. (void)Accelerometer_SendChar(send_data1); (void)Accelerometer_SendChar(send_data2); SPI1CR1_SSOE = 1; //Control Register 3 only deals with highpass filter }
I'm also including links to the datasheets for both the yaw and accelerometers. TIA for your help.
AccelerometerYaw ~Mark
Message Edited by PhattieM on
2007-05-10 06:55 PMMessage Edited by PhattieM on
2007-05-10 06:55 PM