Przemyslaw Lisowski

i2c, reading one byte - transmition stops

Discussion created by Przemyslaw Lisowski on Jul 2, 2006
Latest reply on Jul 6, 2006 by Jeff Smith
Hello
Under is my script that i've written to read from CMPS03.
I've a problem because when I'm trying to read from CMPS03 the transition stops and I dont know why.

PORTA_BIT0=0;
while(IBSR_IBB==1){
}
PORTA_BIT1=0; //first LED off
IBCR_IBEN=1; //I-Bus Enabled
IBCR_MS_SL=1; //HC12 is Master
IBCR_TX_RX=1; //Transmit mode

IBDR=0xC0; //sending the address of cmps03
while(IBSR_IBIF==0){
}
if (IBSR_RXAK==0) //control for acknowledge received
PORTA_BIT2=0;
IBSR_IBIF=1;

IBDR=0x01; //sending the number of register i want to read from
while(IBSR_IBIF==0){
}
if (IBSR_RXAK==0)
PORTA_BIT3=0;
IBSR_IBIF=1;

IBCR_RSTA=1; //repeated start

IBDR=0xC1; //sending the address of cmps03 with R/Wbit
while(IBSR_IBIF==0){
}
if (IBSR_RXAK==0)
PORTA_BIT4=0;
IBSR_IBIF=1;

IBCR_TX_RX=0; //received mod
IBCR_TXAK=0; //transmit akc will be send

while(IBSR_IBIF==0){ //waiting for receive to complete

**************************************
* In this loop the transmition stops *
**************************************

}
IBSR_IBIF=1;

polozenie=IBDR;

IBCR_MS_SL=0; //sending stop bit

PORTA=0xFF;

Outcomes