User manual
mikroBasic PRO for PIC32
MikroElektronika
315
I2C2_Stop()
end sub
main:
CHECON = 0x30
AD1PCFG = 0xFFFFFFFF
LATB = 0 ‘ Set PORTB value to zero
TRISB = 0 ‘ Congure PORTB as output
TRISD = 0 ‘ Congure PORTB as output
LATD = 0 ‘ Set PORTB value to zero
EEPROM_24C02_Init() ‘ performs I2C initialization
b = 0x00
for i = 0x00 to 0x80
EEPROM_24C02_WrSingle(i,b)
Inc(b)
Delay_ms(5)
next i
for i = 0x00 to 0x80
LATD = i
LATB = EEPROM_24C02_RdSingle(i)
Delay_ms(100)
next i
end.