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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to