View unanswered posts | View active topics It is currently Tue Jul 22, 2014 4:49 pm






Reply to topic  [ 1 post ] 
I2C bug? 
Author Message
Expert

Joined: Sun Aug 19, 2007 2:43 pm
Posts: 134
Location: New Jersey
Post I2C bug?
This is very peculiar.

Code:
        sendI2CMsg(Fingers[f].s, sOutput.nMsgSize, 6);
        while (nI2CStatus[Fingers[f].s] == STAT_COMM_PENDING)
            wait1Msec(2);
        memset(nAccelData, 0, 6);
        if (nI2CStatus[Fingers[f].s] == NO_ERR)
        {
            readI2CReply(Fingers[f].s, nAccelData[0], 6);
             ....
            Fingers[f].x = (xUpper << 2) | xLower;
             ...

Notice that Fingers[f] where f is an "int" type. This will give me 0 x,y,z reading every other read/send.

Then, I put in the constant instead in the "read.." and "send..", things will start working again.

Code:
        sendI2CMsg(Fingers[1].s, sOutput.nMsgSize, 6);
        while (nI2CStatus[Fingers[f].s] == STAT_COMM_PENDING)
            wait1Msec(2);
        memset(nAccelData, 0, 6);
        if (nI2CStatus[Fingers[f].s] == NO_ERR)
        {
            readI2CReply(Fingers[1].s, nAccelData[0], 6);
             ....
             ....
            Fingers[f].x = (xUpper << 2) | xLower;
            .....



So, I have to do a silly workaround.

Code:
    void somefuncf(int f)
    {
        tSensors ss;
        ....
        ss = Fingers[f].s; // where Fingers[f].s  equals to S1.
        ...
       sendI2CMsg(ss, sOutput.nMsgSize, 6);
       ...
            readI2CReply(ss, nAccelData[0], 6);
        ...


Although there is a workaround, the reference of Fingers[f].s should work though.


Sat Aug 16, 2008 8:10 pm
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.