Hi Michael Schippling,
I found a mistake when I compiled it, which I did is 'SENSORBOARD=mts310
make micaz'. Actually, I put all interfaces of mts310 in folder
'/tos/sensorboards/micasb'. I just rename 'micasb' to 'mts310' and
compiled it again like 'SENSORBOARD=mts310 make micaz'. However, there is
an error which said 'In component `AccelConfigP':
/opt/tinyos-2.x/tos/sensorboards/mts310/AccelConfigP.nc:33: cannot find
`Resourc
eDefaultOwner''.
It seems the new component DemoSensorXC and DemoSensorYC worked, but the
component 'ResouceDefaultOwner' is located in '/tos/interfaces'. Why the
compiler cannot find it?
I named the packet 'GetAccel'. Part code of of GetAccelC.nc:
module GetAccelC
{
uses {
interface Boot;
interface SplitControl as RadioControl;
interface AMSend;
interface Receive;
interface Timer<TMilli>;
interface Read<uint16_t> as ReadX;
interface Read<uint16_t> as ReadY;
interface Leds;
}
}
implementation
{
message_t sendbuf;
bool sendbusy = FALSE;
getaccel_t local;
...
event void Timer.fired() {
if (call ReadX.read() != SUCCESS)
report_problem();
}
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();
}
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;
}
}
Where the message 'getaccel_t' define in file 'GetAccel.h' as:
typedef nx_struct getaccel {
nx_uint16_t version; // Version of the interval.
nx_uint16_t interval; // Samping period.
nx_uint16_t id; // Mote id of sending mote.
nx_uint16_t count; // The readings are samples count * NREADINGS onwards
nx_uint16_t readings[NREADINGS];
} getaccel_t;
code of 'DemoSensorXC' is list as following:
generic configuration DemoSensorXC() {
provides interface Read<uint16_t>;
}
implementation {
components new AccelXC() as Sensor;
Read = Sensor;
}
In 'DemoSensorYC', AccelXC is replaced by AccelYC .
Thanks for your patient to read my code.
Best regards,
Fangming
On 5/7/07, Michael Schippling <[EMAIL PROTECTED]> wrote:
You may have something missing in one of your config files, or perhaps
have your new files in the wrong directory. To continue down the
DemoSensor
route you need to find and clone every reference.
If you are using T1 there is an Accel component in the micasb directory,
that might be easier to use then trying to emulate DemoSensor...
If it continues to be a pointless exercise, post (all of) your code so we
can try to figure it out.
MS
Fangming Zhang wrote:
> Hi Michael Schippling,
>
> The problem is it is difficult processing in the 'DemoSensorC' , as
> 'DemoSensorC' only provide one interface 'Read' with one data. I tried
> to set up a 'DemoSensorXC' and a 'DemoSensorYC', which want to read X
> and Y acceletation data separately, and use interface 'AccelXC' and
> 'AccelYC' correspondingly. However, the compile cannot find
> 'DemoSensorXC' and 'DemoSensorYC'.
>
> How about I use 'ReadStream' or 'AccelReadStreamP'?
>
> regards,
> Fangming
>
> On 5/7/07, *Michael Schippling* < [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
> You will need to create two DemoSensor type files that differ
> only in their ADC channels. Or for extra credit you can just
> eliminate the entire DemoSensor thing and just use ADC[x] & ADC[y],
> where x and y are the channel numbers of interest.
>
> Generally you could use a Timer to fire off the first ADC.getData()
> conversion and then in the dataReady() of that ADC, fire the next
one.
> There is some indication that you could do both getData()'s in the
> timer fire routine -- and internal ADC queuing code will handle the
> sequencing -- but I haven't actually tried it...
>
> seem reasonable?
> MS
>
>
> Fangming Zhang wrote:
> > Hi everyone,
> >
> > I use a MTS310 to read the accelometer data, X and Y. The
wireless
> > platform is micaz. My difficulty is how to implement measure and
> put the
> > X and Y acceleration in one 'DemoSensorC' file. It seems the
> interface
> > 'Read' can only read one AD port. How can I do?
> >
> > Regards,
> > Fangming
> >
> >
> >
>
------------------------------------------------------------------------
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
> <mailto:[email protected]>
> >
>
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> <
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help>
>
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help