[an error occurred while processing this directive]
|
/*********************************************************************************************/
// I2C write
/*********************************************************************************************/
int SPI_MEM_write ( unsigned int address, unsigned int counter ) {
unsigned int i;
char TBUF [ 256 ];
SPI_CS1 = 0;
SSC1_TB = 0x06; // WREN;
SSC1_TB = ((unsigned char)((address & 0xFF00) >> 8)); // address high
SSC1_TB = ((unsigned char)(address & 0x00FF)); // address low
for (i=0; i // verification for (i = 0; i SPI_CS1 = 1; for (i=0; i /*********************************************************************************************/ SPI_CS1 = 0; SSC1_TB = ((unsigned char)((address & 0xFF00) >> 8)); // address high for (i = 0; i SPI_CS1 = 1; return (0);
SSC1_TB = FBUF[ i ]; // data
}
SSC1_TB = ((unsigned char)((address & 0xFF00) >> 8)); // address high
SSC1_TB = ((unsigned char)(address & 0x00FF)); // address low
TBUF[ i ]= SSC1_RB;
}
return(1); //Error
}
}
return (0);
}
// I2C read
/*********************************************************************************************/
int SPI_MEM_read ( unsigned int address, unsigned int counter ) {
unsigned int i;
SSC1_TB = ((unsigned char)(address & 0x00FF)); // address low
FBUF[ i ]= SSC1_RB;
}
}
Ответы
Перейти к списку ответов
|||
Конференция
|||
Архив
|||
Главная страница
|||
Содержание