Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

MAX6953 with 8051 Interface

Status
Not open for further replies.

mic5

Member
For clock dispaly, which is the best to drive LED matrix? MAX6953 or MAX6952?

I need any example code or algorithm to communicate 8051 controller with MAX6953 LED driver.
 
Difference between MAX6953 and MAX6952 is that one is working with I2C and while other is working with SPI, Only communication protocol and transmission rate between them is the difference..
So now you have to decide based on the above criteria that whether you want to use MAX6953 and MAX6952...
 
Difference between MAX6953 and MAX6952 is that one is working with I2C and while other is working with SPI, Only communication protocol and transmission rate between them is the difference..
So now you have to decide based on the above criteria that whether you want to use MAX6953 and MAX6952...

Perhaps, I am using MAX6953. Need asm or c code ...
 
8051 is not having the inbuilt I2C, so you need to have software i2c implementation
I2c code....

#define SDA P0_0
#define SCL P0_1

void I2CInit(){
SDA = 1;
SCL = 1;
}

void I2CStart(){
SCL = 1;
SDA = 0;
SCL = 0;
}

void I2CRestart(){
SCL = 0;
SDA = 1;
SCL = 1;
SDA = 0;
}

void I2CStop(){
SCL = 0;
SDA = 0;
SCL = 1;
SDA = 1;
}

void I2CAck(){
SDA = 0;
SCL = 1;
SCL = 0;
SDA = 1;
}

void I2CNak(){
SDA = 1;
SCL = 1;
SCL = 0;
}

void I2CSend(unsigned char Data){
unsigned char i;
for(i=0;i<8;i++){
SCL = 0;
if((Data&0x80)==0)
SDA = 0;
else
SDA = 1;
SCL = 1;
Data<<=1;
}
SCL = 0;
SDA = 1;
}

unsigned char I2CRead(){
unsigned char i, Data=0;
for(i=0;i<8;i++){
SCL = 0;
SCL = 1;
if(SDA)
Data |=1;
Data<<=1;
}
SCL = 0;
SDA = 1;
return Data;
}
 
8051 is not having the inbuilt I2C, so you need to have software i2c implementation
I2c code....

#define SDA P0_0
#define SCL P0_1

void I2CInit(){
SDA = 1;
SCL = 1;
}

void I2CStart(){
SCL = 1;
SDA = 0;
SCL = 0;
}

void I2CRestart(){
SCL = 0;
SDA = 1;
SCL = 1;
SDA = 0;
}

void I2CStop(){
SCL = 0;
SDA = 0;
SCL = 1;
SDA = 1;
}

void I2CAck(){ // Does the Ack signal need to be generated by code?
SDA = 0;
SCL = 1;
SCL = 0;
SDA = 1;
}

void I2CNak(){
SDA = 1;
SCL = 1;
SCL = 0;
}

void I2CSend(unsigned char Data){
unsigned char i;
for(i=0;i<8;i++){
SCL = 0;
if((Data&0x80)==0)
SDA = 0;
else
SDA = 1;
SCL = 1;
Data<<=1;
}
SCL = 0; // Why this clock and data lines to be assigned to these values at end? Is it must ?
SDA = 1; // Why this clock and data lines to be assigned to these values at end? Is it must ?
}

unsigned char I2CRead(){
unsigned char i, Data=0;
for(i=0;i<8;i++){
SCL = 0;
SCL = 1;
if(SDA)
Data |=1;
Data<<=1;
}
SCL = 0; // Why this clock and data lines to be assigned to these values at end? Is it must ?
SDA = 1;
return Data;
}

Is it the Ack signal need to be generated by code?
Why this clock and data lines to be assigned to the 0 and 1 at end of read/write? Is it must ?
 
As mentioned earlier also the 8051 doesnt have the i2c inbuilt so we need to use the bit banging for it...
So yes you need to generate the ACK signal in the code and the SDA and SCL has been and 1 and 0 after the I2Cread and write because
once the data operation has been completed the default state SDA and SCL would be 1 and 0....
 
Thanks a lot for your suggestion... I will come back here If found any difficulties in that circuit implementation.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top