Hello,
I've bought ADIS-16355 and choose AT89C51ED2 to read this chip.
I would like to connect ADSP21369 with ADIS16350 by SPI.
Please help me, show me how it works.
My code like follow
/************************************************************/
void main(void)
{
uart_init();
spi_init();
timer2_start(DELAY_50MS);
while(1)
{
SPDAT=data_example; /* send an example data */
while(!transmit_completed);/* wait end of transmition */
transmit_completed = 0; /* clear software transfert flag */
SPDAT=0x00; /* data is send to generate SCK signal */
while(!transmit_completed);/* wait end of transmition */
transmit_completed = 0; /* clear software transfert flag */
data_save = serial_data; /* save receive data */
}
void spi_init(void)
{
SPCON |= 0x10; /* Master mode */
P1_1=1; /* enable master */
SPCON |= 0x82; /* Fclk Periph/128 */
SPCON &= ~0x08; /* CPOL=0; transmit mode example */
SPCON |= 0x04; /* CPHA=1; transmit mode example */
IEN1 |= 0x04; /* enable spi interrupt */
SPCON |= 0x40; /* run spi */
EA=1; /* enable interrupts */
}
void it_SPI(void) interrupt 9 /* interrupt address is 0x004B */
{
switch ( SPSTA ) /* read and clear spi status register */
{
case 0x80:
serial_data=SPDAT; /* read receive data */
transmit_completed=1;/* set software flag */
break;
defaule:
break;
}
}
}
/*****************************************************************************/
Plz give me some example code to access ADIS-16355.
Thanks
Anson