It's possible that INT0 is never true so you'll never call
IntOutput.output(value); I'd start by removing that check.
Also you should probably have the output() call in a separate
function so you can post it as a task because it takes some
time to run and Timer.fired() is basically an interrupt routine.
MS
Dipti wrote:
Dear Michael,
I did the same thing as asked by u. I tried to read the all the 8 bits of
the portc altogether by
uint8_t value=inp(PINC);
and created an application called Listener which has to read data from the
PW pins and forward the same on Rf.
I loaded this code on one of the motes. I programed the other mote to
receive the Rf data from the first mote.
The application does not give any errors but i cant see the result. As in i
dont see the external digital data given on Pw pins of
mote 1 being rxd by mote 2. I feel there is some problem with the
application i loaded on mote1. Sending u the same. Kindly tell me
where exactly did i go wrong.
the Listener application is as follows:
module Listener {
provides {
interface StdControl;
}
uses {
interface IntOutput;
interface Powers;
interface Timer;
}
}
implementation {
uint8_t value;
int state;
TOSH_MAKE_PORTC_INPUT();
command result_t StdControl.init()
{
return SUCCESS;
}
command result_t StdControl.start()
{
return call Timer.start(TIMER_REPEAT,250);
}
command result_t StdControl.stop()
{ return call Timer.stop();
}
event result_t Timer.fired()
{
TOSH_MAKE_INT0_INPUT();
state=TOSH_READ_INT0_PIN();
if(state==1)
{
value=inp(PINC);
call IntOutput.output(value);
}
return SUCCESS;
}
event result_t IntOutput.outputComplete(result_t success)
{
TOSH_CLR_INT0_PIN();
return SUCCESS;
}
}
----- Original Message -----
From: "Michael Schippling" <[EMAIL PROTECTED]>
To: "Jacob Sorber" <[EMAIL PROTECTED]>
Cc: "Dipti" <[EMAIL PROTECTED]>; "tinyos forum"
<[email protected]>
Sent: 2007 Apr 23 10:36 PM
Subject: Re: [Tinyos-help] How to read digital data on the PW pins and
forward the same on RF
Typo....that should be....
int value = TOSH_READ_PW1_PIN();
You can also use "MAKE*INPUT" on your bits and then
read the entire port and mask off the part you don't want
(I'm pretty sure the PWn bits are PortC):
uint8_t val = inp( PINC );
MS
Jacob Sorber wrote:
This depends on how the other microcontroller is "sending" the data to
the mica2. If it is serial, then you should use the UART rather than
the PW pins (no reason to reimplement the wheel). If you just need to
read a logic high or a logic low, then you can read it this way.
//For PW1
//set the pin as an input, so that the other MCU can drive it.
TOSH_MAKE_PW1_INPUT();
int value = TOSH_READ_PW1_PN();
Hope that helps,
Jacob Sorber
On 4/23/07, *Dipti* <[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
Hi all,
How can i read the PW pins of the mica2 motes and forward the same
on Rf? In my application external data comes to the PW pins of mica2
from another microcontroller. The mica2 mote has to read this data
and forward it on RF. I have tried to implement the application on
grounds of the Oscilloscope sample prgm but i dont know a way to
read and monitor the PW pins.
Please help me. Its urgent.
Thanking you,
Dipti Jaiswal
_______________________________________________
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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help