[Tinyos-help] No return from MSP430ADC12Multiple.dataReady( buffer, 55, 1000)

Mike Deneen mpdeneen at gmail.com
Tue Sep 27 15:22:13 PDT 2005


Hello,

I'm trying to sample a signal at 1kHz and the TimerC can't fire that
frequently. I'm attempting to fire the timer every 55ms and trigger a series
of 55 samples with MSP430Multiple. As far as I can tell,
MSP430ADC12Multiple.dataReady never returns (I put a led toggle there to
check it...).

I'm sorry if this is very basic, but I'm just getting started here.

Thanks,

-Mike

includes MSP430Timer;
includes MSP430ADC12;

module KhzsampleM {
provides interface StdControl;
uses {
interface MSP430ADC12Multiple as MicMultiple;
interface Leds;
interface Timer;
interface ADCControl;
interface StdControl as SensorControl;
interface StdControl as CommControl;
interface SendMsg as DataMsg;
interface ReceiveMsg as ResetCounterMsg;

}
}
implementation {
#define BUFFERSIZE 55
uint16_t seqdata[BUFFERSIZE];
norace int i;
TOS_Msg msg[2];
uint8_t currentMsg;

command result_t StdControl.init() {
call Leds.init();
call SensorControl.init();
return SUCCESS;
}

command result_t StdControl.stop() {
call SensorControl.stop();
call Timer.stop();
call CommControl.stop();
return SUCCESS;
}

command result_t StdControl.start() {
call SensorControl.start();
call Timer.start(TIMER_REPEAT, 55);
return SUCCESS;
}

task void dataTask() {
struct KhzMsg *pack;
atomic {
pack = (struct KhzMsg *)msg[currentMsg].data;
pack->lastSampleNumber = 0;
}

pack->channel = 1;
pack->sourceMoteID = TOS_LOCAL_ADDRESS;

if (call DataMsg.send(TOS_BCAST_ADDR, sizeof(struct KhzMsg),
&msg[currentMsg]))
{
atomic {
currentMsg ^= 0x1;
}
call Leds.yellowToggle();
}
}

async event uint16_t* MicMultiple.dataReady(uint16_t *buf, uint16_t length)
{/*Move data from buf[] to msg[].data[] and send to base station*/

struct KhzMsg *pack;
atomic { call Leds.redToggle();

pack = (struct KhzMsg *)msg[currentMsg].data;
for(i=0; i<length; i++)
{
pack->data[i] = buf[i];
}
post dataTask();
}
return (uint16_t*)buf;
}

event result_t Timer.fired() {
call MicMultiple.getData(seqdata, BUFFERSIZE, 1000);
return SUCCESS;
}

event TOS_MsgPtr ResetCounterMsg.receive(TOS_MsgPtr m) {
return m;
}
event result_t DataMsg.sendDone(TOS_MsgPtr sent, result_t success) {
return SUCCESS;
}
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20050927/51d61613/attachment.htm


More information about the Tinyos-help mailing list