hi,
This modified example program is from the Oshonsoft manual, its uses the Basic low level I2C statements.
It will write the test data to the simulator EEPROM, but will not Read it back, it gets all FF's. I also get garbage in the real hardware.
If the 'Goto ep_read' is un remmed and the program re-run in the simulator it will read the test data OK.
If any Oshonsoft user has the time to check out this example and let me know what they find it would be appreciated.
I have sent a bug report to Vladimir.
Eric
This modified example program is from the Oshonsoft manual, its uses the Basic low level I2C statements.
It will write the test data to the simulator EEPROM, but will not Read it back, it gets all FF's. I also get garbage in the real hardware.
If the 'Goto ep_read' is un remmed and the program re-run in the simulator it will read the test data OK.
If any Oshonsoft user has the time to check out this example and let me know what they find it would be appreciated.
I have sent a bug report to Vladimir.
Eric
Code:
'example 2:
'17Feb2015
'PIC 18F2550
'EEPROM 24C256
Define CLOCK_FREQUENCY = 20
AllDigital
Define I2CREAD_DELAYUS = 50
Define I2CCLOCK_STRETCH = 50
Dim addr As Word
Dim data(31) As Byte
Dim cnt1 as Byte
Symbol sda = PORTC.2
Symbol scl = PORTC.3
addr = 0
'goto ep_read
ep_write:
I2CPrepare sda, scl
I2CStart
I2CSend 0xa0
I2CSend addr.HB
I2CSend addr.LB
For cnt1 = 0 To 30 ' write 0 to 0xff to eeprom
I2CSend cnt1
Next cnt1
I2CStop
ep_read:
I2CStart
I2CSend 0xa1
For addr = 0 To 30
I2CReceiveAck data(addr)
Next addr
I2CRecN data(31)
I2CStop