We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi I Have problem to run the I2C on 89c669. // function init_i2c // initializes the I2C peripheral void init_i2c(void) { P1 |= 0xC0; // set P1.6 and P1.7 open drain TMOD |= 0x01; // timer 0 mode 1 EI2C = 1; // enable I2C interrupts EA = 1; // global interrupt enable } // function rtc_write_byte // stores a byte in a specific register in the Real Time Clock // passed is the register address and the byte to store // nothing is returned // result of the operation is stored in i2c_status and may be // I2C_OK or I2C_ERROR void rtc_write_byte(unsigned char address, unsigned char byte) { i2c_storage_address = address; // copy the register address i2c_byte = chartobcd(byte); // convert to BCD and copy the byte i2c_status = I2C_BUSY; // I2C is now busy i2c_operation = WRITE; // a write operation is being performed I2CON = 0x40; // enable the I2C perhiperal // no acknowledgements will be returned I2CON |= 0x20; // request a start condition is transmitted // therefore putting I2C perhiperal in Master Transmitter mode while(i2c_status == I2C_BUSY); // wait until I2C is not busy } and after that i wait for an Interrupt. But nothing happens. I've changed my sfr to sfr I2ADR = 0x94; sfr I2CON = 0x91; sfr I2DAT = 0x93; sfr I2CLH = 0x96; sfr I2CLL = 0x95; sfr I2STA = 0x92; Need help please. /Ingo
Anyone who has an header for 669 The datasheet 'does' I always make my own. My name allow global search on bits and sfrs regardless of the use. I have seen too many lenghty debug sessions due to things like IE = and EX0 = not coming out in the same search. my names are e.g.
sfr SF_IE = 0xA8; sbit SB_IE_EX0 = 0xA8; #define SM_IE_EX0 0x01