GreenLeader
Senior Member
Hi - I am having some problems with the simulator V5.1.7 and 40X1 - is there a bug in the simulator or in my code?
My test program does following:
Writes some values to EEPROM 0 (1,2,3 and 2,3,4)
Write some different values to EEPROM 1 (101,102,103 and 102,103,104)
Read them back and display with serout
In the simulator, the values for EEPROM 1 are correct, but EEPROM 0 are same as EEPROM 1
I'd appreciate any comments - perhaps someone could test it on their simulator? I haven't progressed to testing on hardware yet..
My test program does following:
Writes some values to EEPROM 0 (1,2,3 and 2,3,4)
Write some different values to EEPROM 1 (101,102,103 and 102,103,104)
Read them back and display with serout
In the simulator, the values for EEPROM 1 are correct, but EEPROM 0 are same as EEPROM 1
I'd appreciate any comments - perhaps someone could test it on their simulator? I haven't progressed to testing on hardware yet..
Code:
#PICAXE 40X1
' Program to test i2c write/read with 2 EEPROMs
' Setup i2c 2x24LC256 EEPROMS
hi2csetup i2cmaster,%10100000,i2cfast,i2cword 'EEPROM addr 0
hi2csetup i2cmaster,%10100010,i2cfast,i2cword 'EEPROM addr 1
' Write some data to first EEPROM
' *******************************
w1 = 1
w2 = 2
w3 = 3
for w13 = 1 to 10 step 6
hi2cout [%10100000],w13,(b2,b3,b4,b5,b6,b7) 'EEPROM addr 0
inc w1
inc w2
inc w3
next
' Write some different data to second EEPROM
' ******************************************
w1 = 101
w2 = 102
w3 = 103
for w13 = 1 to 10 step 6
hi2cout [%10100010],w13,(b2,b3,b4,b5,b6,b7) 'EEPROM addr 0
inc w1
inc w2
inc w3
next
' read the data back and send to serout
' *************************************
serout 7,N4800,("EEPROM 0 ",13)
for w13 = 1 to 10 step 6
hi2cin [%10100000],w13,(b2,b3,b4,b5,b6,b7) 'EEPROM addr 0
serout 7,N4800,(#w1,44,#w2,44,#w3,13)
next
serout 7,N4800,("EEPROM 1 ",13)
for w13 = 1 to 10 step 6
hi2cin [%10100010],w13,(b2,b3,b4,b5,b6,b7) 'EEPROM addr 0
serout 7,N4800,(#w1,44,#w2,44,#w3,13)
next