Very good Ralf !Code:i2caddress = (addr0 * 16) + (addr1 * 8) + (addr2 * 4) + (addr3 * 2) SSP1ADD = I2Caddress
Al.
Very good Ralf !Code:i2caddress = (addr0 * 16) + (addr1 * 8) + (addr2 * 4) + (addr3 * 2) SSP1ADD = I2Caddress
Al.
All progress began with an idea
Hi Al,
success!
The slave routine runs in a 18LF14K22.
I read back via i2c 20 values (a/d values and digital i/o) and i can set
several parameters with two bytes, 1st is array index, 2nd is value.
The handler runs via interrupt, in the moment i am cleaning a little bit,
but i am very happy with it.
Regards,
Ralf
Some Remarks:
1. It is necessary to set the "DEFINE I2C_HOLD 1" in the master to get a
better behaviour of the timing. I checkrd it with the logic analyzer and it is
exactly like in the original "Phillips-Spec"
2. In the section
...
while STAT_BF = 1
i = SSPBUF ' Dummy Read inserted => clears BF Flag
wend
...
it is necessary to inlude the dummy read to get it work on
a 18F6722 and a 18LF14K22 (refer to MCHIP App Note 734, page 17)
3. Address range ist tested from 00h to FFh, all work well.
4. New address setting works (in the main loop) by only setting SSPADD
register with new value without reseting the complete handler.
Regards,
Ralf
ralfmayr wrote on 17th Feb. 2009
I quoted your last year post, just to congratulate with you for the remarkable knowledge you have gained in a year. This will teach new comer that persevering on a subject always pay.Hi Daniel,
no, i stopped working on it, it is not possible to get it work... :-(
I solved my problem using serin/serout.
But it would be great when we exchange our know-how, so we can solve this together!
-,Ralf
Thank you for those additional I2C remarks that could be useful.
Al.
All progress began with an idea
Yep,
last year i made my first experiments with i2cslave,
but had no time to work on it for 8 months now as
i was very busy with other things.
Hope it will help others to come faster to their target.
-,Ralf
Hello Al,
another question:
What are the three definitions:
1. DEFINE I2C_SLOW 1
2. DEFINE I2C_HOLD 1
3. DEFINE I2C_SCLOUT 1
do?
1. => Used with LO > 8MHz and 100kHz devices
2. => Time Delay during acknowledge?
3. => Open Collector / Bipolar Clock on SCL? Dont Understand this!
So: I use PCF8575C and MAX3611 (both 400kHz devices) but both only work
correct when DEFINE I2C_HOLD 1 and DEFINE I2C_SCLOUT 1 is done.
Can you help?
Regards,
Ralf
Hi Ralf,
I can answer part of #3:
Open collector means the PIC has 2 states LOW where it takes the pin to ground and an open state where the pin is high impedance, so to get a high state it must have a pull up resistor to supply the power. I do not know what bipolar clock means, have not read up on this yet.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Bookmarks