I know I should have looked into datasheet but I am kind of hurry at the moment so does anyone know how many internal registers does AT89C51/AT89C52? What is the device address (default) for AT89C51 and AT89C52? Can I make my own device address??
The reason for this request is Im in the process of learning to implement I2C method therefore I need to be familiar with the internal registers and default address before conducting further work.
AT89C51 and AT89C52 has no hardware support (special registers) by default for I2C bus.
If you want to use these microcontroller for I2C implementation you have to do a what is called "bit bang" procedure.
For learning about I2C you can look here: http://neptune.lisa.univ-paris12.fr/Electronik/F_I2C.htm
I will look 'Bit-bangs' up now. Do you know any ATMEL microcontroller has I2C (device address and internal address)?
Btw thank you for letting me know
Maverickmax
Added after 2 hours 20 minutes:
Hi
I am kind of familiar with bit-banging approach but the question is should I create my own device addresses in my prototupe function code for multi-slaves?
So you want a slave with address 10100001 and one with address 10110001
Yes, it's OK for read them.
For write you must have 0xA0 and 0xB0 as slave address.
Inside the site mentioned before in my previous post you can read:
Each byte consists of 8 bits. The 8th bit in the SLAVE address has a special meaning. When it is set to 0 it means you want to write to your SLAVE. When it is set to 1 it means that you you want to READ. You could see this as follow. The Even addresses are WRITE addresses, the ODD addresses are READ addresses. Each device has a consecutive WRITE and READ address.
Example: a PCF8574 General purpose 8 BIT I/O port.
SLAVE address to WRITE is (01000000)b = 64d
SLAVE address to READ is (01000001)b = 65d
So you can have a theoretical maximum of 128 device on you BUS. Practically this is not the case. There have been set up a couple of addresses which you are not allowed to use. There are some that have been reserved by PHILIPS for special purposes.
0000 001 x : CBUS address
0000 010 x : address reserved for different bus format.
0000 011 x |
0000 100 x |
0000 101 x |} to be defined
0000 110 x |
0000 111 x |
This implements that all addresses below 16 are reserved for special purposes
However bear in mind that an I2C peripheral address is composed of two parts. The fixed part is defined by the I2C bus committee and is assigned based on device type. Thus be carefully do not use such kind of device in your system. Otherwise you can get in conflict with them since they have the slave address hardware configured on the chip.
I can program the slave to carry the device address. Hence the master will transmit the device address in to alert the slaves. For example the first slave compare its device address with the transmission of device address from master, and if it recognise the device address, it will be ready to listen for further instruction from the master while 2nd slave ignore.
Am i right?
I am soz if Im a pain in the ass! I am a terribly slow learner!!!
Re: Internal register and default address of AT89C51 and AT8
Maverickmax said:
For example the first slave compare its device address with the transmission of device address from master, and if it recognise the device address, it will be ready to listen for further instruction from the master while 2nd slave ignore.