| 数据搜索系统,热门电子元器件搜索 |
|
PICDEM2 数据表(PDF) 30 Page - Microchip Technology |
|
|
|||||||||||||||||||||||||||||
PICDEM2 数据表(HTML) 30 Page - Microchip Technology |
|
30 / 60 page ![]() 2001 Microchip Technology Inc. DS30374D-page 25 I2C/EEPROM Demo 5.2 MSSP Module This section presents flowcharts to implement communication with Serial EEPROM using the MSSP module in master mode. For SSP operation, refer to Section 5.1. 5.2.1 Main Routine The main routine is actually preceded by several register file, bit and vector assignments (Figure 5.2). The program begins by configuring PORTB as outputs and PORTC as inputs. The output data value will be read from PORTB, so it is initialized to one. The next part of the code initializes the MSSP module for master I2C mode. The slew rate control is disabled and the clock rate is set to 100 kHz. Both the RC3 and RC4 pins are made inputs as the MSSP module will control the data direction. Interrupts are not used in this program, so they are disabled. Also, the MSSP is configured to enable I2C master mode. The write/read loop begins with the initialization of the EEPROM address to 00h, and the device address to A0h. Then the write loop executes by writing the output data value to each address in the EEPROM (Figure 5.3). After the write loop, the EEPROM address and device address are re-initialized for read. The read loop executes by reading data values for each EEPROM address and verifying their accuracy (Figure 5.4). After the read loop, the output data value is incremented by one and this value displayed, via PORTB, on the LEDs. Then the write/read loop begins again. If an error is encountered when writing or reading the EEPROM, or if an EEPROM value read is incorrect, the program jumps to the error loop, which flashes the LEDs (Figure 5.5). |
|
链接网址 |
| ALLDATASHEET是否为您带来帮助? [ DONATE ] |
关于 Alldatasheet | 广告服务 | 联系我们 | 隐私政策 | 数据表链接 | 链接交换 | 制造商名单 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 |