rhinoceroshead wrote:
It looks like the internal clock is selected by default, so maybe this isn't what's happening in your case. But I would still try writing the bits at the same time just in case something is out of order.
You are correct i have stepped through using the BDM and all the right bits are being selected(so it is using the internal clock).
So i am still having the same problem the program enters stop mode and does not exit.. any more ideas why? here is the code below
Thanks
void TxAccel(void)
{
EnableInterrupts;
SOPT_STOPE= 1; /*Enable stop modes*/
SRTISC=0x57;
/* Enable deep sleep mode stop2. */
SPMSC2_PPDC= 1; /* Partial Power Down Control */
SPMSC2_PDC= 1; /* Power Down Control */
TPM1SC = 0x0F; /* Timer divide by 128. (16uS timebase for 8MHz bus clock). */
ATD1PE=0x83; /* enable desired ADC channels (AD0, AD1, AD7 on) */
ATD1C=0xE1; /* set prescale to 4*/
ATD1SC = 0x01; /* read X channel */
while((ATD1SC & 0x80) != 0x80);
gau8TxDataBuffer[1] = ATD1RH;
ATD1SC = 0x00; /* read Y channel */
while((ATD1SC & 0x80) != 0x80);
gau8TxDataBuffer[3] = ATD1RH;
ATD1SC = 0x07; /* read Z channel */
while((ATD1SC & 0x80) != 0x80);
gau8TxDataBuffer[5] = ATD1RH;
gau8TxDataBuffer[0] = 0x78; /* send x */
gau8TxDataBuffer[2] = 0x79; /* send y */
gau8TxDataBuffer[4] = 0x7A; /* send z */
gsTxPacket.u8DataLength = 6;
MCPSDataRequest(&gsTxPacket); /* transmit data */
LED4 ^= 1; /* Toggle LED1 */
STOP(); // linked to asm stop function
delay(0x0FFF);
delay(0x0FFF);
delay(0x0FFF);
} /* end main */