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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

1,055 次查看
mindriot21
Contributor I
Hi.

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
        {
            __RESET_WATCHDOG();
        }
           
        data[i]=IICD; // should see data apearing here butI'm not
        i++;         
        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.

THANKYOU



标签 (1)
0 项奖励
1 回复

262 次查看
mindriot21
Contributor I
Still. Having problems.

I have also pinned it down to the Simulator not acknowledging any data comming in on the IIC other than the address byte. I downloaded some sample code from one of the other posts on this forum and it still doesn't work.

I'm wondering if it's my codewarrior compiler of the simulator. I'm using codewarrior V6.2 but without the latest patch as I can't download it from the freescale site.

Please if anyone has any ideas let me know as this is driving me crazy.
0 项奖励