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.

soft i2c doesnot works

Status
Not open for further replies.

sumani

New Member
hi all
for my project i wrote the following code and simulate through protest.

void main() {

int a;
char txt[10];
//Soft_I2C_Config(&PORTD, 3, 4); // Initialize full master mode
lcd_config(&PORTB,1,2,3,7,6,5,4);
TRISB = 0;
PORTB=0;

Lcd_Out(1,2, "Hello");
Lcd_Cmd(Lcd_CURSOR_OFF);


// Soft_I2C_Start(); // Issue start signal
// Soft_I2C_Write(0xA0); // Address PCF8583
// Soft_I2C_Write(0); // Start from word at address 0 (configuration word)
// Soft_I2C_Write(0x80); // Write 0x80 to config. (pause counter...)
// Soft_I2C_Write(0); // Write 0 to cents word
// Soft_I2C_Write(0); // Write 0 to seconds word
// Soft_I2C_Write(0x30); // Write 0x30 to minutes word
// Soft_I2C_Write(0x11); // Write 0x11 to hours word
// Soft_I2C_Write(0x30); // Write 0x24 to year/date word
// Soft_I2C_Write(0x08); // Write 0x08 to weekday/month
// Soft_I2C_Stop(); // Issue stop signal
//
// Soft_I2C_Start(); // Issue start signal
// Soft_I2C_Write(0xA0); // Address of eeprom
// Soft_I2C_Write(0); // Start from word at address 0
// Soft_I2C_Write(0); // Write 0 to config word (enable counting)
// Soft_I2C_Stop(); // Issue stop signal




}//~!

the software I2C doesnt works and if i enable Soft_I2C_Config(&PORTD, 3, 4);(uncomment) then the simulations strucks and even the LCD out put didin't come. don't care of the rest of the i2c codes. even still they are disabled and if i just enable only "Soft_I2C_Config(&PORTD, 3, 4);" line then there is no lcd output at simulations.
hereby i've attached my microc code and protest file.
 

Attachments

  • i2c test.zip
    43.1 KB · Views: 112
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top