Hi Hugo, Your guess is right. I read one axis, then wait readDone() to start another axis. Your explanation let me understand what caused this problem. However, I still cannot understand how to use accelStream. I list my old methods as follows. Please help find how to solve the problem.
I created a DemoSensorXC and a DemoSensorYC, which look like: generic configuration DemoSensorXC() { provides interface Read<uint16_t>; } implementation { components new AccelXC() as Sensor; Read = Sensor; } In the application code, it look like: module GetAccelC { uses { interface Read<uint16_t> as ReadX; interface Read<uint16_t> as ReadY; ... } } implementation { //start to read X axis event void Timer.fired() { if (call ReadX.read() != SUCCESS) report_problem(); } //start to read Y axis after X is done event void ReadX.readDone(error_t result, uint16_t data) { if (result != SUCCESS) { data = 0xffff; report_problem(); } local.readings[0] = data; //start to read Y axial acceleration if (call ReadY.read() != SUCCESS) report_problem(); } //send message out when Y is done event void ReadY.readDone(error_t result, uint16_t data) { if (result != SUCCESS) { data = 0xffff; report_problem(); } local.readings[1] = data; //send if (!sendbusy && sizeof local <= call AMSend.maxPayloadLength()) { memcpy(call AMSend.getPayload(&sendbuf), &local, sizeof local); if (call AMSend.send(AM_BROADCAST_ADDR, &sendbuf, sizeof local) == SUCCESS) sendbusy = TRUE; } if (!sendbusy) report_problem(); /* Part 2 of cheap "time sync": increment our count if we didn't jump ahead. */ if (!suppress_count_change) local.count++; suppress_count_change = FALSE; } } I think the key is the AccelConfigP.nc is used only once, but I still don't know how to realize it. Is that right? Regards, Fangming On 5/12/07, Hugo Sousa <[EMAIL PROTECTED]> wrote:
We need more information about your application, but I'm guessing you are reading one axis, and when you get the readDone() you read the other axis, right? The accelerometer sensor has a warmup time of 17 ms (check AccelP.nc), that means that every time you do a Read.read() it takes 17 ms to turn it on and receive one reading. So the time for two readings (one X axis read and one Y axis read) can be 34ms and that value comes allows 30Hz sampling frequency, Try using the accelStream components to get that frequency sampling. Cheers Hugo On 5/12/07, Fangming Zhang < [EMAIL PROTECTED]> wrote: > Hi everyone, > > My hardwares are MIB520, MTS310, and MICAZ. The transmitting rate of > MIB520 is 57.4Kbps, and that of MICAZ is 250Kbps. The platform is > Tinyos2.0. My objective is getting sample frequency of 64Hz when I only > need data of accelerometer data, X and Y axis. However, it shows we can only > obtain about 31Hz in my test expriment. Does this limited my TinyOs2.0? > Or, is there any methods could improve this result? > > Regards, > Fangming > > _______________________________________________ > Tinyos-help mailing list > Tinyos-help@Millennium.Berkeley.EDU > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > >
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help