Adam Farrugia

Please Help. Problem using a 9S08SH8 as a IIC slave. Won't work for me.

Discussion created by Adam Farrugia on Dec 6, 2008
Latest reply on Dec 9, 2008 by Adam Farrugia

I'm trying to communicate between 2 9S08 uP's. The first one is a 9S08AW64 which is the master and I know is working fine on the IIC output as it is talking to another IIC device on the bus. my problem is that I can not get the IIC to work on my 9S08SH8 uP in a slave mode.

I'm using codewarrior, and I've tried simulating with both the P&E simulator and by programming the chip butI can't seem to get any sucess.

When I simulate, I can see the device Adresss packet is comming through and and setting the IICS_IAAS bit in the IICS register. and the address data appears in the IICD register. one of my problems is that after this transmission all subsiquent data packets that arrive in this transmission don't appear to be on the IICD register. Everytime I look at it it always just shows the calling address and not the latest byte that has just come in. Also when I try and use interupts to drive the S08SH8 in slave mode, it doesn't seem to catch any interupts after it gets the address interupt. It is like I need to set a bit of a flag to tell the IIC that the adresses mach from the master and that the next byte of information is data and should appear on the IICD register but it doesn't.

// wait for a transfer
        while( IICS_IAAS==0) //unit not yet addressed
            __RESET_WATCHDOG(); // reset the watchdog. */
        //address matches
        mode=IICD; //disguard junk data
        IICS_IICIF=0;// clear pending interupt.
        while(IICS_IICIF==0)  //waiting for the next byte to come in
        data[i]=IICD; // should see data apearing here butI'm not
        IICS_IICIF=0;// clear pending interupt

If someone has any experience in using a 9S08 as a slave please let me know as I can't find and references for it online.