ADDR MUST be a WORD sized variable.
Make sure you're using < 4.7K pull-up resistor
ADDR MUST be a WORD sized variable.
Make sure you're using < 4.7K pull-up resistor
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thanks Steve:
I will change ADDR to be "Word". Is it acceptable to just say $07 as the address I want to write to?
The data sheet for the EEPROM states that it is expecting the Address High after it acknowledges the Start condition.
It is written as "high-order byte of the word address and will be written into the Address Pointer" Is the address pointer the location that I intend to write to? It then says that the next byte (2nd half of address word) is the least significant address byte. It does not say what this represents.
The EEPROM has memory addressing from $0000 - $FFFF. Should my $07 as a target address go in as $0700 and then 0000 as the second half of the word?
Confused,
Tim
When you write ADDR=$07 or ADDR=$7, it store $0007 to the word variable in one shot...If you prefer in the MSB and LSB. have Look to your EEPROM datasheet...
http://ww1.microchip.com/downloads/e...doc/21754E.pdf
Look Figure 6-1. What happen if your address variable is a byte? Yes it miss the LowByte of the address. Using a word sized variable, nothing is missing.
Nothing else to worry about, I2CREAD/WRITE will do the job for you.
P.S. : Welcome on the forumYet another Canadian Woohoo !!!
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Steve:
Thanks for the response. Happy to strengthen the Canadian contingent
I am sitting here watching the program run on the ICD. I wish they went faster.
I will confirm that the address stuff is exactly as you said. I watched 8 0s get fed before it put in my address and I am now watching shift my address across.
From what I can see, everything is working properly.
When I let it run, I am expecting to see the number contained in the [] brackets on the write statement returned in my byte i2c_Data which is in the [] brackets in my read statement.
If this correct?
The read statement does not hit the "Fail" after the [] so that would imply that the program is "running".
Tim
Running or at least it says that there's something on the I2C lines.
If you really want to know if it's working, you could still write to the EEPROM, then read back the data, if both are the same... it confirm it's working.. just fine.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Hi Steve:
Well that is my big question in my previous response. If this was doing what it is supposed to be doing, would I not see the result in my i2c_Data variable?
ADDR var word
ADDR = $07
PAUSE 10
I2CWRITE PORTC.4,PORTC.3,$A0,ADDR,[1]
PAUSE 10
I2CREAD PORTC.4,PORTC.3,$A0,ADDR,[i2c_Data],Fail
PAUSE 10
GOTO MAIN
Fail:
PORTC.5 = 1
GOTO MAIN
I would expect i2c_Data to contain "1"
It does not.
Am I giving everything enough time?
Thanks
Tim
Try this one, it's working here
Code:define LOADER_USED 1 disable debug Data_READ var byte Data_Write var byte Bad var bit ADDR var word SDA var PORTC.4 SCL var PORTC.3 Control con $A0 Bad = 0 Start: For addr=0 to $FFFF data_write=addr.lowbyte bad = 0 I2CWRITE sda,scl,control,ADDR,[data_write] PAUSE 10 I2CREAD sda,scl,control,ADDR,[Data_read] enable debug data_read=data_read ' refresh ICD display disable debug if data_read != data_write then bad=bad +1 next GOTO Start
Last edited by mister_e; - 2nd February 2007 at 03:09.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks