Przemyslaw Lisowski

I need help!!! How to read from CMPS03 with HC12 thru i2c

Discussion created by Przemyslaw Lisowski on Jun 20, 2006
Latest reply on Jul 11, 2006 by Przemyslaw Lisowski
Hello
I'm trying to read from CMPS03 using my HC12A64.
I'ts a big problem for me and I can't solve it.
Here under is a code that i've written:

void initI2C(void){
IBCR_IBEN=1; //I-Bus Enabled
IBCR_MS_SL=1; //Master mode selected
IBCR_TX_RX=1; //Transmit mode selected
IBFD=0x14;
}

interrupt void rti_isr(void){
if (PORTA_BIT0==1) //it's only for LED
PORTA_BIT0=0; else
PORTA_BIT0=1;
IBDR=0xC0; //This is the address of cmps03
while (IBSR_TCF==0);
IBDR=0x01; //this is the register that I want to read
while (IBSR_TCF==0);
IBCR_RSTA=1; //Repeated start
IBDR=0xC1; //This address was written in CMPS03 datasheet
while (IBSR_TCF==0);
IBCR_TX_RX=0;
while (IBSR_TCF==0);
IBSR_RXAK=1;
polozenie=IBDR;
while (IBSR_TCF==0);
IBCR=0;

IT dosen't work. Can anybody help me

}

Outcomes