 |
 |
| View previous topic :: View next topic |
| Author |
Message |
aaaaamartin
Joined: 17 Apr 2005 Posts: 39 Location: Germany Stuttgart
|
|
Posted: Sat Oct 01, 2005 6:57 am |
|
|
Hi,
latest compilers accept a baudrate setting, which is done in the master:
e.g.
| Code: |
#use I2C(master, fast=200000, sda=PIN_C4, scl=PIN_C5, FORCE_SW)
|
Further explained in the compilers readme.
Another thing I found out, if one uses the C-Version of AN734a, for the master, if I leave out all I2C_STOP (); commands it works fine.
If I use I2C_STOP, I continously get errors in the slave.
I don't know why this is, but so far I can live with it, as I have a sinlge-master system. In this case, I think, i2c_stop () is never needed.
Good luck
Martin |
|
 |
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Sat Oct 01, 2005 7:18 am |
|
|
| Quote: |
Why use slave & slow ?
|
Cause that's what you had. I just copied what you had and changed it a bit. I would use slow for the master. As I posted before, it is imposssible for you to recieve data that fast with the slave running at 4MHz.
| Quote: |
Why and how use noclear here ?
|
Cause CCS doesn't clear the interrupt until the end of the routine. By doing it at the start, I have less chance of missing a byte.
| Quote: |
Why dissable_interrupts in main (), you might loose data ?
|
I don't like to use variables that might change in an interrupt. What if you set port a to a value and before your main gets around to setting port a you start receiving a command to set port b. Then you might set port b to the port a value. The ints are not off for that long so typically wouldn't worry about missing a byte. You could also disable the ints, copy the values to temp variables and then turn back on ints and then process the temp variables. |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|