| поискавой системы для электроныых деталей |
|
PIC17C752-08/CL датащи(PDF) 174 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PIC17C752-08/CL датащи(HTML) 174 Page - Microchip Technology |
|
174 / 328 page ![]() PIC17C7XX DS30289A-page 174 © 1998 Microchip Technology Inc. 15.4 Example Program Example 15-2 shows MPLAB-C17 ’C’ code for using the I2C module in master mode to communicate with a 24LC01B serial EEPROM. This example uses the PICmicro ’C’ libraries included with MPLAB-C17. EXAMPLE 15-2: INTERFACING TO A 24LC01B SERIAL EEPROM (USING MPLAB-C17) // Include necessary header files #include <p17c756.h> // Processor header file #include <delays.h> // Delay routines header file #include <stdlib.h> // Standard Library header file #include <i2c16.h> // I2C routines header file #define CONTROL 0xa0 // Control byte definition for 24LC01B // Function declarations void main(void); void WritePORTD(static unsigned char data); void ByteWrite(static unsigned char address,static unsigned char data); unsigned char ByteRead(static unsigned char address); void ACKPoll(void); // Main program void main(void) { static unsigned char address; // I2C address of 24LC01B static unsigned char datao; // Data written to 24LC01B static unsigned char datai; // Data read from 24LC01B address = 0; // Preset address to 0 OpenI2C(MASTER,SLEW_ON); // Configure I2C Module Master mode, Slew rate control on SSPADD = 39; // Configure clock for 100KHz while(address<128) // Loop 128 times, 24LC01B is 128x8 { datao = PORTB; do { ByteWrite(address,datao); // Write data to EEPROM ACKPoll(); // Poll the 24LC01B for state datai = ByteRead(address); // Read data from EEPROM into SSPBUF } while(datai != datao); // Loop as long as data not correctly // written to 24LC01B address++; // Increment address } while(1) // Done writing 128 bytes to 24LC01B, Loop forever { Nop(); } } |
|
ссылки URL |
| Вашему бизинису помогли Аллдатащит? [ DONATE ] |
Что такое Аллдатащит | реклама | контакт | Конфиденциальность | Ссылка на техническое описание | обмен ссыками | поиск по производителю All Rights Reserved©Alldatasheet.com |
| Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
|
Family Site : ic2ic.com |
icmetro.com |