Hi, has someone tried implmenting I2C in AT89C51? Did it work? If yes, can you give me some tips in order to get a succesful communication,please?
Thanks for your help
Since both I2C and the AT89C51 have been around for decades, I think it's (almost?) inevitable that many people have done this.
They have probably also written about it on the interwebs, too ...
"give me some tips in order to get a succesful communication"
OK:
1. For a start, you will need to understand I2C - so study the I2C Specification: www.nxp.com/.../UM10204.pdf
2. Check for Application Notes from the chip manufacturer.
3. google "bit-bang I2C"; "software I2C"; etc.
But why not simply use a chip which has I2C hardware ... ?
Because it is a project of a subject in my University, so that I cannot changr the microcontroller. Thank you very much for the help, Im gonna check all the tips that yoy said
I'm sorry to inform you that your degree from this "university" will be worthless. The AT80C51 cost more than twice what a modern '51 derivative cost and thus nobody in the real world would use it. Also switching to a modern '51 derivative (e.g. SiLabs) would provide the educational benefit of full debugging capabilities
That is not the case, the teacher ask eaxh group to search for a different microcontroller and work with it in the final project, so we invesrigated and according the our sources and limitations, we chose thid microcontroller. But I think that this is not important xD, the main topic of the thread is I2C in at89c51
well, whatever. anyhow there should be tons of old code for bit-banging I²C on the web. So now you can learn something useless since all modern chips have hardware I²C making bit-banging totally obsolete.
So, given that I2C is clearly an essential requirement of your project, why on earth did you pick a microcontroller without I2C?!?!
No , I2C is not essential , we had try using Serial communication but for some reason is not working , the microcontrollee does not recognize serial inputs. I have simulated in proteus and is working fine , but in real life it does not work. So I have to try another way
Go on.
Serial comms is the standard beginners project on any microcontroller. It has been for decades.
http://www.keil.com/forum/63136/
a classic beginner mistake, can not make something work, so try something completely different
another classic beginner mistake indicated by the above is trying to run the TTL outputs from the processor as RS232 - do you ned to add a MAX232(equivalent)?
Appatently no , because what max does is convert voltaje lvl specially from serial port of computers ( 13 V) to 5V . The arduino, raspberry pi give 5 V do I think that it is not neccesary to add extra components ( I have read that , maybe Im wrong)
No, it doesn't - it gives 3V.
If you have been applying 5V signals to your Raspberry Pi, you may have damaged it.
If you have been applying RS323 signals to your Raspberry Pi, you may well have damaged it.
I havent apply 5V signals, because i do not trandmit data from tx of the mic to the rx of the rasp. I know that it gives 3V but I think that 3V is enough to produce high lvl in the mic. Dont know if I need exactly 5V
The microcontroller behaves as specified in its datasheet - not according to what you think.
So look in the datasheet to confirm whether what you think is correct or not...
I said "think" because it is what I read or understand for ttl levels. The datasheet said that the ports are ttl , so 3V I think is enough.
Did it?
There will be a section where it specifically defines the threshold voltage levels for logic "High" and "Low". That's the bit you need to read!