[Tinyos-devel] MDA300/MDA320 - Writing to digital I/O ports
Brandon Arnold
brandon.arnold at gmail.com
Tue Apr 22 16:32:55 PDT 2008
Hey Dhivya,
I just checked it and you're right, what I said only applies if you're using
one I/O port. I was able to fix this and get it working for all ports by
altering the MDA3x0 driver (tos/sensorboards/mda3x0/...) in the following
way.
In DioM.nc, the set_io_high() function, at the very end it says:
---------------
else
bitmap_high=0x0;
---------------
This needs to be changed to:
---------------
else
{
bitmap_high=0x0;
io_value=i2c_data;
}
----------------
Do the same for the set_io_low() function, but with bitmap_low instead of
bitmap_high. Don't bother doing this with set_io_toggle(), it won't fix it.
-Brandon Arnold
On Mon, Apr 21, 2008 at 1:12 AM, Dhivya G <dhivyabe at gmail.com> wrote:
> Hi,
> I am using Micaz mote,MDA320 Data Acquisition board and Mib520
> programming board of crossbow. For my application I have to set any three
> Dio pins of MDA320 board to low. I used DioC component and Dio interface in
> my program.
>
> I set modes of Dio0,Dio1,Dio2 pins as DIG_OUTPUT in DioM.nc.
>
> In StdControl.start() I gave the following lines:
>
> command result_t StdControl.start() {
> call DioControl.init();
> call DioControl.start();
> call Dio0.low();
> call Dio1.high();
> call Dio2.high();
> return SUCCESS;
> }
> But my code is not working.All the pins are showing high only.If I set
> only one pin to low its working. What modifications should I have to made to
> set all 3 pins to low
>
>
> --
> Regards,
> G.Dhivya
>
>
> On Fri, Apr 18, 2008 at 11:06 PM, Brandon Arnold <brandon.arnold at gmail.com>
> wrote:
>
> > Hello,
> >
> > There's been a recurring question in tinyos-help concerning the use of
> > digital I/O ports on the MDA3x0 DAQ boards. At this time,
> > set_digital_output() is a command that's referenced in Sample.nc, but is as
> > of yet unimplemented in SamplerM.nc (the function is empty). One can get a
> > good idea of how to bring a pin high or low by reading through the
> > implementation of the Relay code, which uses the Dio interface. The only
> > difference is that Dio.setparam(DIG_OUTPUT) must be called for digital
> > output ports before they can be set using the Dio.low(), Dio.high(), or
> > Dio.Toggle() functions (notice the caps on Toggle(), high(), and low().)
> >
> > However, there is an issue when calling the Toggle() function on the Dio
> > interface. The use of Toggle() results in a short toggling and re-toggling
> > on the chosen channel, which looks like a pulse. As it stands in DioM.nc,
> > the global variables io_value and i2c_data are intended to hold,
> > respectively, the latest data read from and written to the pins. I suspect
> > there is a race occurring between the "i2c_data=io_value;" line in
> > set_io_toggle() and the "io_value=i2c_data;" line in readPacketDone().
> >
> > Fleshing out the set_digital_output() command in Sample.nc would be
> > simple enough by doing a switch statement on the enums defined as SET_HIGH,
> > SET_LOW, and SET_TOGGLE, and calling the appropriate function. However, it
> > seems the only way to set the mode of a digital port to DIG_OUTPUT is to
> > call the Sample.getSample() command. Since the naming could cause some
> > confusion, I request removing the set_digital_output command from the Sample
> > interface altogether.
> >
> > Thank you,
> > Brandon Arnold
> >
>
>
>
> --
> G.Dhivya
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20080422/032fb48f/attachment.htm
More information about the Tinyos-devel
mailing list